Skip to main content
RapidDev - Software Development Agency
outsystems-tutorial

How to Consume REST APIs in OutSystems Step by Step

To consume a REST API in OutSystems, go to Logic tab → Integrations → REST → right-click → Consume REST API. Add a single method or import an OpenAPI spec. Service Studio auto-generates the action, input/output structures, and data type mappings. Drag the generated action into a Server Action flow to call it from your app.

What you'll learn

  • Navigate to the correct Service Studio panel to add a REST API consumption
  • Import a REST endpoint using a URL or an OpenAPI/Swagger specification file
  • Understand how Service Studio auto-maps JSON data types to OutSystems structures
  • Call the generated REST action inside a Server Action and display the result on a screen
  • Override the base URL per environment using Site Properties (O11) or Settings (ODC)
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Beginner8 min read15-20 minOutSystems 11 and ODCMarch 2026RapidDev Engineering Team
TL;DR

To consume a REST API in OutSystems, go to Logic tab → Integrations → REST → right-click → Consume REST API. Add a single method or import an OpenAPI spec. Service Studio auto-generates the action, input/output structures, and data type mappings. Drag the generated action into a Server Action flow to call it from your app.

Calling External REST APIs from OutSystems

OutSystems makes it straightforward to integrate with any HTTP-based REST API through its built-in Import REST API wizard. When you point Service Studio at an endpoint or an OpenAPI spec, it generates typed actions and data structures automatically — no manual JSON parsing required. This tutorial walks through importing an endpoint, understanding the generated structures, and wiring everything up to a screen so real API data appears for your end users.

