If you want to expose methods to allow other systems to retrieve or manipulate information, you can do it using a REST API.
Create the REST API Service
- In the Logic tab, open the Integrations folder.
- Right-click REST and select Expose REST API...
- Set the name of your REST API.
A common recommendation is to name the exposed REST API according to its version. You could name the API
v1for the first version of a REST API. You can also use a different name, like
Create the REST API Method
- Right-click your REST API and choose Add REST API Method.
- Set the name of your REST API method. Examples:
- Set the HTTP Method property to the HTTP verb corresponding to the action your method performs:
- Design the method as an action that retrieves or manipulates the data you are exposing.
GetContactsreturns the list of all Contacts,
UpdateContactreceive a "Contact" record and return the "Id" of the created or updated contact.
Your REST API endpoints are accessible after deploying the application.
||Gets all contacts.|
||Gets a contact.|
||Creates a contact.|
||Updates a contact.|
||Deletes a contact.|
||Gets all addresses of a contact.|
OutSystems defines the default endpoints based on the HTTP Method (
DELETE) and on the name of the REST API Methods, but you can customize the endpoints according to your needs.
For manipulation methods where the input parameter is a Record (such as
PUT), you must add the "Content-Type" header to the request with the value