Table of Contents maxLevel 3
...
For example, if you pass a tenant ID (X-TENANT-ID) in a header, add the parameter X_TENANT_ID and provide a default or leave it blank. When you configure the expression, refer to the Pipeline argument following standard convention: _X_TENANT_ID. In the HTTP request, you add the header X-TENANT-ID: 123abc
, which results in the value 123abc being substituted for the Pipeline argument X_TENANT_ID.
Info |
---|
Custom response headers are supported for Ultra Task or Triggered tasks invoked using Ground URLs. They are not supported for Cloud invoked Triggered tasks. |
Example
You can set an HTTP header in a Triggered Task by using the Mapper Snap.
To set the header, add a Mapper Snap to the end of the Pipeline. The Mapper Snap should have a binary output view. Any expressions mapped in that Snap are added as an HTTP response header.
...
The following response shows the endpoint information for the Task URL, where X-My-Header is the custom header being set by the Task:
Panel |
---|
$ http httpshttp://elastic.snaplogic.comio/api/1/rest/feed/snaplogic/projects/m%20smith/header-example-task 'Authorization: Bearer RRxxVsEUVXGREgd20BRUvx49KncOsfWr' foo=bar HTTP/1.1 200 OK Accept: application/json, /;q=0.5 Connection: keep-alive Content-Length: 14 Content-Type: application/json Date: Wed, 10 June 2020 18:10:00 GMT Host:elastic. User-Agent: HTTPie/2.1.0 Vary: Accept-Encoding X-Forwarded-For: 198.51.100.22 X-My-Header: foo X-SL-AssetPath: /snaplogic/projects/m_smith/header-example-task X-SL-AssetURIPath: /api/1/rest/feed/snaplogic/projects/m_smith/header-example-task X-SL-Authorized: true X-SL-ClientIP: 203.0.113.7 X-SL-PathInfo: X-SL-PolicyOrdering: [com-snaplogic-common-jaxrs-apipolicyinterceptor$sessionauthenticator, com-snaplogic-common-jaxrs-apipolicyinterceptor$snaplogicauthenticator, com-snaplogic-common-jaxrs-apipolicyinterceptor$authsentinel] x-snapi-pipeline-ruuid: 52e99318640a9a03d8681d0d_8ffe5610-be2c-408d-9068-61ee167b0372 |
...