How to use swagger interface

The interface is intended both to document rest API available and to execute them with the “Try it out” button.

There are 3 sections:

  • Header with the domain to select and the authentication button

  • List of all the available APIs organized in tags

  • Lower part with the description of all the available objects

Header

In this section you have to fill the domain field. Since CTLive is a multi-tenant application, before using API you have to select a valid domain ( the word domain is used as tenant in this context). Domain are case insensitive. In a single-tenant installation, use the word “default”, that is also the default value.

After having chosen the right domain, you have to provide credentials for authenticating on the system.

Clicking on Authorize button you get the following dialog:

Username is case insensitive, password is case sensitive.

Clicking on Authorize, credentials are saved and used for all the api (black locker means credential are used).

When you click on authorize, validation has not done yet. Validation is done only when calling api

APIs

At the moment, available apis are organized according to the following tags:

For each of them, a list of CRUD (create, read, update, delete) APIs are listed, using almost the same schema. Let’s look as example at widget apis:

Each api has the following structure:

At the top:

  • the method to use

  • the relative path of the api, it can include some parameters indicated with {name}

  • A short description of api

Try it out button to enable interface to execute api directly from the UI.

Parameters section that lists all the needed parameters and provide a form to fill them

Request Body: put and post methods have also the request body to be filled

Responses section shows the structure of the response and the value returned when you execute the api

Read apis

All the read apis are performed using GET methd. The system has a cache of 60 seconds, so expect a possibile delay on modification.

Get single object

You need to provide the application id to retrieve configuration of a single object.

 

Get object list

It does not require for a parameter, it returns a list of all the objects present for the specified tag

Create API

Create APIs use PUT method, providing the object to create as request body.

Insert an object

 

The request body section shows the schema of the object to be inserted, indicating the type. You have to fill the parameters the with desiderate value.

Update API

Update apis use method POST. They have in the path the unique id of the object to update, and the request body the attributes to change.

Update object

You need to specify the id of the object to use.

Pay attention to not use _id value, that is an internal identifier. Use only the id value you get for the read APIs

Request body is pre-filled with the schema of the possibile attributes and their data types. You can provide a subset of the attributes, in order to change only needed parameters.

It’s better to provide only the parameter that you’d like to change, keeping all the other existing values unaltered.

Delete api

Api to remove an object from the DB. It uses DELETE method.

Remove object

API for DELETE method. Object ID is requested as path variable.