I'm trying to get cryptocurrencies logos from https://coinmarketcap.com
According to documentation I can get them from this endpoint /v1/cryptocurrency/info
It's also required that API Key should be supplied via a custom header named X-CMC_PRO_API_KEY.
I tried to make an API call in Postman, but it's returning bad request.
My key: X-CMC_PRO_API_KEY
My API Key value: c972ac08-519e-47e5-8cd8-23e6230289f3
I can fetch cryptocurrencies lists, but not metadata.
You also need to provide the cryptocurrency symbols for which you want the details symbol=BTC,ETH as part of the query. Refer screenshot below.
The logo key is present inside the respective cryptocurrency response.
"logo": "https://s2.coinmarketcap.com/static/img/coins/64x64/1.png"
Related
I'm trying to use the Twitter API in Google Script to get the non-public metrics of my posts.
I believe have done all of the authentication properly since I am able to get the information when using Postman. I have generate a consumer_key, a consumer_secret, an access_token, and a token_secret.
According to the twitter documentation , I MUST use Oauth1.0 (https://developer.twitter.com/en/docs/twitter-api/metrics).
In order use the Oauth1, I used Google's own script for Twitter Oauth1 (https://developers.google.com/google-ads/scripts/docs/examples/twitter-oauth10).
I was able to take that code (along with the library it required) and successfully retrieve the tweets for my username.
My attempt to get the non_public metric was replacing the "https://api.twitter.com/1.1/statuses/user_timeline.json" with the GET request I had from POSTMAN but it returned a "401 error".
I have a hunch that I can't just replace that url with my own but I am unsure how to approach it.
In summary:
Tokens/Twitter Authorization/GET request are written properly since they work in Postman
Google Script is writing properly since the default URL works
Unsure how to replace the default url to accomplish different tasks
Ended up figuring it it out!
I was not supposed to pass the entire url as a replacement for "https://api.twitter.com/1.1/statuses/user_timeline.json".
It is supposed to be replaced by the "base" url. In my case this was "https://api.twitter.com/2/tweets".
I then had to change the variable "params" that feed into it.
note that the params is from the code provided by Google in my original post
They have to be in the following format (https://developer.twitter.com/en/docs/tutorials/twitter-api-google-sheets):
params = {
"tweet.fields": "author_id,created_at,lang",
"ids": "21,1293593516040269825,1334542969530183683",
}
I was able to add my own fields such as "non_public_metrics,organic_metrics" to get:
params = {
"tweet.fields": "author_id,created_at,lang,non_public_metrics,organic_metrics",
"ids": "21,1293593516040269825,1334542969530183683",
}
I hope this helps someone someday :)
when I run the following HTTP request:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=[API KEY]&location=${lat},${lng}&radius=400
..i get a response which is an array of objects (places)...each object has a key called photos (which is also an array of objects). I dont see a "getURL" method, so how do I get the image URL for the place?
Thanks
The Places API web service returns array of photos in the response. Each element in this array has a photo_reference field. So you can use the photo reference to get a photo using the following URL:
https://maps.googleapis.com/maps/api/place/photo?photoreference=YOUR_PHOTO_REFERENCE&maxwidth=600&key=YOUR_API_KEY
For further details have a look at the documentation:
https://developers.google.com/places/web-service/photos
I hope this helps!
I am working on an application that get response from steam API. I am halfway through my task. Now I need some help on getting response of dota2 hero or item details that completely contains ìd name and image_url.
I want to know are there any steam API call to receive the response that I required?
Thanks in advance
You can use the following steam API call to get name, id and localized_name replace {ur_key} with the web API key that steam provided you.
https://api.steampowered.com/IEconDOTA2_570/GetHeroes/v0001/?key={ur_key}&language=en_us&format=JSON
But you need image URL too, you can use this json data of heroes and this data of items
I hope this would be helpful for you.
Does JSON messages sent over HTTP in response to a URL request make it REST-compliant?
I believe it is not.
But I am not sure on the detailed reason.
If i have a well-organized website,which responds to URL requests with json representation payload - what does it need to do further to comply with RESTful or JAX-RS?
A simple concise explanation will be much appreciated
There is no restriction regarding the payload of messages in REST and using JSON format in HTTP responses isn't enough to make a service RESTful.
To make short (since it's what you asked for ;-)), what is really important in REST is to respect the HTTP operations (GET, POST, ...) are designed for, the concept of resources and their states (idempotence, ...), leverages headers and status codes, ...
The following link could give you hints about the way to implement a RESTful service / Web API:
Designing a Web API - https://templth.wordpress.com/2014/12/15/designing-a-web-api/
Hope it helps you,
Thierry
JSON is a payload and does not play any role in making your Webservice REST-complaint.
Payload could be XML, CSV, plain text etc etc.
The Webservice will be REST-Complaint when it's following REST protocol (set of rules, not network protocol).
There are up to 4 levels where you can make your REST webservice complaint to.
One of the very basic rules to understand is that - Your Request must not be RPC i.e. you MUST not perform any action using a Payload (Typical SOAP) or URL tunnelling e.g. http://www.example.com/product?id=1234&action=delete
In RESTful world you would define one top level URI for the above. e.g. http://www.example.com/product
and then you will call various URLs to perform other actions.
Such as:
POST - create Data
http://www.example.com/product
Body{ here your payload will describe the Product.}
Assuming you rely on server gennerated product id then return type could be Product Id. Which is again should be set as LOCATION parameter of the return header.
PUT - Update Data
http://www.example.com/product/1234
Body{ here your payload will contain the Product details to change.}
GET - Get Data
http://www.example.com/product/1234
DELETE - Delete Data
http://www.example.com/product/1234
I ran into a REST API at work (developed by another team) and noticed a couple of the DELETE api required Json object (list of ids to be deleted). Is this one of the standard REST DELETE? The DELETE I am used to does not require input Json. Thanks in advance to your replies.
According to the HTTP Semantics document:
A payload within a DELETE request message has no defined semantics;
sending a payload body on a DELETE request might cause some existing
implementations to reject the request.
Therefore, the existence or usage of a payload in a RESTful DELETE is implementation-specific.
However, RESTful deletes using the DELETE verb usually use the resource id in the URL:
DELETE /resource/{id}
In your description, it sounds like the list of ids to be deleted is passed in the payload. In this case, I think it would be more appropriate to use POST:
POST /resource?action=deletelist