Prerequisites

  • OutSystems 11 Personal Edition or licensed environment, or ODC Studio access
  • Basic familiarity with Service Studio (Logic tab, Server Actions)
  • The URL of the REST API you want to consume (or use the public JSONPlaceholder API: https://jsonplaceholder.typicode.com)
  • API credentials if the endpoint requires authentication (API key, Bearer token)

Step-by-step guide

1

Open the Consume REST API wizard

In Service Studio, click the Logic tab on the right-hand panel. Expand Integrations. Right-click REST and select Consume REST API. A dialog appears with two options: Add Single Method (for one endpoint at a time) or Add Multiple Methods (for OpenAPI/Swagger specs). For a quick start, choose Add Single Method.

Expected result: The Consume REST API dialog is open and the method URL field is visible.

2

Configure the method URL and HTTP verb

In the Method URL field, enter the full endpoint URL. Use curly braces for path parameters — for example: GET https://jsonplaceholder.typicode.com/posts/{id}. Service Studio automatically creates an input parameter called Id (Integer) based on the {id} placeholder. Set the HTTP Method dropdown to GET, POST, PUT, or DELETE as appropriate. In the Headers/Auth tab, add any required headers such as Authorization or X-API-Key.

Expected result: The method URL is entered with correct path parameters highlighted, and the HTTP method is set.

3

Test the endpoint in Service Studio and copy the response

Click the Test tab inside the dialog. Fill in any required input parameters (e.g., enter 1 for {id}). Click the Test button. Service Studio makes a live HTTP call and displays the raw JSON response. Click Copy to Response Body — this populates the Response tab with the actual JSON payload. Service Studio uses this sample to generate the output structure with correct field names and data types.

Expected result: The Response tab is populated with sample JSON. Data types shown for each field (Text, Integer, Boolean, etc.) are correct.

4

Review and confirm auto-generated structures

Click the Response tab to review the mapping. Service Studio converts JSON types to OutSystems types: string → Text, number → Integer or Decimal, boolean → Boolean, object → Structure, array → List. Rename any generated structures or attributes if needed by clicking directly on them. Verify the output structure matches the shape of data you expect to use in your app. When satisfied, click OK to complete the import. Service Studio creates: the REST API node under Logic tab → Integrations → REST, a method action (e.g., GetPost), input/output parameters, and any Structures under Data tab → Structures.

Expected result: Under Logic tab → Integrations → REST, your new API appears with the imported method listed beneath it. Structures appear under Data tab → Structures.

5

Call the API in a Server Action

Go to Logic tab → Server Actions → right-click → Add Server Action. Name it, for example, FetchPost. Add an input parameter PostId (Integer) and output parameter PostData (the generated output structure type). Inside the action flow, drag the generated method action (GetPost) from the toolbox or from Integrations → REST → [YourAPI] into the flow between Start and End. Set the method's Id input to PostId. Add an Assign node after the method call. In the Assign, set PostData = GetPost.Response. Action flow: Start → GetPost (Id = PostId) → Assign (PostData = GetPost.Response) → End

Expected result: The Server Action compiles without TrueChange errors. The action is callable from screens or other Server Actions.

6

Display API data on a screen

Open (or create) a Reactive Web screen. Right-click the screen name → Fetch data from Other Sources — this creates a Data Action. Inside the Data Action, drag your FetchPost Server Action into the flow. Pass an appropriate PostId value (e.g., a screen input parameter or a hardcoded value like 1). Add an Output Parameter to the Data Action that holds the returned structure. Back on the screen canvas, drag Expression widgets from the toolbox and set their Value to reference fields from the Data Action output — for example: DataAction1.PostData.Title. 1-Click Publish (Ctrl+F5) to deploy.

Expected result: After publishing, opening the screen in the browser displays live data fetched from the external REST API.

7

Handle errors from the API call

REST calls can fail (network issues, server errors, bad credentials). In your FetchPost Server Action, right-click the flow after the GetPost method call → Add Exception Handler → select Communication Exception. Inside the handler, add a Raise Exception node or an Assign that sets an error output parameter. Alternatively, wrap the API call in a try-style pattern: add an Exception Handler for AllExceptions at the Server Action level and log the error using the LogError system action from the (System) module. Action flow with error handling: Start → GetPost → [Exception Handler: Communication Exception] → Assign ErrorMessage → End

Expected result: The Server Action handles network and timeout errors gracefully without crashing the app or exposing raw error details to users.

Complete working example

FetchPost_ServerAction_logic_pseudocode.txt
1/* Server Action: FetchPost
2 Input: PostId (Integer)
3 Output: PostData (GetPost_Response structure)
4 IsSuccess (Boolean)
5 ErrorMessage (Text)
6*/
7
8Start
9 |
10 v
11[GetPost] -- REST method: GET /posts/{id}
12 Id = PostId
13 |
14 v
15[Assign]
16 PostData = GetPost.Response
17 IsSuccess = True
18 ErrorMessage = ""
19 |
20 v
21End
22
23/* Exception Handler: Communication Exception */
24[Assign]
25 IsSuccess = False
26 ErrorMessage = "Unable to reach the API. Please try again."
27 PostData = Default(GetPost_Response)
28 |
29 v
30End
31
32/* Exception Handler: AllExceptions */
33[LogError]
34 Module = "MyModule"
35 Message = AllExceptions.ExceptionMessage
36 |
37[Assign]
38 IsSuccess = False
39 ErrorMessage = "An unexpected error occurred."
40 |
41 v
42End

Common mistakes

Why it's a problem: Calling the REST API method from a Client Action instead of a Server Action

How to avoid: REST API calls run server-side. In Reactive apps, drag the method into a Server Action or Data Action, then call that from your Client Action. Calling it directly from a Client Action will cause a TrueChange error: 'REST API methods can only be used in server actions.'

Why it's a problem: Not testing the endpoint before importing, resulting in wrong data types on generated structures

How to avoid: Always use the Test tab in the Consume REST API dialog and click 'Copy to Response Body' before clicking OK. This gives Service Studio a real sample payload to generate accurate type mappings.

Why it's a problem: Hardcoding the API base URL in the method URL field

How to avoid: Extract the base URL into a Site Property (O11: Data tab → Site Properties) or Setting (ODC: ODC Portal). The method URL should only contain the path component (e.g., /posts/{id}). The base URL can then be changed per environment in Service Center without redeploying.

Why it's a problem: Ignoring TrueChange warnings about missing exception handlers on REST calls

How to avoid: TrueChange shows an orange warning when a Server Action containing a REST call has no Communication Exception handler. Add one — right-click the flow → Add Exception Handler → Communication Exception — and show the user a meaningful error message.

Best practices

  • Always test the endpoint in the Service Studio Test tab before importing — this ensures the generated structure matches the real API response.
  • Store base URLs in Site Properties (O11) or Settings (ODC) rather than hardcoding them in the method URL. This allows environment-specific overrides without redeploying.
  • Set the Timeout in Seconds property on each REST method to a value appropriate for the API's SLA — the default is 100 seconds, which may be too long for interactive requests.
  • Never call consumed REST API actions from Client Actions — always call them from Server Actions to avoid CORS errors and to keep credentials server-side.
  • Add a Communication Exception handler to every Server Action that calls an external API. Silent failures confuse users and are hard to debug.
  • Use the OnBeforeRequest callback to inject authentication headers (Bearer token, API key) dynamically rather than hardcoding them in method headers.
  • Set Max Records on any Aggregate that processes API response lists to prevent unbounded memory usage.
  • Check Service Center → Monitoring → Integrations logs when debugging API calls — it shows request/response details, timing, and errors.

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

I'm building an OutSystems 11 Reactive Web app and need to consume a REST API at [API URL]. The endpoint returns JSON in this format: [paste JSON sample]. Help me understand: 1) what Structures Service Studio will generate from this JSON, 2) how to call this endpoint from a Server Action and return the data to a screen, and 3) best practices for handling authentication with an API key header.

OutSystems Prompt

In my OutSystems module, I have imported a REST API called WeatherAPI with a method GetCurrentWeather that takes City (Text) as input and returns a structure with Temperature (Decimal), Description (Text), and Humidity (Integer). Write the Server Action logic (as an action flow description using arrow notation) that calls this method, handles Communication Exceptions, and returns the weather data or an error message to the caller.

Frequently asked questions

Can I consume a REST API that requires OAuth2 authentication in OutSystems?

Yes. In the Consume REST API dialog, select the Authorization tab and choose OAuth 2.0. Enter your Authorization Server URL, Client ID, Client Secret, and Scopes. OutSystems handles the client credentials token fetch automatically. For more complex OAuth flows (authorization code, PKCE), use the OnBeforeRequest callback to manually attach a previously-obtained Bearer token.

How do I update a consumed REST API when the external API changes its response format?

Right-click the REST API node under Logic tab → Integrations → REST → Refresh REST API. Service Studio re-imports the spec or re-tests the endpoint and highlights any structural changes. Review the diff, update any Assign nodes that reference renamed or removed fields, and resolve TrueChange errors before republishing.

What happens if the external API returns an empty response body on success (HTTP 204)?

Service Studio handles 2xx responses with empty bodies without error. The output structure will simply have all fields at their default values. If you check for a non-null response body, handle this case explicitly by checking the HTTP status code via the OnAfterResponse callback rather than checking structure fields.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.