Menu

How to use Interactive API Documentation

qTest offers an interactive Swagger API documentation that enables you to make API calls from the Swagger UI. qTest users can use this interactive documentation to:

  • Explore and learn about supported APIs
  • Copy examples of API requests to use similar syntax in their code
  • Export sample code in multiple languages: Java, C#, Python, and Ruby 

Authenticate to Sample Account

Follow the steps below to use the interactive Swagger API Documentation:

  1. Click the link to api.qasymphony.com 
  2. Copy the Access Token, which is a long alphanumeric code displayed under the Username/Password line.

    Swagger.png

  3. Click on the Authorize button.
  4. In the Available Authorizations dialog, paste the following syntax: bearer <Access Token>

    For example: bearer 14f8f12d-f85e-497b-91d9-687184e33b12 

  5. Click Authorize

    Paste_Token.png

  6. Once the authorization is successful, the dialog will show "Authorized." Click on the "X" to close out the window so that you can now begin using the interactive "Try it Out" feature.

    Success.png

NOTE: In some cases, the API token may have been revoked, you can try the Log in API first to retrieve the new token and then restart at step #3

 

Experiment with the API

  1. Collapse or expand an entity resource to show/hide its operations (DELETE, GET, POST, PUT).
  2. Select an entity and an operation, and enter parameter values. The interactive Swagger API interface guides you by verifying your requests, for example, if you are missing a required field.
  3. Click Execute to perform the operation using the inputs you have provided. Copy the examples or syntax into your code.

Example:

In order to try out the Creates a Requirement API, you will need to follow these steps:

  1. Look for the project ID from the top of the document. Alternatively, you can try the Gets multiple Projects API and then look for the ID of qConnect - Sample Project from the response

    Project_ID.png
  2. Click on the arrow to the right of the Modules link to expand the Modules API section
  3. Click on the blue button GET to expand the API for Gets multiple Modules
  4. Input the projectId using the ID you found at step #1
  5. Click the Execute button to perform the call using the input provided
  6. From the response body, select one ID of any Modules. You will use create a Requirement under this Module

    Module_ID.png

  7. Click on the arrow to the right of the Requirements link to expand the Requirements API section
  8. Click on the green button POST to expand the API for Create a Requirement
  9. Click on the button Try it Out
  10. Input the projectID as you found at step #1. On the request body, remove the properties array, input a name for the Requirement and the parent_id using the Module ID you found at step #6
  11. Click the Execute button to perform the call using the inputs provided
  12. Check out the results in the response body
  13. Copy the examples in the request body to use similar syntax into your code

Export Sample Libraries

Currently, sample code can be generated into Java, C#, Python, and Ruby.

  1. Click on the desired language from the top of the toolbar, such as Java.
  2. A .tgz file will be downloaded, which will contain. Extract the downloaded file, you will find the following sub folders and files, eg:
    1. README.md: this should be your starting point. It will instruct you to install the API client library and also provide an example for you to easily get started on writing your code using the library
    2. java\src\main\java\io\swagger\client\model: It contains the definition of all modeling objects
    3. java\src\main\java\io\swagger\client\api: It contains the source code of our API services' wrappers

Example:

The following code snippet is an example of how to create a Requirement. It includes the following steps:

  1. Authenticate. In order to acquire an authorized token, you can use method postAccessToken of class LoginApi
  2. Retrieve all available projects from your qTest Manager instance and then select the first one
  3. Retrieve all Modules from the selected project and then select the first one
  4. Create a new Requirement under the selected Module

Sample_code_snippet.png

Subscribe To Our Blog
Powered by Zendesk