Forum Discussion

CIAdmin's avatar
CIAdmin
Qrew Member
4 years ago

Use "Fetch JSON" in Pipeline to copy Multi-line Text value from one app to another

Hello!

I'm starting to learn how to use APIs, and I'm running into a bit of a snag.

We create new apps for particular projects because we want to add additional fields customized to that specific project without having to add those fields to our main app. I set up a Pipeline that uses RESTful JSON APIs to copy a template project app and add records from our main app to this newly created project app. I have to use APIs because I can't select the new app in the Pipeline since it's a brand new app. I need to just use the table IDs that I get from the API response.

However, I came across an issue when trying to copy over multi-line text fields. If the value of the multi-line text field being copied has a line break, I get a "Bad Request" error from the Fetch JSON step.

Is there something I'm missing either on the JSON request or the Jinja to format the text to tell it to recognize the line break as a line break and not something that causes it to error out?

Thanks!

*EDIT - SOLVED* The issue was that the Jinja output of the field value does not match the JSON formatting. Support helped me find the |tojson filter for Jinja. This ended up working out perfectly. The only issue I initially ran into is that the JSON text string needs quotes around it, so I typed in "{{a.field|tojson}}", but the |tojson filter already includes the quotes. So I just had to make it {{a.field|tojson}} to make it work.

------------------------------
Brian
------------------------------
No RepliesBe the first to reply