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
Procedure
-
Sign in to the Boomi Cloud API Management (Control Center) dashboard.
-
Click API Definitions on the Get Started page or navigate to Design > APIs.
-
On the Manage your APIs with API Definitions page, in the Name column, select the API Definition link from the list. This opens the Endpoint Settings:
<your endpoint name>page. -
On the Endpoint:
<your endpoint name>page, in the Name column, select an endpoint link or settings icon next to the row you want to configure endpoint settings. -
Navigate to Call Transformations. On the Call Transformations page, specify the following information in these fields:
-
Processing Adapter:
com.mashery.proxy.customer.generic.inject-conditional-header-connector -
Perform Pre-Processing: Enabled
-
Data to make available for pre-processing: Enter the following data one per line:
Data Example Notes [{"header": "value1"},{"header": "value2"}][{"header": "Accept: application/json"},{"header": "Accept: application/xml"}]This is an optional field.
-
Perform Pre-Processing: Enabled
-
Data to make available for post-processing: Enter the following data one per line:
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 note-
For
httpStatusCodevalues, differenthttpStatusCodevalues could be specified by comma separated values.For example,
"httpStatusCode":"500, 504". You can also specifyhttpStatusCoderange as"1xx","2xx","3xx","4xx" or "5xx". -
httpStatusCoderange is case-insensitive.
-
-
-
Click Save.