I am getting a 400
See the sections below, "verifying request", and "error code details"
Without your url, or the docs, I don't know what endpoint you're using, so here's an example
HTTP GET https://www.example.com/api/user/search?limit=1000®ion=US
Using RelativePath and Query
Note: It's important to use options[RelativePath]
and options[Query]
to prevent service refresh errors on the service. Check out docs: Web.Contents
let
Headers = [
Accept="application/json"
],
BaseUrl = "https://www.example.com",
Options = [
RelativePath = "/api/user/search",
Headers = Headers,
Query = [
limit = 1000,
region = "US"
],
Response = Web.Contents(BaseUrl, Options),
Result = Json.Document(Response) // skip if it's not JSON
in
Result
Authorization
Setting options[ApiKeyName]
lets you specify your API token / password using the credential store instead of in the code itself.
Otherwise you can set it using the Headers
record
just like you are in python.
Error Code details
For details, first specify the HTTP Status codes you want to handle
Options = [
// add this param to Options
ManualStatusHandling = {"400"}
]
Then view error details in the metadata
details = Value.Metadata(Response)
Verifying Request
You can view the actual HTTP requests fired by either using
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…