Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi
I am having a hard time connecting to data via API. I am attempting pull out data from Samsara, https://www.samsara.com/api#. (the website is public info). They use something called Bearer Token. I have my token. I have no issues making a call, and getting data via Terminal.
Could someone please tell me the steps in connecting to an API in PowerBI, having to use the company issued Bearer Token they provide to you.
The steps in PowerBI I took are....Get Data>Web. Have been unsuccessful. Please see pictures of the different things I have tried.
Thank you
FYI: Apparently, Samsara is working on a PowerBI Connector to be released sometime towards the end of 2023.
You will need an API key for Samsara to use the BI web API access.
Double check ... have you tried replacing <API Token> with the actual token?
should look like
Bearer samsara_api_VariousNumbersLetters
The solution that continues to be missed, offered up by @jayhawk and again by @Mdauria6087
Replace "3U2" with your token and you are on your way!
This solved it for me
Did anyone figure out how to set up automatic refreshes on this data source? I have been able to pull the data from Samsara (thank you all for the above support), but when I publish online, I can't set up refreshes due to missing web credentials?
This is my M-Script call:
Json.Document(Web.Contents("https://api.samsara.com/fleet/vehicles", [Headers=[Authorization="Bearer myapiKey"]]))
and off of the vehicle id columns i call:
#"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each Json.Document(Web.Contents("https://api.samsara.com/",[RelativePath = "v1/fleet/trips" & "?startMs=" & Text.From(Duration.TotalSeconds(startMs - #datetime(1970, 1, 1, 0, 0, 0))) & "000" & "&endMs=" & Text.From(Duration.TotalSeconds(Date.From(DateTimeZone.LocalNow())-#date(1970, 1, 1))) & "000" & "&vehicleId=" & [data.id], Headers = [Authorization = "Bearer " & "myapiKey"]]))),
Did you resolve this? I'm stuck with the same issue
Unfortunately, no I never solved it, ended up just abandoning the project as leadership lost interest in it.
Give this a shot.
Does anyone know how to get a full YTD dataset from the Samsara API. The endCursor is limiting me to 3 rows only.
Here is my call:
GET /fleet/hos/daily-logs?startDate=2022-01-01&endDate=2022-11-01&driverActivationStatus=active&expand=vehicle HTTP/1.1
Accept: application/json
Authorization: Bearer samsara_api_?????????????????????????
Host: api.samsara.com
I have a similar situation where I am trying to extract distance data of fleets through Fleet company's web API service. I am done with API authentication from where I got a ClientID, UserID & Token. Now using this information, I am trying to make API calls from power bi. Below are the snapshots of steps which I followed;
when the API call completes it shows null in data and an error
I have further expanded the error below. It says that "TotalDistance" property in "Distance" report cannot be set to a System.Decimal value it should be set to a non-null value of type System.Double
apart from this, I have tried making calls from their web API service portal and it runs fines and gives responses in JSON. Below is the snapshot of that
Please provide your valuable feedback on this problem.
Hi,
Your solution worked for me too (put "Authorization" as header parameter and then "Bearer [Bearer_key]" as value.
But how can i setup a daily update when i publish my report ? Where do i put the bearer token ?
Hi @jayhawk ,
Sorry, I don't know much about API. Hope these documents can help you:
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I am also struggling to connect to the same API using Power BI
I’ve followed the Samsara API Call documentation from here: https://developers.samsara.com/docs and attempted the following ‘First API Call’ Curl instructions but using Microsoft Power BI Desktop.
curl --request GET \
--url https://api.samsara.com/fleet/drivers \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {access_token}'
The next menu asks for the Key and here I have used the API token again.
I get the message 'An API key value wasn't specified'
Please can anyone help me with this? Samsara have been unable to assist with the Power BI side of things.
@Anonymous Here ya go. You should be good to go bud.
Right click on the work List.
Right click on the work List again.
Thanks! This worked out perfectly! I am not sure why nobody has marked this as a solution.
That first screenshot is the solution as of this date!
Hey, thank you for helping so quick and also including how to drill down in to the table.
I've tried following your screenshots but I'm lost again as it asks me to authenticate again.
Clicking OK brings up this, I've gone for 'Web API' but this may not be right.
I've also tried various iterations of the API Token, taking out the 'samsara_api_' part et., but no luck. I must be doing something else wrong!
@Anonymous ....looks like that's all correct. Have you tried making a call in Postman yet? Let me know.
Hi! I'm in! Samsara support just got back to me. The link for us on this side of the pond must be https://api.eu.samsara.com
Thanks Again for your help.
So, just for the record:
Then select Anonymous in the next section.
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
105 | |
99 | |
98 | |
38 | |
37 |
User | Count |
---|---|
154 | |
120 | |
73 | |
73 | |
63 |