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
https://ade6cf3c-api.agilitycms.cloud/swagger/
Public API Key (fetch)
defaultlive.201ffdd0841cacad5bb647e76547e918b0c9ecdb8b5ddb3cf92e9a79b03623cb
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 on the API URL for your API.
When logged into Agility CMS, go to Settings > API Keys and click on Try the API. From there, click on API Documentation to access your Swagger Endpoint and view the Documentation.
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.
Authorizing Swagger
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 3 common input parameters that are required for ALL types of requests - guid, lang and apitype. The guid represents your Instance's unique identifier. 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:
Comments
Please sign in to leave a comment.