Upload file

Initiate Upload

curl -i -X POST "https://example.ziik.io/api/upload"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
  -d "{ [...] }"

The above command returns 201 Created on success

HTTP/1.0 201 Created
{
    'uuid': 'AB3432BAF',
    'key': '/autogenerated,
    'url': 'https://s3.bucket.host/path?withArguments=true',
    'headers': {
        'x-amz-acl': [
          'private'
        ],
        'Content-Type': 'application/pdf'
    },
    'file': 1234,
}

This endpoint adds files to an existing entity.

HTTP Request

POST https://example.ziik.io/api/upload

Request Parameters

ParameterTypeRequiredDescription
idIntegerYesThe ID of the entity to add files to
typeStringYesThe type of entity - contents, users, units, see below
content_typeStringYesMimetype of the file to be uploaded
filenameStringYesFile name.

Entity Types

ValueDescription
usersUser profile
unitsUnit profile
departmentsDepartment profile
paragraphsHandbook paragraph
groupsDiscussion group
foldersDocument folder
contentsNews story, debate, event, manual, faq
commentsComment
messagesChat message
logoSite logo
mobile_logoLogo for mobile apps
mobile_bgBackground image for mobile apps home screen
suppliersSupplier attached files
supplier_imageSupplier image

Permissions Required

  • Edit access to the entity

Upload the file

curl -i -X PUT "https://s3.bucket.host/path?withArguments=true"
  -H "[HEADERS FROM INITIATION]"
  -d [FILEDATA]

The above command returns a 201 Created header on success:

HTTP/1.0 201 Created

This endpoint receives the upload of the actual file. It is direct upload to an S3 compatible service, so more information is available at Amazon Web Servicesopen in new window

HTTP Request

PUT https://s3.bucket.host/path?withArguments=true

Prerequisites

  • A url from the file upload initiation process

Finalise Upload

curl -i -X POST "https://example.ziik.io/api/file/1234/finalise"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
  -d "{ [...] }"

The above command returns 204 No Content on success

HTTP/1.0 204 No Content

This endpoint finalises the upload, registering the upload and begins the processing of the file, if applicable (e.g. transcoding a video)

HTTP Request

POST https://example.ziik.io/api/file/ID/finalise

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the file to finalise

Request Parameters

ParameterTypeRequiredDescription
keyStringYesValidation key from the initiation process
Contributors: Christian Gerdes