Forum Discussion
Jibble 2 API access with Bearer token
Hi Anonymous
Thank you for the detailed information about the problem. I think your understanding is correct.
According to the API doc, it requires a POST request to get access token, so adding parameters to the header doesn't work. You need to add body parameters to Content in Web.Contents() function to change a GET to a POST. This is not possible to be edited with Web connector's User Interface, you need to modify the M code in Advanced Editor.
Create a blank query, open Advanced Editor from Home tab and paste below code into it to replace everything there. Use your client id and client secret for "xxxxxxx" in this code.
let
url = "https://identity.prod.jibble.io/connect/token",
headers = [#"Accept"="application/json", #"Content-Type"="application/x-www-form-urlencoded"],
postBody = [
grant_type = "client_credentials",
client_id = "xxxxxxxxxxxxxxxx",
client_secret = "xxxxxxxxxxx"
],
response = Json.Document(Web.Contents(url,
[
Headers = headers,
Content = Text.ToBinary(Uri.BuildQueryString(postBody))
]))
in
response
If you are not sure what your client id and client secret is, ask your company's IT or this software's Admin for help. From the API doc, it says "Client ID and client secrets can be created by organization owner".
Anyway, you need to get access token first before querying data from the report API. Let's go through the step one first. Here is a similar thread, hope it would be helpful: https://community.powerbi.com/t5/Power-Query/Channel-Advisor-API-Connection-with-auth-key-creation/td-p/2208091
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
I tried this and got the following error.
My code is exactly the same as yours.
here's my Jibble API page.
I wonder if my client ID is wrong? I assumed it was the 'Name' column shown above, but perhaps not.
- v-jingzhang4 years agoCommunity Support
Hi Anonymous
You didn't modify the response part. The url, headers and postBody should be passed to the Web.Contents function to make a POST request.
Best Regards,
Community Support Team _ Jing- Anonymous4 years agoNot applicable
I am still getting the (400): Bad Request error, even with my code edited to be like yours.
Is it wrong that both 'DataSourcePath' and 'Url' are the same?