4. How to use Swagger?
  • 02 Feb 2022
  • 2 Minutes to read
  • Contributors
  • Dark
    Light

4. How to use Swagger?

  • Dark
    Light

Swagger is an Interface Description Language for describing RESTful APIs expressed using JSON. 

Swagger documentation site

To authenticate the documentation:

  1. Click on Authorize

  1. Enter the API token in the Value field under api_token (apiKey)

Generating API tokens

To generate the API tokens:

  • Go to SettingsAPI tokens
  • You can select the existing token or, you can generate a new token as per the requirements
  • To generate a new API token:
    a. Type in a name for the API token in the Enter token name
    b. Select the required HTTP method(s). You have four methods under Allowed method(s): GET, POST, PUT, and DELETE
    → You can only use the generated token for the selected method(s). It cannot be used to perform other methods
    c. Click on the Copy icon to copy the API token

  1. Click on the Authorize button
  2. Click on Close. The authentication is successful
  3. If you want to change to a different token, click AuthenticateLogout. Enter your API tokenAuthorizeClose

If you refresh the page, the session might end and, you would have to authenticate again. You can follow the above steps for authentication.

You can access the documentation by clicking on the required requests.

For detailed information on the GET, POST, PUT, and DELETE, refer to the Requests article.



You must use underscore wherever required.
For example, use underscore for "email_id" instead of "email id". If you use space, you would get an error.

Required fields

It is mandatory to enter the content in the field denoted with *required.

GET

In general, you can retrieve the information using GET.
Below is an example for GET action: To retrieve the information about the team account.

  • You can enter the email in the marked field to find the team account information
  • Click on the Execute button

  • The information about the team account would be available under the Response body.

POST

In general, you can add something using POST.
Below is an example for POST action: To add a team account to a project.

  • You should add the team account information such as email id, user role, and user id to add a user to the project
Required fields

For the mandatory parameters to be added, refer to https://apidocs.document360.com/docs/add-a-user

  • The team account would be added to the project
  • Click on the Execute button
  • If the status is 200 and success is true, the addition of the team account is successful

PUT

In general, you can update something using PUT.
Below is an example for PUT action: To update a user role in the project.

a. You should enter the user id in the marked field
b. Update the user role with the number mentioned for user role syntax. The number for the respective roles are as follow:

  • 1 → Administrator
  • 2 → Editor
  • 3 → Draft Writer
  • 4 → Reader
  • 7 → Owner

c. Click on the Execute button
d. If the status is 200 and success is true, the update of the user is successful


DELETE

In general, you can delete something using DELETE.
Below is an example for the DELETE action: To delete a user id.

  • Enter the user ID in the marked field
  • Click on the Execute button
  • If the status is 200 and success is true, the deletion of the user id is successful

Was this article helpful?

What's Next