Adding REST Service Operations
To add a REST service operation to the system, you must first create a REST service using the Services component.
See Adding REST Service Definitions.
Important! You can add only those service operations defined as REST service operations to REST service definitions; you cannot add non-REST service operations to REST services and you cannot add REST service operations to non-REST services.
The type of service, provider or consumer, determines the type of service operation that the system adds. If you are working with a provider service and add a service operation, a provider service operation is added to the service; if you are working with a consumer service and add a service operation, the system adds a consumer service operation.
To add REST Service Operations:
Select
.Select the REST Service checkbox.
Search for the Service Definition.
Use the Service Operations section to add REST Method.
This example illustrates the Services page for a REST Service.
Select the REST method from the drop-down list. The valid values are:
Delete.
Get.
Head.
Note: HEAD is no longer a required selection to process HEAD requests for a REST provider. The IB framework, when processing the HEAD method calls, will invoke the GET method (all authentication\validation applies with respect to the GET method). No response payload data will be turned. To invoke a HEAD method for REST Consume, the developer should use the GET method and set the property on the message object prior to calling the SyncRequest. For more information, see Invoking the HEAD Method for REST Consumer Service Using GET.
Patch.
Post.
Put.
See REST Methods.
Click Add.
The Service Operations page appears.
The system automatically appends the service operation name with the name of the selected REST method. This functionality allows you to reuse the service operation name using other method types.
For example, if you enter the REST method GET for the Service FLIGHT_INFORMATION, the Service operation will be FLIGHT_INFORMATION_GET.
To invoke the HEAD method for a REST consumer service, use the GET method. A new message property will be created called HeadRequest which will take a boolean value. When set to True, it will change the method internally from a GET HTTP method to HEAD. This should be set prior to making the SyncRequest call.
The following example illustrates the use of the GET method to invoke a HEAD for the QE_WEATHERSTATION_CONSUME_GET consumer REST service operation:
&MSG = CreateMessage(Operation.QE_WEATHERSTATION_CONSUME_GET);
&DOC = &MSG.GetURIDocument();
&COM = &DOC.DocumentElement;
&COM.GetPropertyByName("state").Value = "Washington";
&COM.GetPropertyByName("city").Value = "Redmond";
&COM.GetPropertyByName("day").Value = "today";
&COM.GetPropertyByName("week").Value = "first";
&COM.GetPropertyByName("year").Value = "2010";
&COM.GetPropertyByName("country").Value = "USA";
&MSG.URIResourceIndex = QE_FLIGHTDATA.QE_ACNUMBER;
&bRet = &MSG.IBInfo.LoadRESTHeaders();
&MSG.HeadRequest = True;
&return_mesage = %IntBroker.SyncRequest(&MSG);