Forum Discussion
help with POST api call
- Anonymous2 years ago
Hi David ,
In your Postman request, you’re using "login" and "security_Key" as keys, but in your Power Query code, you’re using "login_id" and "security_key" .
so please verify that all required parameters are correctly provided and that there are no typos or case sensitivity issues with the parameter names.
In Power Query, when you're constructing the body of a POST request, it's crucial to ensure that the body is a binary type because the function expects the option to be binary. So please check this:
body = Text.ToBinary(Json.FromValue([login_id = client_id, security_key = client_secret])),Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly--How to provide sample data in the Power BI Forum--China Power BI User Group
Hi Gao -
Thank you for the feedback. Postman and the API do not appear to be case-sensitive as I get the same result with "security_key" and "security_Key".
As for the "body" variable, I changed it to this as suggested
body = Text.ToBinary(Json.FromValue([login_id = client_id, security_key = client_secret])),
but now I get "We cannot convert a value of type Binary to type Text" error message. What am I missing? The variables are defined as so
client_id = #"client_id", //<===parameter
client_secret = #"client_secret", //<===parameter
token_uri = #"token_url", //<===parameter
register_url = #"register_url", //<===parameter
and the parameters are all type Text.
ETA: The value for client_secret contains all alphanumeric characters except for a single dash ( - ). Could that special character be the cause of the error?
Thanks,
David