Skip to main content

 

 

 

 

Template:OutSystems/Documentation_KB/Breadcrumb_New_Layout

 

 

Template:OutSystems/OSLanguageSwitcher

 

 

 

OutSystems

Customize REST URLs

OutSystems allows you to customize the URL of your REST API methods according to your needs. For example, you could customize this URL:

GET https://<server>/MyAPI/rest/PhoneBook/GetContact?Id={Id}

to the following one:

GET https://<server>/MyAPI/rest/PhoneBook/Contacts/{Id}

For that, do the following:

  1. In the Logic tab, open the Integrations folder.
  2. Expand the REST API and select the method you want to change to display its properties.
  3. Set the URL Path property of the REST API method to the new custom URL. Example: /Contacts/{Id}.

The URL property will change accordingly.

The following sections show some examples of how to customize your endpoints.

Endpoints for Collections Example

Use the same name for methods related to a resource. OutSystems knows which method to execute through the HTTP verb (protocol and server omitted in endpoints for brevity):

Default Endpoint URL Path Customized Endpoint
GET /MyAPI/rest/PhoneBook/GetContacts /Contacts GET /MyAPI/rest/PhoneBook/Contacts
POST /MyAPI/rest/PhoneBook/CreateContact /Contacts POST /MyAPI/rest/PhoneBook/Contacts

Endpoints for a Resource Example

When handling a specific resource, start the URL Path with the collection name and add the following depending on the HTTP verb:

  • GET or DELETE: Add the resource identifier (the input parameter of the REST API method) between '{' and '}'.
  • PUT: Add nothing, since the resource is already passed in the request Header or Body.
Default Endpoint URL Path Customized Endpoint
GET /MyAPI/rest/PhoneBook/GetContact /Contacts/{Id} GET /MyAPI/rest/PhoneBook/Contacts/{Id}
DELETE /MyAPI/rest/PhoneBook/DeleteContact /Contacts/{Id} DELETE /MyAPI/rest/PhoneBook/Contacts/{Id}
PUT /MyAPI/rest/PhoneBook/UpdateContact /Contacts PUT /MyAPI/rest/PhoneBook/Contacts

Endpoints for Sub-Collections Example

With master-detail relationships, handle details as a collection under the master resource:

Default Endpoint URL Path Customized Endpoint
GET /MyAPI/rest/PhoneBook/GetContactAddresses /Contacts/{Id}/Addresses GET /MyAPI/rest/PhoneBook/Contacts/{Id}/Addresses
  • Was this article helpful?