I am trying to upload a file to a rich text field on a sharepoint list using the REST API. In other words, trying to mimic the behaviour of the 'Upload File' option on the Insert tab of the ribbon when editing the field.
I am optimistically trying to do this is in the same way I would update any other field on a sharepoint list i.e. by POSTing to the /lists/getbytitle('ListName')/items(ID) endpoint and including the field name / file content in some JSON in the body of the request. I've tried various encoding of the file content before passing it in, and also different headers / header values to no avail. I am consistently getting a 500 code response with message 'Offset outside string'. I thought this might have something to do with the Content-Length header, whose value I have set to the length of the file, but apparently not
I don't know if the Rest API allows you to do this? If it does, can anyone provide some pointers on the correct configuration of the call?