Forum Discussion

Henchway's avatar
Henchway
Contributor
5 years ago
Solved

Return custom HTTP Header

I’m trying to return a hash of a CSV document I’m returning in a triggered task and I want to return it in a HTTP header.
I would have thought i can do it the same way i can manipulate the status code by setting a binary header, but the headers aren’t coming through.

Does anyone have an idea how to achieve this? (Ideally without buying any additional subscription services, thanks)

Here’s an example of the output of the csv formatter:

Best regards
Thomas

  • Hi @Szymon,

    1. The harder way:
      If it’s literally 10, 20, or even 100s of rows you can dynamically build an INSERT INTO … VALUES()… pl/sql string and execute it with the Oracle - Execute snap. But if it’s thousands oF rows or even more, then you can store the temporary data into a temp table and then apply the BEGIN … COMMIT/ROLLBACK again with an Oracle - Execute snap.

    2. The easier way 🙂
      But, maybe you’re seeking this option in a snap (Oracle - Bulk Load):

    /Igor

3 Replies

  • Hi @Henchway

    If you have the key $content mapped in your response document, that will be considered the response body, and the rest of the key/value pairs are treated as response headers.

  • Hi @Henchway,

    If you are referring to having a SnapLogic triggered task respond with a custom HTTP header value, then these are the following scenarios:

    1. If you’re using the ground URL on a groundplex, then it’s possible by having the custom value go to the $[‘content-type’] variable in a Mapper snap. Ensure your Mapper snap has a Binary output and that it’s unlinked.

    The $content variable within the Mapper will contain the response body so ensure that’s there if necessary.

    1. If you’re using the cloud URL (whether it be via a groundplex or cloudplex), this is currently not possible and only standard HTTP headers can be returned in that case.

    Thanks,

    Ali

    • Henchway's avatar
      Henchway
      Contributor

      Thank you very much, i wasn’t aware that I had to use the override URL to use custom headers!

      Best regards
      Thomas