Forum Discussion

pcoleman's avatar
pcoleman
New Contributor III
4 years ago
Solved

Raw Text into Body on REST Post

We have an API that’s expecting raw text as the body of the call and I’m not clear on how to get SnapLogic to pass the data as raw unformatted text. If I map my text into $content and then pass that to the API

The problem is that when I look at how this is being passed, the receiving API is getting this:

I need it to be somehow stripped down to:
SELECT * from ENTRY
without the [“”]

I understand that SnapLogic deals in JSON, so I’m not sure how I get around a system that doesn’t want it’s data that way. I’ve looked into passing it as JSON, but they don’t seem to accommodate it.

  • I should have remembered this because I used batch size=0 to solve this sort of problem before but Support steered me in this direction:

    This worked and removed the json formatting around the raw text.

9 Replies

  • pcoleman's avatar
    pcoleman
    New Contributor III

    I should have remembered this because I used batch size=0 to solve this sort of problem before but Support steered me in this direction:

    This worked and removed the json formatting around the raw text.

  • viktor_n's avatar
    viktor_n
    Contributor II

    Hi @pcoleman,

    Does you get same result even if you send it as string directly from HTTP entity ?
    Instead of $content send it as hardcoded string value.

    Regards,
    Viktor

    • pcoleman's avatar
      pcoleman
      New Contributor III

      Was a good idea, but unfortunately it seems to pass with the [“”] still.

  • viktor_n's avatar
    viktor_n
    Contributor II

    If you haven’t tried to send content-type in headers, try this content-type: text/plain

  • pcoleman's avatar
    pcoleman
    New Contributor III


    Had it this way…unfortunately…no difference.

  • viktor_n's avatar
    viktor_n
    Contributor II

    It is possible that could be from the API side.

    I have no idea what other can be.

    • pcoleman's avatar
      pcoleman
      New Contributor III

      I can send the body successfully as raw text using Postman. Also I’ve verified that SnapLogic is adding the [“”] in when I send the same call to a RequestBin that I use for testing. I may need to log a ticket on this. All great ideas to try from you though and I appreciate it!

  • viktor_n's avatar
    viktor_n
    Contributor II

    I’ve created one pipeline which I am triggering with REST Post snap.
    In that pipeline I don’t do anything, just passing the data back as respone.

    In HTTP entity I pass string and as response I get the same string back so it means that REST Post snap is not adding anything.

    Here is the response that I’ve got:

  • pcoleman's avatar
    pcoleman
    New Contributor III

    I don’t think that’s quite true. I’m using an outside API Request bin (using pipedream.net) to test:
    When I send from Snaplogic:

    I see this in the request bin:

    If I submit the same thing from Postman:

    I get:

    I suspect that SnapLogic is handling all of what you see internally.

    Ultimately, I know it’s unusual to have an API that requires RAW text, but this one does, so I’m in a bad spot because SnapLogic seems to force minimal JSON formatting even if I don’t want it there.