CentraSite Documentation : Working with REST-based APIs : Modeling a RESTful API : Configuring HTTP Methods : Adding a HTTP Method to the REST API
Adding a HTTP Method to the REST API
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 HTTP method
1. Display the details page for the REST API that you want to configure. If you need procedures for this step, see Viewing the Details of a REST API.
2. In the actions bar for the API, click Edit  icon.
3. Navigate to Advanced Information > Resource and Methods profile.
4. Locate the resource you want to add HTTP methods.
5. Click Add Method link.
6. In the Add Method dialog box, enter the following information in the fields provided:
In this field...
Do the following...
Name
Optional. Enter a name for the method.
Description
Optional. Enter descriptive information about the method.
HTTP Method
Choose the HTTP operation you want to perform on the resource. (The drop-down list will contain the list of supported HTTP methods.)
Request Content-Type
Choose the content format for request message. (The drop-down list will contain the list of supported content formats.)
If you want to specify multiple formats, use the plus button to add additional rows.
Note:  
By default, this field shows an empty default value.
Response Content-Type
Choose the content format for response message. (The drop-down list will contain the list of supported content formats.)
If you want to specify multiple formats, use the plus button to add additional rows.
Note:  
By default, this field shows an empty default value.
Parameters - Add Parameter (link)
Optional. Specify one or more request parameters at the method level.
Note:  
You cannot add more than one parameter with the same name and the same type within the method.
a. Click the Add Parameter link to open the Add Parameter dialog.
b. In this dialog, you define input parameters at the method level. To specify multiple parameters, click on the Add Parameter link to add each new parameter.
The new parameter is added to the method. For a complete description of how to set up the request parameters, see Adding a Parameter to the REST API.
HTTP Status Codes - Add Status Code (link)
Optional. Define one or more HTTP response status codes that indicates the success or failure of an invocation. For a complete description of how to set up the status code, see Adding a Status Code to the RESTful API.
Sample Requests and Responses - Add Request and Response (link)
Optional. Write one or more sample requests to the resources of the REST API, and the corresponding sample responses from the API. For a complete description of how to expose the HTTP requests and response messages, see Adding a Request and Response Message to the REST API.
For each method, depending on the requirements, you can specify the path parameters, query parameters, and header parameters.
7. Click on the newly added method name button to view its detail.
8. To further update the new method, click Edit . Repeat for each method that you want to modify.
9. To specify multiple methods, click the Add Method link to add each new method.
10. After you specify the value for all of the required fields, click Save  to save the API.
Copyright © Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback