The essentials

Responses

Each response is wrapped in a data tag. This means if you
have a response, it will always be within the data field. We
also include a status code and success flag in the response.
For more information and examples go to the data models page.

Responses are either JSON (the default), JSONP, or XML. Response
formats are specified by supplying an extension to the API
call. For example, if you want to access the gallery
information with JSON:

https://api.imgur.com/3/gallery.json

JSONP responses are made by adding the
callback parameter via either GET
or POST to the request. For example:

https://api.imgur.com/3/gallery.json?callback=function_name

and to specify an XML response, the URL is:

Rate Limits

The Imgur API uses a credit allocation system to ensure fair
distribution of capacity. Each application can allow
approximately 1,250 uploads per day or approximately
12,500 requests per day. If the daily limit is hit
five times in a month, then the app will be blocked for the
rest of the
month. The remaining credit limit will be shown
with each requests response in the
X-RateLimit-ClientRemaining HTTP header.

We also limit each user (via their IP Address) for each
application, this is to ensure that no single user is able
to spam an application. This limit will simply stop the user
from requesting more data for an hour. We recommend that
each application takes precautions against spamming by
implementing rate limiting on their own applications. Each
response will also include the remaining credits for each
user in the X-RateLimit-UserLimit
HTTP header.

Each request contains rate limit information in the HTTP
response headers.

HTTP Header Description
X-RateLimit-UserLimit Total credits that can be allocated.
X-RateLimit-UserRemaining Total credits available.
X-RateLimit-UserReset Timestamp (unix epoch) for when the credits will be reset.
X-RateLimit-ClientLimit Total credits that can be allocated for the application in a day.
X-RateLimit-ClientRemaining Total credits remaining for the application in a day.

Unless otherwise noted, an API call deducts 1 credit from
your allocation. However, uploads have a significantly
higher computational cost on our back-end, and deduct 10
credits per call. All OAuth calls, such as refreshing tokens
or authorizing users, do not deduct any credits.

You can also check the current rate limit status on your
application by sending a GET request to
https://api.imgur.com/3/credits

Your use of the Imgur API is also limited by the number of POST
requests your IP can make across all endpoints. This limit
is 1,250 POST requests per hour.
is not impacted by this limit.
Each POST request will contain the following headers.

HTTP Header Description
X-Post-Rate-Limit-Limit Total POST credits that are allocated.
X-Post-Rate-Limit-Remaining Total POST credits available.
X-Post-Rate-Limit-Reset Time in seconds until your POST ratelimit is reset

Authentication

The API requires each client to use OAuth 2 authentication.
This means you’ll have to register your application,
and generate an access_code if you’d like to log in as a user.

For public read-only and anonymous resources, such as
getting image info, looking up user comments, etc. all you
need to do is send an authorization header with your
client_id in your requests. This also works if you’d like to
upload images anonymously (without the image being tied to
an account), or if you’d like to create an anonymous album.
This lets us know which application is accessing the API.

Authorization: Client-ID YOUR_CLIENT_ID

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Adblock
detector