How to Expose a REST API
Stable Version 1.0.0
Published on 04 May 2015 by 
Created on 04 May 2015
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

- In the method, set the 'HTTP method' property to GET;
- Add a Contact List as output parameter;
- Set the placement of the output in the request at the 'Send In' property of the parameter.
 
Learn more about how to expose data using REST.
 

Expose a method to create data

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

Expose a method to update data

- In the method, set the 'HTTP method' property to PUT;
- Add a Contact as input parameter;
- 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

- In the method, set the 'HTTP method' property to DELETE;
- Add a Contact Identifier as input parameter;
- Set the placement of the input in the request at the 'Receive In' property of the parameter;
- 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.
 
Reviews (0)
Category
Samples & How-tos
Support Options
This component is not supported by OutSystems. You may use the discussion forums to leave suggestions or obtain best-effort support from the community, including from TechComm who created this component.
Dependencies
How to Expose a REST API has no dependencies.
Requirements
Platform
9.0.0.1
Database
All
Stack
All
Component Consumers
How to Expose a REST API has no consumers.
Weekly Downloads 
Related Components
Google Drive Connector
OutSystems R&D
Google Drive Connector allows your OutSystems Applications to use the Google Drive REST API to interact with your files.
1000
Google Maps
Labs
Google Maps is a Google Maps Javascript V3 API component, providing Web Blocks and Actions to add interactive maps, markers and directions, along with event driven functionality.
10664
JIRA Connector
OutSystems R&D
JIRA is a issue tracking product, developed by Atlassian. It provides bug tracking, issue tracking, and project management functions. This connector gives you the power to integrate JIRA with your apps to automate your work.
596
More from TechComm
ZXing Services
OutSystems Technical Communication
This component provides services for barcode encoding and decoding in different formats: CODE 39, CODE 128, QR, EAN13, EAN8 throughZXing library (http://code.google.com/p/zxing/)
2693
Google Static Maps API
TechComm
Wrapper for the Google Maps Static API. Use this component to add a static image showing the location of one or more addresses in a map. Configure several aspects of this image like showing a satellite image or a roadmap view, tune the zoom factor or customize the address marker.
2312
Offline Data Sync Patterns
TechComm
A collection of working samples for common data synchronization patterns between the database and local storage entities.
869