I've been trying to make a simple get request to yelp-fusion for a while and nothing I do seems to work. I have a key and have been trying to set the authorization request header with different configurations (e.g. dictionaries, lists of lists, joining strings, putting them all in one etc.) I've seen a few other forums on here talking about similar issues but none of their solutions worked for me.
When I set it with a dictionary and use the Do-It option I get an error, error from companion: undefined variable (irritants: yail-yail/ dictionary)
The app seems to get stuck here as nothing after the set request headers block executes
I've tried adding another request header, but I get the same error. I've also tried putting 'bearer' and 'authorization key' as two elements of another list but that doesn't work. I've made sure to try it with a space between 'bearer' and 'key' and without. App inventor doesn't seem to like any of it.
With the list of lists, the get request goes through but in the gotText event handler I get the response content:
{"error": {"code": "VALIDATION_ERROR", "description": "Authorization is a required parameter.", "field": "Authorization", "instance": null}}
Side note I do replace 'authorization key' with my API Key
I've also asked a friend to help, but he wasn't able to figure out what was wrong. He tried the same request in curl and it worked just fine for him (using my key), but I'm having no such luck in app inventor.
I still get the app inventor error 1111, the response code 400 and the same response content,
{"error": {"code": "VALIDATION_ERROR", "description": "Authorization is a required parameter.", "field": "Authorization", "instance": null}}
On yelp's website it doesn't say anything about specific languages, only to do authorization through the authorization request header and how to set up the URL. This is the page I've been using
Yep.. ok so I fixed it and still nothing. When I was originally trying all this out I had it in a different project but it became such a mess that I hastily threw together a new one for this post hence the mistakes in the link sorry about that.
Ok so my API key should definitely be correct. There are underscores in it I don't know if that makes a difference. All the examples lead to the same errors. I don't actually know how to use Curl it was someone else I know that I asked and they used my key. I am currently setting up a postman account to try that out as well.
Also in the gotText event handler I just have this:
The only other thing I could suggest is that you uriEncode your web1.url (use the block provided in the web component palette). No need to uriEncode the headers.