Created on 04 May 2015
icon_unfollowing
Login to follow
how-to-expose-a-rest-api

How to Expose a REST API

Stable version 1.0.0 (Compatible with OutSystems 11)
Other versions available for 10 and Older
Uploaded on 27 August 2020 by 
how-to-expose-a-rest-api

How to Expose a REST API

Details
Sample of an exposed REST API with methods to list, create, update, and delete records. It also demonstrates how to send a custom error message if something goes wrong in the execution of the requested method. The REST API uses Basic authentication.
Read more

REST APIs allow you to expose data and functionality of your application over HTTP to be used by other systems.

Each REST API method of this project illustrates one or two use cases of how you can use expose REST APIs. Check how to:

Expose a method to provide data

1. In the method, set the 'HTTP method' property to GET.
2. Add a Contact List as output parameter.
3. Set the placement of the output in the request at the 'Send In' property of the parameter.
 

Expose a method to create data

1. In the method, set the 'HTTP Method' property to POST.
2. Add a Contact as input parameter, and a Contact Identifier as output parameter.
3. Set where the input parameter is received in its 'Receive In' property.
4. Set where the output parameter is sent in its 'Send In' property.
 

Expose a method to update data

1. In the method, set the 'HTTP method' property to PUT.
2. Add a Contact as input parameter.
3. Set the placement of the input in the request at the 'Receive In' property of the parameter.
 

Expose a method to delete data or raise an error

1. In the method, set the 'HTTP method' property to DELETE.
2. Add a Contact Identifier as input parameter.
3. Set the placement of the input in the request at the 'Receive In' property of the parameter.
4. In the method logic, raise a custom error using the Raise Error element if there is any problem with deleting this record.

 

Add Basic authentication to an exposed REST API

The action calls the User_Login action of the Users module.
If the authentication succeeds, the invoked REST API method is executed immediately after.
Otherwise, an exception is raised, the request is aborted, and the response returns a security error.


For more information on exposed REST APIs, check the documentation on exposing REST APIs.

Release notes (1.0.0)

Upgraded to O11

Reviews (1)
by 
2021-05-28
in version 1.0.0
Thank you, Cristiana! May you please add something about the data types of the exposed REST API? How do we configure a number type? Thanks again!
Category
Demos & samples, Other demos & samples
Tags
Support options
This asset is not supported by OutSystems. You may use the discussion forums to leave suggestions or obtain best-effort support from the community, including from  who created this asset.
Dependencies
How to Expose a REST API has no dependencies.
Application Objects
How to Expose a REST API has 13 AOs.
Team
Compatible with
Version 11
Database:
All
Asset consumers
No consumers yet.
Weekly downloads