Skip to main content





Consume a REST API

When you need to retrieve or manipulate information from another system, and that system provides REST APIs for that effect, you can consume a REST API in your application.
Start by looking into the documentation of the REST API you want to use and understand how it works. You will need to gather the following information:

  • Base URL
  • Security/Authentication requirements
  • Methods definition (HTTP Method, URL Path, response format)


Each REST API will have their own model of security and authentication process, which may imply the creation of an account, the registration for an API key or the usage of tokens. To consume a REST API in OutSystems you must understand and follow the provider's security model.

Define the REST API and REST API Method

After gathering all the information you need from the REST API documentation, do the following to consume a method of the REST API:

  1. In the Logic tab, open the Integrations folder.

  2. Right-click on the REST element and select Consume REST API....

  3. In the displayed dialog, choose to add a single method:

    If the REST API you want to consume is compliant with the Swagger specification, you will be able to add all the API methods in one step by choosing ADD ALL METHODS. Otherwise, you need to add each method individually.

  4. Fill the information about the Method URL. You can include parameters in braces in the URL for the method's input parameters.


  5. If the REST API you are consuming requires authentication or specific headers, open the Headers/Auth tab and fill the needed information:

  6. Fill the information about the Request and the Response. The easiest way to do this is to perform a test to the API and use the test result — alternatively, you can add the JSON structure or plain text example directly in the Request and Response fields in the Body tab. Open the Test tab. If you have parameters in your Method URL, you need to insert the parameter values to execute the test:

    For manipulation methods, such as POST or PUT, fill the Request of the Body Content with the corresponding request structure:

  7. Click Test. If the test is successful, you will see the method’s response in the Response area of Test tab.Use that information to fill in the Response in the Body tab by clicking COPY TO RESPONSE BODY in the Response area. Leave only the needed fields. For manipulation methods (such as POST or PUT), do the same for the Request, by pressing COPY TO REQUEST BODY in the Request area:

    Usually, the most common fields are obtained this way. To know in full detail all the available fields, check the API documentation;

  8. Check if the Request and Response information is correct in the Body tab and click OK:

At this point, check what OutSystems does automatically for you:

  • Creates the REST API
  • Creates the REST API Method with the corresponding input and output parameters
  • Creates the Structures to hold the corresponding input and output parameters
  • Maps the REST Data Types into OutSystems Data Types



Use the REST API Method in your Application

OutSystems translates the methods exposed by a REST API into OutSystems actions, with the same semantics as any action created by you in Service Studio.

You can now use the newly created methods in your application the same way you use the remaining Server Actions:

  1. Go to the action flow where you want to use the REST API Method.
  2. In the Logic tab, open the Integrations folder and REST element.
  3. Open the REST API and drag the REST API Method into your action flow:

  4. Use the method's output parameters as you do for any other action:

  • Was this article helpful?