I'm quite new to using APIs and am trying to use the yelp API in processing to get images. I need some help using an API key in this library. Their website says to "put the API Key in the request header as "Authorization: Bearer " Here's my attempt...
import http.requests.*;
GetRequest get = new GetRequest("https://api.yelp.com/v3/businesses/gary-danko-san-francisco");//Just a random example I found online. I know it's not an image.
get.addHeader("Authorization", "Bearer: <MY API KEY>");
//^ This is my attempt at using the API key
get.send();
println("Response Content: " + get.getContent());
println("Response Content-Length Header: " + get.getHeader("Content-Length"));
This gets printed in the console window
Response Content: {"error": {"code": "INVALID_AUTHORIZATION_METHOD", "description": "Invalid authorization method supplied."}}
Response Content-Length Header: 108
This is just a minimal reworking of the example code given in the HTTP requests library. As I said I'm very new to this and any pointers you could give would be much appreciated. Thanks in advance.