Use the set-attributes statement to add, update, or remove attribute values in the HTTP response body in an inbound request or outbound response. This statement applies to permit decisions produced by custom API Access Management policies.

Screen capture showing the Set Attributes statement, including the statement name, description, code, payload, and the kinds of decisions the statement applies to.

Code

set-attributes

Payload

The payload for this statement is a JSON object that contains key-value pairs. Each key-value pair is interpreted as an attribute modification on the request or response body of the request being authorized. For each pair, the key is a JSONPath expression that points to the attribute being modified, and the value is the new value for the attribute.

The value can be any valid JSON value, including a complex value such as an object or array. A null value removes the attribute from the HTTP body. Key-value pairs that do not already exist are added to the HTTP body, unless the value is null.

Format: { "$.jsonPath": "attributeValue" }

Example

The following payload instructs the decision service to replace the account type Savings with the account type PremierSavings.

Example payload: { "$.type":"PremierSavings" }

Original body:

{
"ID": "123456",
"amount": "999",
"type": "Savings"
}

Modified body:

{
"ID":"123456", 
"amount":"999", 
"type":"PremierSavings"
}