Create

Create a new attachment

Attachment create

Create a new attachment.

Parameter

Description

Examples

More info

API

The API area

attachments.json

Action

Defines the API

action=create

Parameters described in overview

user=user&password=user

Overview

Input

JSON string

input="data": ...

attachmentActivityID

"attachmentActivityID":"7160"

attachmentOriginalFilename

"attachmentOriginalFilename":"My attachment.csv"

required for non-S3 systems

"attachmentBase64": "SEVSRSBJUyBTT01FIFRFWFQNCg=="

attachmentDescription

"attachmentDescription":"My special attachment"

Response

Returned data

See below

Request to create an attachment

Example request:

http://<SERVER>/jsonapi/attachments.json?&user=user&password=user&version=3.3&action=create&input={"data":[{"variable_AttachmentBase64":"SEVSRSBJUyBTT01FIFRFWFQNCg==","attachmentOriginalFilename":"test.txt","attachmentDescription":"test file","attachmentActivityID":"7730"}]}

Note: Before calling this endpoint you should first ascertain if the Synergist system being accessed is using Amazon S3 to attachment storage. This can be determined by using the System API. If S3 is being used it is not necessary to pass the Base64 string. In this case the response will include the data required to perform a PUT using Amazon's API

Example response:

NON-S3

{
  "responsecode": 1,
  "responsestatus": "OK",
  "errorcode": 0,
  "errormessage": "",
  "responsemessage": "data processed successfully.",
  "warningmessage": "",
  "success": true,
  "data": [
    {
      "attachmentUuid": "B573282505218741A3E10C94CA2F6B9E",
      "attachmentID": 5505,
      "attachmentTimestampModified": 1503484169,
      "attachmentRecordVersionNumber": 0
    }
  ]
}


AMAZON S3
{
  "responsecode": 1,
  "responsestatus": "OK",
  "errorcode": 0,
  "errormessage": "",
  "responsemessage": "data processed successfully.",
  "warningmessage": "",
  "success": true,
  "data": [
    {
      "attachmentUuid": "A1715162407B834FA365854793986224",
      "attachmentID": 5554,
      "attachmentS3UrlGet": "https://syn-test.s3-eu-west-1.amazonaws.com/Jon_5554.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ7FWVT3VTEABFH7Q%2F20170908%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20170908T152018Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=a5482b5ec30f1e0396d617157aa94783e5a9ad84f22f9b35a0b80090a03e5377",
      "attachmentS3UrlPut": "https://syn-test.s3-eu-west-1.amazonaws.com/Jon_5554.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ7FWVT3VTEABFH7Q%2F20170908%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20170908T152018Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=09b766bb39b81feca02d7a653a58b56dd0c0d0ee1474881efedd99eadbb927c8",
      "attachmentTimestampModified": 1504884018,
      "attachmentRecordVersionNumber": 0
    }
  ]
}