How to update a Rich Text and file field via API

I am currently trying to figure out what is required to update a rich text field, i have the api call setup and is sending data but when i send in rich text from my Zoho Creator form, it shows up as

test

Also how do we use the api to update a File field

How is the rich text being ‘sent’?

Check out the guide

Looks like the rich text field in Zoho returns the text as this,

image

If I understand the problem, it seems like the issue is that ZoHo is sending html, and Fibery is expecting markdown

Yeah is there anyway work around for this?

I’m not a zoho or zapier expert, so I’m not sure.

What are the API call(s) you are using? Can you show the code here?

{
“command”: “create-or-update-documents”,
“args”: [
{
“secret”: “xxxxxxxxx”, //secret of specific description field
“content”: “xxxxx” // this would be the variable that stores the rich text from zoho
}
]
}

Did you try using format=html in the request URL?

1 Like

I tried that and it worked for normal text now, but if i add in rich text items in Zoho, it will send back for instance <ul> and <ol> for bulleted list which will cause nothing to be shown on fibery side

That doesn’t sound right :thinking:
Did you verify that the content being sent is valid HTML?

Here is the html from zoho
image

Here is what is inputted in Zoho rich text field

I think you will need to engage Fibery Support for help with this issue, since only they can see what data has been passed to Fibery :worried:

1 Like

I did a quick test with Fibery scripting

const fibery = context.getService('fibery');

for (const entity of args.currentEntities) {
    const content = '<div>Description<br/></div><ul dir="ltr"><li>Bullet 1<br/></li><li>Bullet 2</li></ul><div><br/></div>';
    await fibery.setDocumentContent(entity['Description']['Secret'], content, 'html');
}

and the output was rendered pretty much as I would expect:

1 Like

I also tested via a POST to the documents API:

https://acme.fibery.io/api/documents/commands?format=html

{
  "command": "create-or-update-documents",
  "args": [
    {
      "secret": "91dc8478-1a3c-4b1a-9ba1-2d57a32ad6b1",
      "content": "<div>Description<br/></div><ul dir=\"ltr\"><li>Bullet 1<br/></li><li>Bullet 2</li></ul><div><br/></div>"
    }
  ]
}

and the result was the same.

However, note that I had to escape the double quote in the <ul dir="ltr"> part since JSON does not like double quotes in a string.

I suggest you check if the content is being correctly JSON encoded.

Note that it is also valid HTML to use single-quotes instead of double-quotes for parameter values - hopefully Fibery can handle this variation.

E.g.,

"content": "<div>Description<br/></div><ul dir='ltr'> ..."
1 Like

This worked for me, using single quotes

1 Like