CentraSite Documentation : Working with REST-based APIs : Creating a RESTful API from Scratch : Adding HTTP Request to REST API
Adding HTTP Request to REST API
A HTTP request describes the input to a HTTP method (as a collection of parameters) for the addressed resource.
In this task, you define the valid requests for the resources. In addition, you can define the request representation formats, and the schemas and examples to represent the HTTP requests.
To add a HTTP request
1. Display the details page of the REST API (see Viewing the Details of a REST API for details).
2. In the actions bar for the API, click the Edit icon.
3. Select the Resource and Methods profile.
4. In the Add/Modify Method dialog box, expand the Requests section.
5. Click the Add Request link.
6. In the Add Request dialog box, enter the following information in the fields provided:
In this field...
Do the following...
Name
This is a label that you assign as a meaningful name for the HTTP request.
For example, you may call a HTTP request of the type application/xml, as XML Request or XML Payload.
You may also call a HTTP request based on the data that it holds. For example, you could specify a POST request to create new customer as Create Customer Request.
Description
Optional. Enter a comment or descriptive information about the request.
Request Content-Type
Select the content format for request message. (The drop-down list displays the list of supported content formats.)
Note:  
By default, this field displays an empty default value.
Schema
Optional. Specify a HTTP request message (payload) using either XML schema or JSON schema.
Inline or External File
Specify whether the schema definition will be read from an inline text (the Inline option) or from an external file or URL (the External File option).
If you want to use an inline schema, specify the schema definition manually in the Inline text box.
If the schema definition you are uploading resides on the network, specify its URL.
If the schema definition resides in an external file, specify the file name. You can use the Browse button to navigate to the required folder.
Note:  
As a best practice, you should use the Inline option to include small number of data, and use the External File option to include large number of data stored in an external file.
Example
Optional. Specify a HTTP request message (payload) using examples to show how a schema is used. An example is simply an XML code or JSON code.
Inline or External File
Specify whether the example will be read from an inline example code (the Inline option) or from an external file or URL (the External File option).
If you want to use an inline example, specify the example code manually in the Inline text box.
If the example definition you are uploading resides on the network, specify its URL.
If the example definition resides in an external file, specify the file name. You can use the Browse button to navigate to the required folder.
Note:  
As a best practice, you should use the Inline option to include small number of data, and use the External File option to include large number of data stored in an external file.
7. To further update the new request, mouse over the request, and then click the Edit icon. Repeat for each request that you want to modify.
8. To specify multiple requests, click the Add Request link to add each new request.
9. If you need to delete a request, mouse over the request, and then click the Delete icon. Repeat for each request that you want to delete.
10. After you specify the value for all of the required fields, click the Save icon to save the changes.
Copyright © 2005-2015 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback