Creating a Trait

Traits will help you to define generic request and response patterns like query parameters, headers, response types (200, 404) etc and their respective response schemas. You can reuse them with endpoints.

You can create a Trait by clicking on the Traits option in your Project Home page which will open a view as shown below to fill in the details and create your Trait. You can specify headers, query params, multiple response codes and their respective response schema as shown below.

Example

Let's create a generic response pattern/trait for all error codes that our API may return like 404 (not found),400 (bad request) with the schema shown above and we will put it under Traits folder.

What's next?

Next we will create our API endpoint for creating a ToDo.

results matching ""

    No results matching ""