I'm trying to pull data into my smart contract from an API using the approach described here:
I can get the example code at that link working just fine, but the API I need to connect to requires sending an API Key in the header of the request. I'm trying to figure out the best way to get the data into my contract. The data is publicly available already but the owner of the API requires all users to request a free API Key to use their API.
Here's what I think are my options:
- Make my own oracle that uses my API Key, then have my contract pull from that oracle.
- Scrape the data from the existing API and then make my own API to serve it in a way that doesn't require an API Key.
- Contact the API owner and see if they will consider allowing unauthenticated requests to the endpoint I'm using.
Am I missing something?
Further complicating things, the existing API returns numeric values enclosed in quotes, like this: "2465". In my testing, using the method described in the chainlink docs, I was not able to get the value returned from the API when it is in quotes (I've attempted using bytes32 and unit256). It's possible I messed something up somewhere, so I'd like to know if it is possible to have a number that is in quotes returned using the approach described in the chainlink docs.