Exploring the Content Fetch API using Swagger

Follow

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 off the API URL for your API.

There are two ways to access your Swagger endpoint.

  1. When logged into Agility CMS, go to the Getting Started page and click the View Documentation button:

    mceclip0.png

  2. If you already know your Guid, then you can go the following URL in the browser (replacing the Guid with yours):

    mceclip2.png

Here, you can explore the Swagger endpoint.

mceclip6.png

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.

  1. In Swagger, click the Authorize button:
    mceclip0.png
  2. Next, enter your API Key in the Value field:

    mceclip1.png

  3. Then, click Close:

    mceclip2.png

Making a Request

Now that you've set your API Key, you are ready to make a request.

  1. Click on the request you want to execute:

    mceclip3.png

    This will expand the details of the request so we can see the input parameters and sample responses.

    mceclip4.png

  2. Next, click the Try it out button:

    mceclip5.png

    This will display input fields for each of the request parameters:

    mceclip7.png

    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-usfr-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".

  3. Once you've entered your parameter values, click the Execute button to execute the request:

    mceclip13.png

    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.

    mceclip12.png

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?

  1. Click to select and expand the API request you wish to inspect

  2. Under Responses for the request, click the Model link to view the definition of the API return type:

    mceclip14.png

 

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.