📣 We're Hiring!

Uploading file via API V8 to Documents module

Hello,

Is it possible to upload a file via API to a Case? I created a Case and while editing in SuiteCRM panel i tried to add a file on field “Updates - Attachment form” to see the value that it gets from postman when retrieving that Case but nothing changed at all.

Thanks.

I assume the same for the API but the upload file button on the interface is a bit broken and it is best to upload and relate a document or note instead

1 Like

Do you know if there’s any correct guide on how to upload a file via API? All i have found are kind of not working.

Also while creating a Document via API with just some info on the request am getting an error of "“detail”: “Notes module with id cb08e375-d6ca-4c4c-941d-5ef2fa18c511 is not found”, which that id is the id of the document which was created a while ago.

Are documents and notes somehow related to each other?

Here’s an example used with postman

Request

POST {{suitecrm.url}}/V8/module

Body

{
  "data": {
    "type": "Document",
    "attributes": {
      "name": "New Document",
         "filename":"image.jpg",
      "filecontents": ""
    }
  }
}

With the body you

have sent, this is the following message on the call
filecontents is invalid in module Document.

Request is the same as you wrote on your comment.

What i have done so far is that i can create a Document with this body:

{
“data”: {
“type”: “Document”,
“attributes”: {
“name”: “suitecrm”,
“filename”:“suitecrm”,
“document_name”: “suitecrm”,
“doc_url”: “https://images.unsplash.com/photo-1494548162494-384bba4ab999?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80
}
}
}

After this call am getting the error 400 : Notes module with id db20f96f-171d-4511-4e6a-5ef439898823 is not found. But document still gets created. And it’s the only way to attach a file and working to see that in CRM by adding doc_url, otherwise document is broken.