CentraSite 10.3 | CentraSite User’s Guide | Asset Management | Managing Assets through CentraSite Business UI | REST Service Management | Adding REST Service from Scratch | Adding HTTP Method to REST Service
 
Adding HTTP Method to REST Service
Understand the predefined HTTP methods and their known attributes. See the HTTP method definitions information to learn more about the common set of methods for HTTP.
The HTTP methods passed as part of an HTTP request tell the REST Service what operation needs to be done with the addressed resource.
Clients use HTTP methods to perform certain operations. Multiple methods exist - GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH, TRACE, and CONNECT.
Important:
During virtualization of a REST Service, CentraSite does not support the following HTTP methods: HEAD, OPTIONS, TRACE, and CONNECT.
This is because, when a Virtual REST Service is published to Mediator gateway, CentraSite only supports the HTTP methods: GET, POST, PUT, PATCH, and DELETE, at run-time.
Let us consider the following scenarios for our sample Phone Store Service:
Resource URI
Supported HTTP Methods
Description
/phones
GET
List all phones.
/phones
POST
Creates a new phone with product code 412456.
/phones/412456
GET
Retrieves details of a phone whose product code is 412456.
/phones/412456
DELETE
Removes a phone whose product code is 412456.
/phones/412456?fields=(make,features, bodytype)
GET
Retrieves additional details (such as Brand, Features, Body Type) of a phone whose product code is 412456.
/phones/412456/make
GET
Identifies the brand of a phone whose product code is 412456.
/phones/search?q=(make,eq,apple)
GET
Retrieves a list of all phones whose brand is Apple.
/phones/412456?make=apple&features=3g
PUT
Updates a phone whose product code is 412456, brand is Apple, and also 3G compatible.
Resource methods can also use parameters to identify or pass additional information. You can capture the sample requests and responses to facilitate clients easily interact with the resources of Service. You can set HTTP status codes to help client quickly and more easily understand the HTTP response messages. In this task, you define the valid operations for the resources. In addition, you can define the resource representation formats and the samples to represent the HTTP requests and responses.
*To add a REST Method
1. In CentraSite Business UI, access the Advanced Search panel in one of the following ways:
*Click the Browse link in the upper-left corner of the menu bar.
*Click the Search icon next to the Scope list. The default search scope is Assets.
This displays a list of assets in the Search Results page.
2. In the Additional Search Criteria list, select Asset Types.
3. To search for the assets of type, REST Service, click Choose.
This opens the Choose Asset Types dialog box.
4. In the Choose Asset Types dialog box, select the Assets option button, and then follow these steps:
a. Click the chevron next to Assets option button.
A list of defined asset types in CentraSite is displayed.
b. In the list of asset types, select REST Service.
c. Click OK.
A list of defined REST Service assets is displayed in the Search Results page.
5. Click the REST Service you want to add the HTTP Method.
This opens the REST Service details page. Also, the Actions bar displays a set of actions that are available for working with the REST Service.
6. On the Actions bar of the REST Service details page, click Edit.
7. Select the Resource and Methods profile.
8. Locate the resource for which you want to add the HTTP Method.
9. Click the Add Method link.
This opens the Add Method dialog box.
10. In the Add Method dialog box, provide the required information for each of the displayed data fields.
Field
Description
Name
Name of the REST (HTTP) Method.
Description
(Optional). The description for the REST Method.
HTTP Method
The HTTP operation you want to perform on the REST Resource. (The HTTP Method list displays a list of the supported HTTP Methods.)
Request Content-Type
The content format for HTTP Request message. (The Request Content-Type displays a list of the supported content formats for the REST Service.) By default, this field shows an empty value.
Response Content-Type
The content format for HTTP Response message. (The Response Content-Type displays a list of the supported content formats for the REST Service.) By default, this field shows an empty value.
Deprecated
(Optional). Specify if the REST Method is deprecated.
Parameters - Add Parameter (link)
(Optional). Request Parameters for the REST Method. The supported parameters types are:
*Query-String
*Header
*Form
Although CentraSite allows you to define parameters of the type, Form, at the Resource level, these parameters are not supported at run-time. Only parameters of the type - Query-String, and Header, are supported at run-time.
Note:
You cannot add more than one parameter with the same name and the same type for a REST Method.
a. Click the Add Parameter link.
This opens the Add Parameter dialog box.
b. In the Add Parameter dialog box, provide values for the REST Parameter.
c. Click OK.
The newly created parameter is added to the REST Method.
To further update the new parameter, hover over the required parameter, and click the Edit icon. Repeat for each parameter for which you want to modify the details.
To specify multiple parameters, click the Add Parameter link, and provide values for the new parameters.
Requests - Add Request (link)
(Optional). The HTTP requests to the Resources of the REST Service.
Responses - Add Response (link)
(Optional). The HTTP responses to the Resources of the REST Service.
Sample Requests and Responses - Add Request and Response (link)
(Optional). The sample requests to the Resources of the REST Service, and the corresponding sample responses from the Resources of the REST Service.
11. Click the chevron next to the REST Method for which you want to display the details.
12. To further update the new REST Method, hover over the required Method, and click the Edit icon. Repeat for each Method for which you want to modify the details.
13. To specify multiple REST Methods, click the Add Method link, and provide values for the new REST Method.
14. Click Save.