REST API Create note for contact with attachment

Note: Just for information, uploading files is a native Redmine feature and is described here.

To create a note for a contact via API it is necessary to send POST request to http://redmine.site/notes.json with below params:

{
  "note": {
    "type_id": "1", // note: nil, email: 0, call: 1, meeting: 2
    "note_time": "21:30",
    "content": "Test note with call type" 
  },
  "project_id": "<PROJECT_IDENTIFIER>",
  "source_id": "<CONTACT_ID>",
  "source_type": "Contact" 
}

To create a note with attachment, it is also needed to send `POST`request to `http://redmine.site/notes.json`but with additional params from uploaded file response:

{
    "note": {
        "type_id": "1", // note: nil, email: 0, call: 1, meeting: 2
        "note_time": "21:30",
        "content": "Test call with attachment" 
    },
    "project_id": "<PROJECT_IDENTIFIER>",
    "source_id": "<CONTACT_ID>",
    "source_type": "Contact",
    "attachments": {
        "1": {
            "filename": "test-image.jpg",
            "description": "",
            "token": "<TOKEN_FROM_UPLOAD_RESPONSE>" 
        }
    }
}

An example could be checked below.

example_note_contact_attachment.png

Was this article helpful? Yes  No