Create

Create a new attachment

ParameterMandatoryDescriptionExamplesMore Info
APIYesThe API areaattachments.json
GeneralYesParameters described in overviewuser=user&password=user&version=3.9Overview
ActionYesThe action to performaction=create
InputYesJSON stringSee below
JSON InputMandatoryDescriptionExamples
IdentifierYesActivity ID or UUID"attachmentActivityID":"7160"
attachmentOriginalFilenameYesOriginal file name"attachmentOriginalFilename":"My attachment.csv"
attachmentBase64Only for non-S3 systemsBase 64 string"attachmentBase64": "SEVSRSBJUyBTT01FIFRFWFQNCg=="
attachmentDescriptionNoAttachment description"attachmentDescription":"My special attachment"

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 request:

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

Example response:
##Non-S3 Version

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

S3 Version

{
  "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
    }
  ]
}