cancel
Showing results for 
Search instead for 
Did you mean: 

Settings a HTTP response code for triggered tasks

Henchway
Contributor

Hi everyone,

we’re offering a triggered task as a sort of simplified API for a more complex REST API (specifically Jira).

What we want to achieve is to influence the HTTP return code, status and message we deliver back to the caller of the triggered task based on the return result of the REST API.

Here’s a brief description for context:

image

Assuming there’s an error in the Jira Search snap, the error will bubble up to the pipeline execute snap, which in turn triggers the attached error pipe of the template pipe.
This will ensure that the error is correctly logged, however, the response to the caller of the triggered task will be 200 in any case.

I’m unsure of 2 points:
Where is the response formed and delivered back to the caller? At the Error pipe or already somewhere before that?
Is there any way to influence what is delivered back to the caller? Ideally we’d like to implement a solution in the template pipeline for e.g. common response codes, but want to refrain from having to implement ‘repsonse code conditionals’ in every integration pipeline.

Any suggestions are highly appreciated!

Thanks and best regards
Thomas

7 REPLIES 7

Henchway
Contributor

Thanks, that’s a pity. ☹️

BR
Thomas

akidave
Employee
Employee

It is possible to set the response code for a triggered task. Use a Document to Binary snap as the final snap and set a binary header property called status, the integer value for that property will be the response code for the API call. For example, the attached pipeline returns a 409 response code

If more fine-grained control is required on the API response, the API management functionality which is a subscription feature allows for full control on the API response.

reds_2020_09_22.slp (3.2 KB)

Thank you!

scotth
New Contributor II

Is it only the Status code that can be modified? i.e. the body of the message returned to the POSTing system is:
{
“http_status_code”: 200
}
Are you saying there is no way to control this body response?