I am trying to get historical USD prices for BTC from the Coinbase API. The relevant section of the documentation is here. I've never interacted directly with an API before, so at the moment I'm just trying to figure out how to format the request.
To get the current price, this works:
https://api.coinbase.com/v2/prices/BTC-USD/spot
However, if I want to get historical prices I need to specify a date as indicated in the docs, but I can't seem to get the format right. I'm sure this is a standard format of which I am just unaware, so hopefully someone can point me in the right direction.
I've tried:
https://api.coinbase.com/v2/prices/BTC-USD/2018-01-01
https://api.coinbase.com/v2/prices/BTC-USD/date/2018-01-01
https://api.coinbase.com/v2/prices/BTC-USD/resource?date=2018-01-01
https://api.coinbase.com/v2/prices/BTC-USD/resource/date=2018-01-01
(something along the lines suggested here)
What is the correct formatting for the API request?
You should format the request as
https://api.coinbase.com/v2/prices/BTC-USD/spot?date=2018-05-21
And you should include a CB-VERSION
CB-VERSION: 2017-08-07
if you want to avoid an API warning
Related
I'm currently attempting to use the CoinMarketCap API but finding it frustrating.
I'm wanting to use this URL to query their API:
https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest
However, rather than finding all, or just simply filtering based upon the number, I want to find a certain few coins.
So for example, I want to only find Bitcoin, Ethereum and Cardano.
Looking at their docs, it suggests you can sort by name, but it appears this is only listing them alphabetically, which I don't want to do.
So can anyone suggest how to query their API successfully and find just Bitcoin, Ethereum and Cardano using that GET URL above?
Here's the URL to the specific URL for the API request: https://coinmarketcap.com/api/documentation/v1/#operation/getV1CryptocurrencyListingsLatest
For this purpose, you can use the endpoint Quotes Latest:
https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest
It allows you to pass a list of identifiers in a string as a parameter, like this:
1,1027,328
or a list of slugs:
bitcoin,ethereum,monero
or a list of symbols
BTC,ETH,XMR
If you trying to scrape information about new listings at crypto exchanges, you can be interested in this API:
https://rapidapi.com/Diver44/api/new-cryptocurrencies-listings/
It includes an endpoint with New Listings, New Pairs from the biggest exchanges and a very useful endpoint with information about exchanges where you can buy specific coins and prices for this coin at that exchange. It's a bit paid, but it's worth it!
I'm trying to consume JIRA 2 API and trying to get custom fields. I want to further filter by passing appropriate criteria in URI itself. Current query I'm using is something similar to this:
http://localhost:8522/jira522/rest/api/2/issue/createmeta?expand=projects.issuetypes.fields
The result I'm getting from above request is about 2000 lines.. How can I further filter to get only Custom_fields and also under custom fields I need to only the ones which are required?
I'm pretty new to REST API. Please guide me If anything is wrong... TIA. I spent a lot of time browsing but don't know what exactly I need to search for or where exactly I need to get started.
You can use another queryParam just like expand and add further filtering or pagination.
http://localhost:8522/jira522/rest/api/2/issue/createmeta?expand=projects.issuetypes.fields&limit=1000
I'm trying to obtain impressions of my ads between two dates
I'm using Graph API Explorer with this path:
act_0123456789/ads?fields=insights{ad_id,ad_name,impressions}
I want to use 'time_range' attribute that we can find it in Marketing API reference but I don't know the syntax. Anyone can help me?
I can't comment on the approach you're using as I have not used it myself. However, here is an alternative approach which I have used with success:
https://graph.facebook.com/v2.5/act_xyz/insights?level=<yourLevel>&fields=ad_id,ad_name,impressions&time_range[since]=2016-02-15&time_range[until]=2016-02-16&limit=25
where <yourLevel> can be one of: ad, adset, campaign
Also note that I am using straight up http requests in java which is why I show you the request itself. Hopefully you can extrapolate to your own solution.
Using the same endpoint you've shown in your question
act_0123456789/ads?fields=insights{ad_id,ad_name,impressions}
The way to specify a time range would be
act_0123456789/ads?fields=insights.time_range({"since":"2017-08-07","until":"2017-08-14"}){ad_id,ad_name,impressions}
(of course, those two dates are provided just as an example)
Easiest way of doing this is
act_0123456789?fields=ads{insights.time_range({"since":"2019-03-03","until":"2019-03-03"}).time_increment(1){impressions}}
Remove .time_increment(1) if you don't want day by day data
you can use {} for subfields like
act_0123456789?fields=campaigns{ads{name,insights,adcreatives{image_url}}}
you can use . and () for parameters like; always make sure you use you use fields only after parameters like this order .(){}
act_0123456789?fields=campaigns.limit(1).time_range({"since":"2019-03-03","until":"2019-03-03"}).time_increment(1).breakdowns(country){ads{name,insights.time_range({"since":"2019-03-03","until":"2019-03-03"}).time_increment(1).breakdowns(country),adcreatives{image_url}}}
is there any way to explore the Facebook Graph API by date range? Ex. to find all events on February?
I use following code, but I’m not sure, that’s correct request:
since=2015-01-28T00:00:00%2B0000&until=2015-01-30T00:00:00%2B00000
In this way, I get records for defined date range - ok, but there is missing events – a set is incomplete (despite it doesn’t exceed a limit of API). Why I can’t get all of results for given query?
Maybe do you know another method of filtering results by date?
thanks
There's no way to restrict the search results by since and until as far as I know.
For searching events, you can use the /search endpoint as described at
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#search
but I guess there's no further way to filter the results other than specifying the q parameter.
Explanation:
I am able to query the Google Core reporting APIv3 using the client library to get data on pageviews for specific URLs of a website I am working on. I want to get data(pageviews) for each day within a specified range. So far I am simply looping through the range, sending individual request to the API. in each request I am setting the same value for the start date and the end date.
Problem:
Obviously this gets the job done, BUT it is certainly not the best way to go about it. Because, assumming I want to get data for the past 3 months for each of about 2000 URIs. Then I will need 360000 number of requests and that value is well over the limit quota defined by Google.
Potential solution: So one way I thought of solving this issue is probably to send a request setting start-date and end-date to be a week apart but the API will return a sum of the values rather than the individual values.
main question: So is there a way to insist that these values should not be added up and returned as a sum but rather returned (as associative array or something like that) separately for each.
I hope the question is clear and that there is a solution! Thank you!
Very straightforward:
Metric: ga:pageview, Dimension: ga:date, Set a filter for your pagepath, and set a start-date and end-date.
Example:
https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3Axxyyzz&dimensions=ga%3Adate&metrics=ga%3Apageviews&filters=ga%3Apagepath%3D%3D%2Ffaq.html&start-date=2013-06-27&end-date=2013-07-11&max-results=50
This will return the pageviews for that the faq.html& page for each day in the time-frame.
You should check out the QueryExplorer. Great tool to find out how to structure queries.