Forum Discussion

mparravani's avatar
mparravani
Regular Visitor
8 years ago

Connect to Bamboo's REST API- Error"Web API key can only be specified when API key name is provided"

Hello,

 

I'm relatively new to PowerBI, and am trying to connect to Bamboo's Open API (REST API). 

 

My workflow is going through PowerBI's "New Source" --> "web" --> in "basic" I enter Bamboo's API URL (https://api.bamboohr.com/api/gateway.php/{company subdomain name}/)

 

Then at the Authentication window, I select Web API and input the API key I generated in Bamboo. Then I get an error "a web API key can only be specified when a web API key name is provided"

 

I've read around, and have seen that the api key name is required in Web.Content. But where / how do i enter this and what is the "api keyname"? Under "New Source" --> "web" --> there is an "advanced" option that has HTTP Request headers, but none of them are "web.content" or API keyname.

 

Any help or nudge in the right direction would be awesome.

 

Thanks,

-Mike

 

22 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    I had the same issue initially but made it work by following these steps:

     

    Using BASIC Authentification works!

    Username - enter your [API Key]

    Password - enter "x"

     

    The url needs to be the full url that worked in your browser call; just remove the [API Key]:x@ from before api.bamboohr.com/api/...

     

    So if original call used in web browser was:

    https://[API Key]:[email protected]/api/gateway.php/[Company Name]/v1/employees/all/tables/jobInfo/

     

    The url to enter in powerbi is:

    https://api.bamboohr.com/api/gateway.php/[Company Name]/v1/employees/all/tables/jobInfo/

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Here's how I connected to our BambooHR data:

     

    1. <Optional> Create a service account in BambooHR and grant permissions to all the required fields for your query as well as the ability to create custom reports. Your service account will also need to have appropriate licensing in Office365.

    2. Create a custom report in BambooHR with the fields required. Note the report ID at the end of the address when viewing the report.

    3. Generate an API key in BambooHR. Make note of this API key because you will need it later.

    4. Open Power BI and Get Data > Web > Address: https://api.bamboohr.com/api/gateway.php/companyDomain/v1/reports/id?format=csv (filling in the companyDomain and report ID with your data) > Username: <API key> > Password: <blank>

    5. Create your visuals and publish your report to the Power BI service. 

    6. Refresh your data. If prompted, update the credentials for BambooHR using the Username: <API key> and Password: x.

     

    Good luck to you!

    • rush's avatar
      rush
      Helper V

      Anonymous Thank you very much.


      I managed to view the data but cannot refresh the data in the power bi service with basic authentification.

      Tried "" and x as the password and it fails each time.

      Please help.

      Thanks.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Are you using a data gateway to connect to BambooHR's API? Are you able to refresh the data in PowerBI Desktop? Have you made any changes to the report you are using to fetch the data?

    • mparravani's avatar
      mparravani
      Regular Visitor

      Hey,

       

      Thanks for the quick response.

       

      When I try this, and choose Anonymous credentials, I get the following error:

      DataSource.Error: Web.Contents failed to get contents from 'https://api.bamboohr.com/api/gateway.php/COMPANYID/' (404): Not found
      Details:
      DataSourceKind=Web
      DataSourcePath=https://api.bamboohr.com/api/gateway.php/COMPANYID
      Url=https://api.bamboohr.com/api/gateway.php/COMPANYID/

       

      All I have in the query line is:

      = Json.Document(Web.Contents("https://api.bamboohr.com/api/gateway.php/COMPANYID/", [Headers=[Authorization="APIKEY"]]))

       

      thanks

      -Mike

      • WolfBiber's avatar
        WolfBiber
        Microsoft Employee

        Hey,

        the query lin should look like this:

        let
            Source= Json.Document(Web.Contents("https://YourURI" & "Contact/" , [Headers=[Authorization="" & Token &""]])),
            objects = Source[objects]
        in objects

        But you have to investigate where the bamboo API wants the Credentials or Token. 

        Error 404 says that the url you are using is not found on the server.

        Maybe try a Client like Postman  to be sure everythings is working.

        Greetings,

        Wolf

  • gianfrancob's avatar
    gianfrancob
    Frequent Visitor

    Hello, I have the same problem and I don't seem to be able to get around it. 

     

    Has anyone an idea how to connect to bambooHR's API?

     

    I can do it via browser and with a python script just using my API key using the following format (in this case a report):

     

    "https://[my API key ]:[email protected]/api/gateway.php/{my organisation subdomain}/v1/reports/{report ID}?format=JSON&fd=no"

     

    but I don't seem to be able to replicate the same approach from powerbi.

     

    Has anyone any suggestion?

     

    THank you!

  • gianfrancob's avatar
    gianfrancob
    Frequent Visitor

    Hello, I have the same problem and I don't seem to be able to get around it. 

     

    Has anyone an idea how to connect to bambooHR's API?

     

    I can do it via browser and with a python script just using my API key using the following format (in this case a report):

     

    "https://[my API key ]:[email protected]/api/gateway.php/{my organisation subdomain}/v1/reports/{report ID}?format=JSON&fd=no"

     

    but I don't seem to be able to replicate the same approach from powerbi.

     

    Has anyone any suggestion?

     

    THank you!

    • Michal_cwiok's avatar
      Michal_cwiok
      Resolver II

      Managing to connect through web browser is great news.

       If "https://[my API key ]:[email protected]/api/gateway.php/{my organisation subdomain}/v1/reports/{report ID}?format=JSON&fd=no" works, it means that [my API key] is your username and x is your password. Try doing it in basic authentication.

       

      If you want to use it in Power Query, follow my tutorial here. You can look up Authentication string in your web browser. It will be something like Authentiaction = "Basic <some long string here>".

       

      Let me know, if you have any questions.

       

      • thomsontam's avatar
        thomsontam
        Frequent Visitor

        I had the similar issue, tried put the {API Key} in User Name and {x} in password still got "We Couldn't authenticate with the credentials provided."

         

         

  • Hi,

    I had the same error, so I used the following steps:

    1. Get Data--> Web --> Basic URL (make sure you have the https:// format as Bamboo specifies)

    2. Basic for access web content and add on user name the API key and at password a password that you want) and then connect

    The connection works, but make sure you play with PowerBI edit queries (e.g. pivot columns, transpose, etc..) to setup the format of the data so it can be easily used.

     

    Hope this helps.

     

     

     

  • Does anyone have any more guidance on how to get data through BambooHR's API into PowerBI? I don't have much experience using API requests, so I feel lost. I'm just looking to pull in a table of open positions in BambooHR and maybe also new/current employee details.

    • Jimmy801's avatar
      Jimmy801
      Community Champion

      Hello Domenick 

       

      normaly these sites have a help for developers where the specify the APIs available and how they work. Normaly different APIs are available, depending on witch data you need to get. And all of these APIs have different access modes and answers (that you need to do loops on the data, because normaly APIs are passing limited datasets).

       

      Hope this helps a bit

       

      Jimmy

      • Domenick's avatar
        Domenick
        Helper IV

        Yes, Jimmy801, I've found the documentation here, but it feels like there's a lot missing. They give basic guidelines about API calls, but I don't know all the paths I would need to pull the data I want.