Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi everyone,
(formatted )
I'm trying to retrieve data from an API using POST request method but I've hit a snag. It returns code: 500 instead of code:200. My M query is as shown below. Also, the API details as indicated from Inspect in browser Dev Tools as shown below.
M query:
let
url = "https://bi.shihengtech.com/api/operation/rateAnalysis/queryShopRating",
body = [brandI= "10273", startDate= "2021-12-10", endDate= "2021-12-10"],
Parsed_JSON = Json.FromValue(body),
Source = Json.Document(Web.Contents(url,
[Headers=[#"User-Token"="eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ7XCJ1c2VySWRcIjo1MTk2fSIsImV4cCI6MTYzOTU1Mzk0Nn0.TQdpGdGXg9xssJbqKMt3yfd2C8QKECeNOlGmjj4TG5c9zXJUkX0CK7JQbptPYIOOXpTRG4Y1bAXPsWTXnpG40Q",
#"Trace-Id" = "1571194039.2940.16392499334455917",
#"Content-Type"="application/json",
#"Accept"="application/json",
#"Origin"="https://bi.shihengtech.com",
#"Connection"="keep-alive"],
Content = Parsed_JSON ] ))
in
Source
Request Headers:
Request Headers
Accept: application/json
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Connection: keep-alive
Content-Length: 138
Content-Type: application/json;charset=UTF-8
Cookie: _ga=GA1.2.301463337.1638949123; user-token=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ7XCJ1c2VySWRcIjo1MTk2fSIsImV4cCI6MTYzOTU1Mzk0Nn0.TQdpGdGXg9xssJbqKMt3yfd2C8QKECeNOlGmjj4TG5c9zXJUkX0CK7JQbptPYIOOXpTRG4Y1bAXPsWTXnpG40Q; _gid=GA1.2.1024290566.1639132696; acw_tc=76b20f7016393038197496037e1a54c24169fc93237f330af64638ebf49534; _gat_gtag_UA_127759150_3=1
Host: bi.shihengtech.com
Origin: https://bi.shihengtech.com
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Microsoft Edge";v="96"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43
user-token: eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ7XCJ1c2VySWRcIjo1MTk2fSIsImV4cCI6MTYzOTU1Mzk0Nn0.TQdpGdGXg9xssJbqKMt3yfd2C8QKECeNOlGmjj4TG5c9zXJUkX0CK7JQbptPYIOOXpTRG4Y1bAXPsWTXnpG40Q
Request Payload:
{brandId: 10273, platforms: [0, 1], provinces: null, cities: null, shopIds: null,…}
brandId: 10273
cities: null
endDate: "2021-12-11"
platforms: [0, 1]
provinces: null
shopIds: null
startDate: "2021-12-11"
type: 1
Hi @MKE ,
Please refer to this post.
You can try it on postman and check whether the access token is correct.
Also check whether the post returns the correct results.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Thanks for the response. Just before that, a quick look at my M-code, everything is set up okay? I thought maybe I was bringing in the form data incorrectly.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |