Rest SetRequestHeader
Use this command to set the header of the REST call that you are about to execute. For example, you may want to set a header that sets the content type of the information that you will be sending via a REST EXECUTEPOST or REST EXECUTEPUT call.
Note: You may set several headers before making the REST EXECUTEPOST, REST EXECUTEPUT, REST EXECUTEHEAD, or REST EXECUTEGET calls.
Syntax:
REST SETREQUESTHEADER HeaderName Value
where:
- HeaderName is the name of the header response to retrieve.
- Value is the value associated with the specified header.
Syntax example:
REST SETREQUESTHEADER “Content-Type” “application/json”
Using password attributes in REST SETREQUESTHEADER command
You can use password attributes to securely set header values in REST SETREQUESTHEADER commands. Reference a password attribute using this syntax:
[[Password,<system password attribute name>]]
For example, you could use this function to set an authentication header when connecting to an external REST API:
REST SETREQUESTHEADER "Authorization" "[[Password,ASTestPassword]]"
The password attribute is set in the header but is not resolved at this point. When subsequent REST EXECUTEPOST, EXECUTEPUT, or EXECUTEGET commands are called, the password attribute in the header is resolved server-side at execution time in two scenarios:
- Run using an event
- In batch mode when connected with a service account user
In both cases, the actual secret value is sent to the external endpoint without passing through the client, and password values are never exposed in client-facing output or logs.