On Mon, Apr 24, 2017 at 06:05:11 -0700, babelproofreader wrote:
> I would like to access a web api that requires an authentication/bearer token
> in an authorization header. The website gives a curl example of
> curl -H "Authorization: Bearer 12345678900987654321-abc34135acde13f13530"
> https://api-fxtrade.oanda.com/v1/accounts >
> How would I use this as input arguments to the urlread function?
The urlread function does not support custom HTTP headers.
The way to do this in Matlab would be with the matlab.net.http package,
which Octave does not support yet.
To do this in Octave now, the best options would be to use the Java or
Python (in development) interfaces, like this
h = javaObject ("java.net.URL", "https://api-fxtrade...");
c = h.openConnection ();
c = py.httplib.HTTPSConnection ("api-fxtrade.oanda.com");
h = py.dict (pyargs ("Authorization", "..."));
c.request ("GET", "/v1/accounts", "", h);
r = c.getresponse ();