GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||
GeezerVison is showing www.contentstack.com — Content Delivery API Docs | Contentstack Base URL
OverviewThis document is a detailed reference to Contentstack’s Content Delivery API. The Content Delivery API is used to retrieve content from your Contentstack account and deliver it to your web or mobile properties. If you are looking for APIs to manage content, you should use the Content Management API. Our APIs serve content via a powerful and robust content delivery network (CDN). Multiple datacenters around the world store a cached copy of your content. When a page request is made, the content is delivered to the user from the nearest server. This greatly accelerates content delivery and reduces latency. Warning: The Content Delivery API (CDA), available at cdn.contentstack.io, should be used to only fetch content from Contentstack. We recommend users to NOT use this endpoint for any other content management activities, because all content management activities using this endpoint will be blocked soon. The CDN includes many points of presence (POPs) located in high-density internet exchange regions around the world. These POPs are continually expanding to ensure faster and more reliable content delivery. Warning We only support version 3 on the CDN. If you're still using version 2 (which we recommend you should not), switch to the CDN version for even faster loading. And, we have a URL size limitation of 8KB on API Requests that hit our CDN services. Any Request URL that goes above this size limit will receive the 414 - URI Too Long error response. Please make sure you limit the size of your API Requests. Content Delivery SDKsContentstack provides SDKs, API references, getting started guides, and sample apps for popular programming languages and platforms. These resources help you build applications and fetch content efficiently using the Content Delivery API. The SDKs are read-only and are designed to retrieve published content from the nearest server via the global CDN. You will find a list of all the available SDKs under the Development Resources and SDKs section. We provide SDKs for the following platforms: The process for building sample apps and working with the SDKs differ based on the platform. We have covered them in detail in their respective sections. AuthenticationSince the Content Delivery APIs (CDAs) are private APIs, you will need to pass the following as HTTP headers to make authorized CDA requests:
The API Key is a unique key assigned to each stack. The Delivery Token is a read-only credential that you can create for different environments of your stack. While Content Delivery API requests may work with Access Token (instead of Delivery Token), we strongly recommend that you not use it, since we have already deprecated Access Token for new stacks. NoteThe nomenclature for the use of delivery tokens in CDA requests will remain the same, i.e. you need to pass the value of the delivery token against the access_token key. Warning
NoteWe have deprecated the usage of Access Tokens for all stacks. We strongly recommend that you use Delivery Tokens for fetching published content via the Content Delivery API and Management Tokens for fetching draft content via the Content Management API. How to Get API Key and Delivery TokenTo retrieve the stack API key and the delivery token of a specific publishing environment of your stack, perform the steps given below after logging into your Contentstack account:
NoteOnly the stack owners, developers, and admin can create delivery tokens. Rate LimitingRate limiting defines the maximum number of API requests your organization can make within a specific time frame. Request Types • CDN Requests: Contentstack’s CDN serves cached responses. These requests are not subject to rate limiting. • Origin Server Requests: Requests that are not cached and are routed to the origin server are subject to rate limits. Default Limits By default, origin server requests are limited to 100 requests per second per organization. All requests made from the CDA and Image Delivery API endpoints count towards this rate limit excluding GraphQL. The exact rate limit depends on your plan. If required, you can request an increase by contacting support. NoteWhile CDN requests are not rate-limited, all API requests (CDN and origin) count toward your organization’s overall API usage quota. Rate Limit Exceeded If your application exceeds the allowed rate limit within a given time period, the API will return an HTTP 429 (Too Many Requests) response. Adaptive Rate Limiting If your traffic arrives in short spikes, for example when a publish clears cached content, your organization can request Adaptive Rate Limiting, which is currently part of an Early Access Program. It absorbs short bursts instead of rejecting them, without changing your rate limit. With Adaptive Rate Limiting enabled, a 429 response also includes a Retry-After header that tells you how many seconds to wait before you retry. To enable it, contact support. Monitoring Rate Limits You can track your current rate limit status using the HTTP response headers returned with each API request. These limits reset at the beginning of each time window.
API conventions
HTTP HeadersHTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon (:), then by its value. Here’s what an HTTP response body looks like: < x-served-by: cache-lax8631-LAX, cache-bur17525-BUR < x-cache: MISS, HIT < x-cache-hits: 0, 1 < x-runtime: 27ms < age: 5182 < x-timer: S1557441707.643683,VS0,VE0 Let’s understand what the above HTTP Header means:
ErrorsIf there is something wrong with the API request, Contentstack returns an error. Contentstack uses conventional, standard HTTP status codes for errors, and returns a JSON body containing details about the error. In general, codes in the 2xx range signify success. The codes in the 4xx range indicate error, mainly due to information provided (for example, a required parameter or field was omitted). Lastly, codes in the 5xx range mean that there is something wrong with Contentstack’s servers; it is very rare though. Let’s look at the error codes and their meanings.
* Contentstack returns the 422 HTTP status code for an error along with the "UID is not valid" message in the response body either when an entry doesn’t exist within the stack, has been deleted from the content type, or exists within a different content type. As the entry has been deleted or unpublished, the Content Delivery Network (CDN) cannot identify the specified entry UID through the cache servers. To check whether the entry has been deleted, try retrieving the entry from CDN first. If the API request fails to retrieve the entry from CDN, then make an API request to the Origin server to check whether the entry exists. Also, if the content type doesn't exist within the stack, Contentstack returns the 422 HTTP status code for an error along with the "UID is not valid" message in the response body. ** Here are a few use cases where you might get a 429 error:
Note For uncached requests, the common rate limit is 100 requests per second per organization. Using Postman CollectionContentstack offers you a Postman Collection that helps you try out our Content Delivery API. You can download this collection, connect to your Contentstack account, and try out the Content Delivery API with ease. Learn more about how to get started with using the Postman Collection for Contenstack Content Delivery API. Using OpenAPI FilesContentstack provides the OpenAPI files of the Contentstack’s Content Delivery APIs (CDA) that you can use to try out Contentstack APIs on any OpenAPI platform such as Swagger. You can download the OpenAPI JSON file of the Content Delivery API and open it on Swagger Editor to start using it. Learn more about how to get started with using the OpenAPI files for Contenstack Content Delivery API. | ||||||||||||||||||||||||||||
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |