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)
Check how you can Consume one or more REST API Methods in Service Studio.
If you want to expose an OutSystems REST API, check Expose REST APIs.
REST API Authentication
Each consumed 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.
REST APIs using Basic Authentication are supported out of the box in the "Consume REST API Method" dialog box described below. You can use the REST customization capabilities to add support for other authentication methods:
For token-based authentication, use the "OnBeforeRequest" callback to add the required HTTP authorization header to the outgoing requests. Check Simple Customizations for more information.
For client certificate authentication, use the "OnBeforeRequestAdvanced" callback, together with .NET code in an extension, to customize the outgoing requests. Check the HTTPS Consumer component provided by the OutSystems Community for a possible implementation.
Additionally, check the Advanced Customizations topic for more information on how you can implement advanced use cases.
Articles in this Section
- Configure a Consumed REST API at Runtime
- How to override the Base URL and the Basic Authentication credentials of a consumed REST API for a given environment.
- Unsupported REST Enum Use Cases
- Check the list of currently unsupported use cases when consuming REST services using "enums" and how to overcome some of these situations.