Forum Discussion
Web.Contents Query Parameters - prevent from encoding
This works fine:
Json.Document(Web.Contents("https://api.linkedin.com/rest/",
[
RelativePath = "adAccounts/11111111/adCampaigns?q=search&search=(status:(values:List(ACTIVE)))",
Headers=[
**some headers**
]
]))
But this doesn't:
Json.Document(Web.Contents("https://api.linkedin.com/rest/",
[
RelativePath = "adAccounts/11111111/adCampaigns",
Query = [
q="search",
search="(status:(values:List(ACTIVE)))"
],
Headers=[
**some headers**
]
]))
I get the following error:
DataSource.Error: Web.Contents failed to get contents from 'https://api.linkedin.com/rest/adAccounts/11111111/adCampaigns?q=search&search=%28status%3A%28values%3AList%28ACTIVE%29%29%29' (400): Bad Request
It is clear that the problem is that this gets encoded automatically when it is in the "Query=[]" section:
search=%28status%3A%28values%3AList%28ACTIVE%29%29%29
then it doesn't work. I tried to pass the encodied part as Base url and it gives the same error. So the endpoint can only accept unencoded text.
I somehow need it NOT to be encoded when included in Query=[], so it stays the same:
(status:(values:List(ACTIVE)))
Please help
- lbendlin2 years ago
Super User
So the endpoint can only accept unencoded text.Bit of an oversight on the endpoint's side, eh?
As long as you can hide the dynamic part of the URL in the RelativePath attribute you should be able to refresh this data source in the service. Not pretty, but if it works ¯\_ (ツ)_/¯