einue
einue

Reputation: 27

REST API, POST Rich Text Item to Domino server

i am trying to use the REST-API of my domino lotus notes server (9.0.1FP8)

It works for simple text-fields but if I try to add an rich-text-item as json, the domino server receives only the text-fields and the richt-text field is empty.

I try it with Postman and a Postrequest to http://localhost/Test/JSON_Vie…s/name/List?form=mainForm, where I send the json

{
    "title":"test rich text",
    "artist":"rich texter",
    "ntracks":1,
    "attachments": {
        "type": "multipart",
        "content": [
            {
                "contentType": "multipart/alternative; Boundary=\"0__=4EBB0925DFBB40F18f9e8a93df938690918c4EBB0925DFBB40F1\"",
                "contentDisposition": "inline"
            },
            {
                "contentType": "text/plain; charset=US-ASCII",
                "data": "test rich text",
                "boundary": "--0__=4EBB0925DFBB40F18f9e8a93df938690918c4EBB0925DFBB40F1"
            },
            {
                "contentType": "text/html; charset=US-ASCII",
                "contentDisposition": "inline",
                "data": "<html><body><font size=\"2\" face=\"sans-serif\"><b>test rich text</b></font></body></html>",
                "boundary": "--0__=4EBB0925DFBB40F18f9e8a93df938690918c4EBB0925DFBB40F1"
            }
        ]
    }
}

The mask mainForm has the text-fields "title", "artist" , "ntracks" and the rich text-field "attachments".

How can I send an image as json and what is "boundary"?

Have you any idea , what's going wrong?

Upvotes: 1

Views: 1658

Answers (2)

einue
einue

Reputation: 27

After experimenting a little bit, I now know what was wrong. If I do the POST on the address http://localhost/Test/JSON_Views.nsf/api/data/documents?form=mainForm it works with the attachment. If I use http://localhost/Test/JSON_Views.nsf/api/data/collections/name/List?form=mainForm&computewithform=true the attachment field is ignored. But maybe you can explain me, what the extra field boundary is and if I can set the contentLocation by the name of my attachment?

Upvotes: 0

Per Henrik Lausten
Per Henrik Lausten

Reputation: 21709

According to the documentation from IBM you need to use PUT (instead of POST) in order to update the fields.

Upvotes: 2

Related Questions