Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
Hi, I'm having issues with this JSON POST request. I feel like I am just missing something obvious, would someone be able to assist? Thanks!
let
api_key = "XXXXXXXX",
startdate = DateTimeZone.From("2023-06-16T13:46:11.043Z"),
days_range =Text.From(7),
LoginURL = "YYYYYYY",
PostBody = [#"LocationIds"= 0 , #"Date"= startdate, #"Range"= days_range, #"MaxPerDay"= 0, #"LimitOverLaps"= false],
PostHeader = [#"auth_token" = api_key, #"Content-Type" = "application/json"],
JSONHeader = Json.FromValue(PostHeader),
JSONBody = Json.FromValue(PostBody),
out = Json.Document(Web.Contents(LoginURL,[Content=JSONBody,Headers=PostHeader]))
in
out
The error I receive:
DataSource.Error: Web.Contents failed to get contents from 'YYYYYYYY' (400): Bad Request
Details:
DataSourceKind=Web
DataSourcePath=YYYYYYYY
Url=YYYYYYYYY
Hi @cmcosker
Do the headers you passed have the correct names? Especially "auth_token"? Are you able to use other API tools to test the same API and get a response successfully?
Perhaps you can try
let
api_key = "XXXXXXXX",
startdate = DateTimeZone.From("2023-06-16T13:46:11.043Z"),
days_range = Text.From(7),
LoginURL = "YYYYYYY",
PostBody = [
LocationIds = 0,
Date = startdate,
Range = days_range,
MaxPerDay = 0,
LimitOverLaps = false
],
PostHeader = [#"auth_token" = api_key, #"Content-Type" = "application/json"],
JSONBody = Json.FromValue(PostBody),
out = Json.Document(Web.Contents(LoginURL, [Content = JSONBody, Headers = PostHeader]))
in
out
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 52 | |
| 38 | |
| 37 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 67 | |
| 67 | |
| 34 | |
| 32 | |
| 29 |