- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to import data from this site
https://polygon.io/docs/stocks/getting-started
by SAS viya or SAS Window.
I have tried few codes and was not successful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Assuming you're doing something like this: https://blogs.sas.com/content/sasdummy/2018/01/16/hide-rest-api-tokens/
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I signed up for an API key (free) so I could try this. In SAS it's straightforward. Here's my code using their sample call:
filename resp temp;
proc http
url="https://api.polygon.io/v2/aggs/ticker/AAPL/range/1/day/2021-07-22/2021-07-22?adjusted=true&sort=asc&limit=120"
out=resp
oauth_bearer="your-api-key";
run;
libname data json fileref=resp;
proc print data=data.results;
run;
Output:
Instead of the OAUTH_BEARER option (shorthand for the OAuth pattern), you can also use the HEADERS statement:
proc http
url="api-call"
out=resp;
headers
"Authorization" = "Bearer your-auth-key";
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I tried this code and still not working
proc http
url="https://api.polygon.io/v2/aggs/ticker/AAPL/range/1/day/2021-07-22/2021-07-22?adjusted=true&sort=asc&..."
out=resp;
headers
"Authorization" = "Bearer <token>";
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Delete your token from the message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Can you make any PROC HTTP calls to the internet in SAS? Try the steps in this blog post. You might need to specify a proxy host.