When you need to change the way the REST API Method communicates with another system, simply edit the definition of the REST API method and change it.

Typically, there are some steps you always take when changing a REST API method:

  1. Look into the API documentation. Understand how you can invoke the REST API method;
  2. Update the REST API Method, with the information you found in the API documentation;
  3. Understand what is updated;
  4. Adapt your application to the new functionality.

Example

Imagine you have an external system for managing tickets (Zendesk) and an application in OutSystems that lists and creates tickets. You need to typify the tickets. Zendesk provides a REST API for that effect.

1. Look Into the API Documentation

Go to the Zendesk API documentation and understand how their REST API works.

You will find that the REST API Method to create tickets can include the type of ticket: 'problem', 'incident', 'question', or 'task'.

The JSON structure of the request changes to:

2. Update the REST API Method

In the definition of the REST API method, update the information about the request.

3. Understand What is Updated

Press Ok and the OutSystems Platform does the following for you:

Notice the Ticket structure and its attributes:

4. Adapt Your Application to the New Functionality

Now, create a static entity with the possible values for the ticket type: 'problem' or 'question'.

In the web screen that creates tickets, add a Combo Box widget and set it to use the values static entity. Before creating the ticket set the type from the value selected in the Combo Box.

Publish, open in the browser, and create a new ticket.

Now, you want to show the ticket type on the list screen.

Repeat the four steps to show the ticket type.

1. Look Into the API Documentation

In this case, the JSON with the structure of the response changes to include the type:

2. Update the REST API Method

In the definition of the GetTickets REST API method to get the tickets, update the information about the response.

3. Understand What is Updated

Press Ok and the OutSystems Platform does the following for you:

Notice the Ticket structure and its attributes:

4. Adapt Your Application to the New Functionality

Add the ticket type to the web screen that lists tickets.

Publish, open in the browser, and check the type of ticket you have created.

See Also

Retrieve Data using REST