API: Result headers

From Yombo
Jump to: navigation, search

Summary

HTTP headers always returned as part of the API response and are generally not displayed to users. However, there are various headers that be useful when troubleshooting an application or when you want to monitor the API performance.

Performance

The header 'X-Process-Time' provides details about how long the request took to process. This is helpful for eliminating network transit time.

The counter starts the server has received the request and stops just before sending the response. This includes all authorization steps, database actions, and output formatting.

Cached Responses

Some responses are cached and those maybe returned. The header 'X-Response-Cached' with a value of 'true' if a cached response has been set. Headers are generally not included in the cache, so the performance metric is still valid. If this header is missing from the response, then the result is not cached.

Rate Limiting

The API rate limits requests to protect itself from abuse. There 3 headers that are set to help determine how many requests you have left for the current time period.

  • X-RateLimit-Limit - How many requests to the resource can be made before being rate limited.
  • X-RateLimit-Remaining - How many requests are remaining for the current time bucket.
  • Retry-After - This only appears once the rate limit has been reached. You must wait this many seconds before making another request.

Request ID

Every request is assigned a unique ID and can use found in the header 'X-Request-Id'. This information is helpful when opening a trouble ticket with support.

This page was last edited on 12 April 2019.