Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BryanAdept4
Regular Visitor

Uptime Robot - Web API - "A web API key can only be specified when a web API key name is provided"

Hi All,

I would like to use Power BI to query our Uptime Robot account to gather information 

It all looked easy enough, but am having similar issues to other posts where I get an error response when applying the API Key.

 

PBI-API.PNG

 

In the Uptime Robot API page (https://uptimerobot.com/api) it gives the instructions that look very simple.

Specifically I want to use the getMonitors command to gather all info about all the monitors (websites).

 

I'm obviously missing something, perhaps needing to pass something in the HTTP Headers section in Advanced, does anyone have information that could point me in the right direction?

 

Below are excerpts from the Uptime Robot API page that may help but I've not been able to get working.

 

============================================

Uptime Robot has a very easy-to-use API.

Responses are provided as XML, JSON or JSON-P.

It lets you get the details of your monitors, logs, create/edit/delete monitors, alert contacts and maintenance windows.

That's all.

============================================

Authentication

HTTP Basic Access Authentication is used for verifying accounts.

There are 2 types of api_keys for reaching the data:

  • account-specific api_key which allows using all the API methods on all the monitors of an account (I am using this)
  • monitor-specific api_keys which allows using only the getMonitors method for the given monitor

============================================

Formats

Responses can either be XML or JSON. Just mention the preferred format as:

format=xml or format=json

In order to get a JSON-P response, the requests need to be sent with a parameter named callback like callback=jsonpUptimeRobot and the response will return as:

jsonpUptimeRobot({...});

=======================================================

Methods

Methods are defined just after the API URL (for ex: https://api.uptimerobot.com/v2/methodName). And, here they are:

 

POST getMonitors

This is a Swiss-Army knife type of a method for getting any information on monitors.

By default, it lists all the monitors in a user's account, their friendly names, types (http, keyword, port, etc.), statuses (up, down, etc.) and uptime ratios.

There are optional parameters which lets the getMonitors method to output information on any given monitors rather than all of them.

And also, parameters exist for getting the notification logs (alerts) for each monitor and even which alert contacts were alerted on each notification.

Parameters:
  • api_key - required
  • monitors - optional (if not used, will return all monitors in an account. Else, it is possible to define any number of monitors with their IDs like: monitors=15830-32696-83920)
6 REPLIES 6
TheOnlyBob_2
Frequent Visitor

Hi guys,

 

I was just playing around trying to get this to work today and with a bunch of digging I found the solution.

I created a blank query with the code below and it worked:

 

let
   body = Text.ToBinary("api_key=ENTER-API-KEY-HERE&format=json&logs=1"),
   actualUrl = "https://api.uptimerobot.com/v2/getMonitors",
   Options = [
   Headers=[#"Content-type"="application/x-www-form-urlencoded", #"cache-control"="no-cache"],
   Content=body
   ],
   result = Web.Contents(actualUrl, Options)
in
    result

This should give you the basis for any query, just adjust 'body' to put in a different payload.

 

Credit to these threads for getting me there

https://community.powerbi.com/t5/Desktop/How-to-add-body-into-Web-Contents/td-p/128996

https://social.technet.microsoft.com/Forums/en-US/df940ff3-46da-4340-9211-bf7593081d9f/webcontents-p...

 

MisterMagoo
Frequent Visitor

Hi @BryanAdept4, did you solve this issue? I am having exactly the same one...

Thanks!
Bye,

A.-

v-yuezhe-msft
Employee
Employee

Hi @BryanAdept4,
 

Please check the following similar threads about how to generate a POST request by specifying the Content option.

https://social.msdn.microsoft.com/Forums/en-US/029fed1d-56fe-476a-9d7d-f367c5036b6e/posting-xml-to-a...
https://community.powerbi.com/t5/Integrations-with-Files-and/M-Query-to-use-POST-method-on-a-Web-API...

Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, I've had a look at those and can't untangle it unfortunately.

Any other options?

I have reached out to Uptime Robot to see if they have anything already in play

Hi @BryanAdept4,

You would need to firstly consult Uptime Robot support about how to invoke their API, then connect to it from Power BI Desktop.

Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BryanAdept4
Regular Visitor

PBI POST.PNG

Issuing a different command (getAccountDetails) gets further and shows that Power BI is issueng this as a GET command rather than a POST command. 

How do I set the commands as POST rather than GET?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors