CentraSite 10.7 | CentraSite User’s Guide | 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. On the Resource and Methods page, expand the resources and click Add Method.
9. Expand Responses, and click the Add Response link.
This opens the Add Response dialog box.
10. In the Add Response dialog box, you can add a new response or select an existing global response defined in the Components page.
To add a new response
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.
Response Content-Add Response Content (link)
The content format for HTTP Response message. Click Add Response Content and provide the following information:
a. Response Content-Type: It displays a list of the supported content formats for the REST Service. By default, this field shows an empty value.
b. Schema: The REST Payload (HTTP Response message) using an JSON schema.
You can enter a new schema or select an existing global schema defined on the Components page. For more information about selecting an existing schema, see Adding Components Objects to Resources and Methods.
c. Example: The REST Payload (HTTP Response message) with suitable examples to demonstrate the usage of a schema. An example is an JSON code.
You can enter a new example or select an existing global example defined on the Components page. For more information about selecting an existing example, see Adding Components Objects to Resources and Methods.
Headers-Add Header (link)
Click Add Header and provide the required header information.
You can enter a new header or select an existing global header defined on the Components page. For more information about selecting an existing header, see Adding Components Objects to Resources and Methods.
Links-Add Link (link)
Click Add Link and provide the required header information.
You can enter a new link or select an existing global link defined on the Components page. For more information about selecting an existing link, see Adding Components Objects to Resources and Methods.
The newly created HTTP Response is added to the REST Method.
To select an existing response
a. On the Add Response page, click Choose.
b. On the Choose a Response page, enter search text and click the search icon.
c. A list of responses is displayed. Select the desired response and click OK.
d. A response page appears with the response details.
Note: 
*You cannot edit the responses referred from Components in Resource and Methods.
*Deleting the response from Resource and Methods removes it only from the REST Method.
*You cannot delete a response in Components, if a response is referred in the Resource and Methods. You can delete the response from Components after every association is removed from the Resource and Methods.
The existing 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.