We do our best to provide client SDKs for accessing the Content Fetch API, but we know we'll never be able to keep up with a developer's appetite.
We know how critical it is to have a well-documented API and to foster collaboration and community SDKs. To support with this, we have provided a Swagger doc for you to explore the API and execute API calls from within the browser.
Don't have an Agility CMS Instance and API Key?
We encourage you to sign-up for a Free (forever) instance so you can actually query your own CMS instance, but you can also explore the Swagger doc and execute requests using our public test endpoint.
Public Swagger Doc
Public API Key (fetch)
How to Access your Swagger Doc
In order to execute API requests for your own Agility CMS instance, you'll need to access your swagger endpoint. This is based off the API URL for your API.
There are two ways to access your Swagger endpoint.
When logged into Agility CMS, go to the Getting Started page and click the View Documentation button:
If you already know your Guid, then you can go the following URL in the browser (replacing the Guid with yours):
Here, you can explore the Swagger endpoint.
How to Execute a Request
In order to execute a request from within Swagger, you'll need to know your API Key and authorize Swagger to make requests on your behalf. You can use either your preview API Key to get the latest content or your fetch API Key to only get published content.
Don't know your API Key? See Retrieving your API Key(s), Guid, and API URL.
Once you have your API Key ready, you'll need to authorize Swagger by setting the API Key value.
- In Swagger, click the Authorize button:
Next, enter your API Key in the Value field:
Then, click Close:
Making a Request
Now that you've set your API Key, you are ready to make a request.
Click on the request you want to execute:
This will expand the details of the request so we can see the input parameters and sample responses.
Next, click the Try it out button:
This will display input fields for each of the request parameters:
There are 2 common input parameters that are required for ALL types of requests - lang and apitype. The lang parameter represents the Language Code of your content (i.e. en-us, fr-ca, etc). The apitype parameter informs the API that you intend to retrieve preview content or fetch (live content only) - valid values are "preview" and "fetch".
Once you've entered your parameter values, click the Execute button to execute the request:
This will execute the request, display a sample Curl snippet for the same request, show the Request URL, as well as the Response Body and Response Headers of the request.
Exploring API Models
Every API request returns a type of result. Each type is detailed under the Models area in Swagger, below the list of requests as well as within each request's response.
How to Determine What Type/Model an API Request will Return?
Click to select and expand the API request you wish to inspect
Under Responses for the request, click the Model link to view the definition of the API return type: