Software AG Products 10.5 | Using CentraSite | Asset Management | Managing Assets through CentraSite Business UI | REST Service Management | Adding REST Service from Scratch | Adding HTTP Response to REST Service
 
Adding HTTP Response to REST Service
HTTP/1.1 defines all the legal status codes. Examine these codes to determine which are appropriate for your Service.
HTTP response status codes provide information about the status of a HTTP request. The HTTP specification defines several status codes that are typically understood by clients.
In this task, you define the valid responses for the HTTP requests. In addition, you can define the response representation formats, and the schemas and examples to represent the HTTP responses.
A HTTP response indicates the success or failure of a REST Service invocation.
*To add a HTTP response
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 Response Message.
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. In the Add/Modify Method dialog box, click the chevron to expand the area labeled Responses.
9. Click the Add Response link.
This opens the Add Response dialog box.
10. In the Add Response dialog box, provide the required information for each of the displayed data fields.
Field
Description
Status Code
Select a HTTP Response status code number.
Examples
*HTTP 200 OK
*HTTP 400 Bad Request
*HTTP Error 404 Not Found
*HTTP Error 500 Internal Server Error
Name
This is a label that you assign as a meaningful name of the HTTP Response.
For example, you may call a HTTP 400 Response as Validation Error, instead of the Bad Request.
Description
(Optional). The description for the HTTP Response.
Request 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.
Schema
(Optional). The REST Payload (HTTP Response message) using an XML schema or JSON schema.
Inline or External File
Specifies if the schema definition will be read from an inline text (the Inline option) or from an external file or URL (the External File option).
To use an inline schema, type the schema definition in the Inline text box.
To use an external schema, do the following:
*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). The REST Payload (HTTP Response message) with suitable examples to demonstrate the usage of a schema. An example is an XML code or JSON code.
Inline or External File
Specifies if the example will be read from an inline example code (the Inline option) or from an external file or URL (the External File option).
To use an inline example, type the example code in the Inline text box.
To use an external example, do the following:
*If the example you are uploading resides on the network, specify its URL.
*If the example 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.
The newly created HTTP Response is added to the REST Method.
11. Click the chevron next to the HTTP Response for which you want to display the details.
12. To further update or delete a HTTP Response, hover over a particular HTTP Response.
This displays icons for one or more actions that you can perform on the HTTP Response.
13. Click the Edit or Delete icon, as required.
14. To specify multiple HTTP Responses, click the Add Response link, and provide values for the new HTTP Responses.
15. Click Save.