HTTP REST Web services are defined through an HTTP invocation path which will be used as an URL for invoking a given web service.
They are moreover also defined through an HTTP Method such as POST, GET, PUT, DELETE, ... which are used to differentiate the functional operation which are performed on a given web service, such as creating an item, retrieving information on this item...
When exposing Stambia Web services, both HTTP Path and HTTP Method on which a delivery can be invoked can be customized.
This article demonstrates how to configure Processes to customize this.
Prerequisites:
- Stambia DI Runtime S17.6.6 or higher
- HTTP REST API Endpoint V3 and higher
Defining delivery invocation path and methods
Configuration of the META-INF
Defining path and methods on which a delivery can be invoked is done directly in corresponding Process.
Open a Process and define from Properties View the following information in Meta-Inf tab, replacing values with your own settings.
<httpRestWebServiceProperties path="user/defined/path" methods="post patch"> </httpRestWebServiceProperties>
Description of attributes:
Attribute | Description | Example |
path |
Path on which delivery can be invoked when published as web service. This will be added to endpoint starting path as demonstrated in usage example further in article. |
customer |
methods | Space separated list of methods on which delivery can be invoked such as post, patch, get, put, delete, ... | post patch |
Example:
<httpRestWebServiceProperties path="customer" methods="post patch"> </httpRestWebServiceProperties>
Invocation of published web service
Given previous example, published web service can be invoked through POST and PATCH HTTP Methods on following HTTP Path:
POST http://hostname:42200/rest/StambiaDeliveryService/3/default/customer
and
PATCH http://hostname:42200/rest/StambiaDeliveryService/3/default/customer
About multiple deliveries
This mechanism is particularly useful if you want to separate your flows into multiples Processes, and you want them to be invoked with the same path but with only a different method.
You can have for instance a Process A in which you defined a path as "customer" and methods as "get", and a Process B in which you defined a path also as "customer" and methods as "post patch".
When invoking the web service with the given path, which is the same for both Processes, depending on the HTTP Method used while invoking, one or the other delivery will be executed transparently.