Limite de taxa
Limite de taxa: um limitador real de janela fixa (5 requisições a cada 60 segundos por cliente) para testar o tratamento de 429 e Retry-After. Os clientes são identificados pelo cabeçalho X-Client-Id ou, sem ele, pelo IP.
- GET
https://api.testingapis.com/api/RateLimitMake a rate-limited request that counts toward the limit. - POST
https://api.testingapis.com/api/RateLimit/resetReset the caller's window. - GET
https://api.testingapis.com/api/RateLimit/statusShow the caller's current window without counting a request.
Requisição de exemplo
Make a rate-limited request that counts toward the limit. Referência completa e botão Send (em inglês).
cURL
curl -X GET "https://api.testingapis.com/api/RateLimit" \
-H "X-Client-Id: docs-demo"Resposta · 200 OK
{
"message": "Request allowed.",
"clientId": "id:docs-demo",
"used": 1,
"remaining": 4,
"limit": 5,
"windowSeconds": 60
}