fnmunhoz / street-comics

Simple app to navigate through all the comics ever released
0 stars 0 forks source link

Get familiar with the external APIs #3

Open fnmunhoz opened 3 years ago

fnmunhoz commented 3 years ago

Marvel API https://developer.marvel.com/docs

General info: https://developer.marvel.com/documentation/generalinfo

fnmunhoz commented 3 years ago

ETags

Most successful results will contain an “etag” attribute and ETag HTTP header with a digest of the returned content. In order to save bandwidth and make your application more performant, you may optionally pass an “if-none-match” HTTP header with that digest for subsequent requests to the same URL. If the content has not changed since the last request, the response code will return with an empty body and a 304/Not Modified HTTP header and you can use a previously-stored value for the content.

Note: Most browsers will do this automatically, but you may need to manually add this logic to server-side applications.

fnmunhoz commented 3 years ago

GZIP Compression

In order to save bandwidth and make your application more performant, the Marvel Comics API can compress responses with GZIP. You may request a GZIP-ed response by passing an Accept-Encoding header to any endpoint.

fnmunhoz commented 3 years ago

From: https://developer.marvel.com/documentation/attribution

On this page we'll discuss some specific rules of the road that you'll need to follow when accessing and displaying data from the Marvel Comics API on your web site or application. These rules of the road basically boil down to:

Understand your rate limit.
Attribute Marvel as the source when displaying API data.
Link to Marvel when you display large images.
fnmunhoz commented 3 years ago
fnmunhoz commented 3 years ago

Authentication for Server-Side Applications

Server-side applications must pass two parameters in addition to the apikey parameter:

ts - a timestamp (or other long string which can change on a request-by-request basis)
hash - a md5 digest of the ts parameter, your private key and your public key (e.g. md5(ts+privateKey+publicKey) For example, a user with a public key of “1234” and a private key of “abcd” could construct a valid call as follows: http://gateway.marvel.com/v1/comics/?ts=1&apikey=1234&hash=ffd275c5130566a2916217b101f26150 (the hash value is the md5 digest of 1abcd1234)