I have exposed a REST API containing 2 REST API methods.

1) POST https://example.com/entities - this will create an entity.

2) GET https://example.com/entities/123 - this will return an entity.

The POST method will return the URL of the GET method as a output header parameter.

How do I generate the URL for the GET method? I don't want to hard code the absolute URL.


Hi,

In service center you can configure this on the  administration- espace - integration tab per environment.

You can also create on your API an onBeforeRequest event and set it using your own logic.

Regards,

Daniel

Daniël Kuhlmann wrote:

Hi,

In service center you can configure this on the  administration- espace - integration tab per environment.

You can also create on your API an onBeforeRequest event and set it using your own logic.

Regards,

Daniel

Hi Daniel


Thanks for your reply.

As stated in my initial post, I have 2 REST methods. 

1) The 1st method is a read. The endpoint is GET https://example.com/employees/{id} where id is the id of the employee to read. The employee entity is returned as JSON in the response body.

2) The 2nd method is a create. The endpoint is POST https://example.com/employees/ where the data to be created is within the request body. This method has 2 output parameters. One is of type employee identifier (EmployeeId) and is returned in body; the other is of type text (Location) and is returned in header.

Upon creating an employee using the 2nd method, I will assign the id of the new employee to EmployeeId. I will also need to assign the URL of the GET method to Location. 

Therefore, if the 2nd method is called

- an Employee Entity will be created

- the EmployeeId output parameter is 124.

- the Location output parameter needs to be https://example.com/employees/124

In a assign statement, how do I generate the URL of the first method so that I can assign it to Location?


The only place where you can customize your request prior to it being sent is the onBeforeRequest event of your service.

In the logic tab scroll down to REST and select the consumed webservice (not the method but the top level one).
In the right bottom of your screen (properties tab) you can see a few settings, under the advanced header you can find on before/after request methods, which you can add by pressing the dropdown arrow and selecting to add a new method.