Configuring Endpoint Call Processing
Sample JSON Input
- The following JSON code displays sample pre-input and post-input configurations.
- For pre-inputs, you do not need to configure conditions because the status code of the call will occur after post-processing. Apart from the status code, no other conditions are checked in this connector.
- The sample pre-input JSON (shown below) adds two headers with same name (Accept) to all requests.
- The sample post-input JSON (shown below) adds five headers depending on the response status code.
- Header: "X-Content-Type-Options: nosniff" is added for response codes 500 and 504.
- Header: "Cache-Control: private" is added for response codes 400 and 404.
- Header: "Cache-Control: no-cache" is added for response codes 400, 404, and 200-299.
- Header: "Cache-Control: no-store" is added regardless of the response code.
- Header: "X-XSS-Protection: 1; mode=block" is added regardless of the response code.
# Pre-input config [ { "header": "Accept: application/json" }, { "header": "Accept: application/xml" } ] # Post-input config [ { "header": "X-Content-Type-Options: nosniff", "httpStatusCode": "500, 504" }, { "header": "Cache-Control: private", "httpStatusCode": "400, 404" }, { "header": "Cache-Control: no-cache", "httpStatusCode": "400, 404, 2xx" }, { "header": "Cache-Control: no-store" }, { "header": "X-XSS-Protection: 1; mode=block" } ]
Configuring Endpoint Call Pre-processing
To configure the Inject Conditional Header call pre-processing for an endpoint::
- From the TIBCO Cloud Mashery Control Center, navigate to
Design > API Definitions, then select the API definition from the list.
- Click an existing endpoint on the
Endpoints page.
- Click
Call Transformation in the left-hand menu.
- In the
Call Transformations page, specify the following information in these fields:
5. Click Save when done.
Configuring Endpoint Call Post-processing
To configure the Inject Conditional Header call post-processing for an endpoint:
- From the TIBCO Cloud Mashery Control Center, navigate to
Design > API Definitions, then select the API definition from the list.
- Click an existing endpoint on the
Endpoints page.
- Click
Call Transformation in the left-hand menu.
- In the Call Transformations page, specify the following information in these fields:
Data | Example | Notes |
---|---|---|
[ { "header": "value1", "httpStatusCode": "comma separated status code" }, { "header": "value2", "httpStatusCode": "comma separated status code" }, { "header": "value3", "httpStatusCode":"comma separated status code and range" }, { "header": "value4" }, { "header": "value5" } ] |
[ { "header": "X-Content-Type-Options: nosniff", "httpStatusCode": "500, 504" }, { "header": "Cache-Control: private", "httpStatusCode": "400, 404" }, { "header": "Cache-Control: no-cache", "httpStatusCode": "400, 404, 2xx" }, { "header": "Cache-Control: no-store" }, { "header": "X-XSS-Protection: 1; mode=block" } ] |
Optional |
5. Click Save when done.