SDK reference

Storage

Each route's function in the SDK, its call beside the same request in cURL.
orgStorage

GET/v1/orgs/:orgId/storage

The org's buckets with their latest daily size and object count.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/storage' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgStorageByResourceId

GET/v1/orgs/:orgId/storage/:resourceId

A bucket record with its versioning status and latest daily usage.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgStorageObjects

GET/v1/orgs/:orgId/storage/:resourceId/objects

One level of the bucket: folders (common prefixes) and files under prefix.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/objects' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgStorageObject

GET/v1/orgs/:orgId/storage/:resourceId/object

One file's size, type, modification time and metadata.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/object?key=example' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgStorageDownload

GET/v1/orgs/:orgId/storage/:resourceId/download

A download link valid for five minutes. versionId downloads an earlier version.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/download?key=example' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgStorageObjectVersions

GET/v1/orgs/:orgId/storage/:resourceId/object/versions

Every version and delete marker of one file, newest first (versioned buckets).

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/object/versions?key=example' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postOrgStorageObjectRestore

POST/v1/orgs/:orgId/storage/:resourceId/object/restore

Makes an earlier version of a file current again (copied on top, so history is kept). With the newest delete marker of a deleted file, removes the marker and so brings the file back.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/object/restore' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "key": "example",
    "versionId": "<versionId>"
  }'
postOrgStorageObjectVersionsDelete

POST/v1/orgs/:orgId/storage/:resourceId/object/versions/delete

Deletes one version of a file for good; its other versions stay.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/object/versions/delete' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "key": "example",
    "versionId": "<versionId>"
  }'
orgStorageDeleted

GET/v1/orgs/:orgId/storage/:resourceId/deleted

Deleted files in one folder of a versioned bucket (their newest version is a delete marker).

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/deleted' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postOrgStorageObjectsMove

POST/v1/orgs/:orgId/storage/:resourceId/objects/move

Moves or renames files and folders (copy, then delete the original); never overwrites. Folders move in batches: done: false means call again with the same moves and resume: true.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/objects/move' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "files": [
      {
        "from": "example",
        "to": "example"
      }
    ],
    "folders": [
      {
        "from": "example",
        "to": "example"
      }
    ],
    "resume": false
  }'
postOrgStorageUploadsMultipart

POST/v1/orgs/:orgId/storage/:resourceId/uploads/multipart

Starts a multipart upload for a large file (up to 5 TB): the part size and how many parts to send.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/uploads/multipart' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "key": "example",
    "contentType": "example",
    "size": 1
  }'
postOrgStorageUploadsMultipartParts

POST/v1/orgs/:orgId/storage/:resourceId/uploads/multipart/parts

Upload links (15 minutes) for parts of a multipart upload; the browser PUTs each part and keeps its ETag.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/uploads/multipart/parts' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "key": "example",
    "uploadId": "<uploadId>",
    "partNumbers": [
      1
    ]
  }'
postOrgStorageUploadsMultipartComplete

POST/v1/orgs/:orgId/storage/:resourceId/uploads/multipart/complete

Finishes a multipart upload from its parts' numbers and ETags.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/uploads/multipart/complete' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "key": "example",
    "uploadId": "<uploadId>",
    "parts": [
      {
        "partNumber": 1,
        "etag": "example"
      }
    ]
  }'
postOrgStorageUploadsMultipartAbort

POST/v1/orgs/:orgId/storage/:resourceId/uploads/multipart/abort

Cancels a multipart upload and discards the parts sent so far.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/uploads/multipart/abort' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "key": "example",
    "uploadId": "<uploadId>"
  }'
postOrgStorageUploads

POST/v1/orgs/:orgId/storage/:resourceId/uploads

Upload links (PUT, 15 minutes, up to 5 GB each). The browser sends each file straight to S3.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/uploads' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "files": [
      {
        "key": "example",
        "contentType": "example",
        "size": 1
      }
    ]
  }'
postOrgStorageFolders

POST/v1/orgs/:orgId/storage/:resourceId/folders

Creates an empty folder under prefix.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/folders' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Example"
  }'
postOrgStorageObjectsDelete

POST/v1/orgs/:orgId/storage/:resourceId/objects/delete

Deletes files and folders (with everything in them). done: false means call again to finish large folders.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/objects/delete' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "keys": [],
    "prefixes": []
  }'
orgStorageSettings

GET/v1/orgs/:orgId/storage/:resourceId/settings

CORS rules, versioning and lifecycle rules.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/settings' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
putOrgStorageCors

PUT/v1/orgs/:orgId/storage/:resourceId/cors

Replaces the bucket's CORS rules (Cloud's upload rule is kept separately).

Parameters and answers
curl -X PUT 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/cors' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "rules": [
      {
        "AllowedOrigins": [
          "example"
        ],
        "AllowedMethods": [
          "GET"
        ]
      }
    ]
  }'
putOrgStorageVersioning

PUT/v1/orgs/:orgId/storage/:resourceId/versioning

Turns versioning on, or suspends it.

Parameters and answers
curl -X PUT 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/versioning' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "enabled": true
  }'
postOrgStorageLifecycle

POST/v1/orgs/:orgId/storage/:resourceId/lifecycle

Adds a rule that deletes files under a prefix a number of days after they're written.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/lifecycle' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "days": 1
  }'
deleteOrgStorageLifecycleByRuleId

DELETE/v1/orgs/:orgId/storage/:resourceId/lifecycle/:ruleId

Removes a lifecycle rule.

Parameters and answers
curl -X DELETE 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}/lifecycle/{ruleId}' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
deleteOrgStorageByResourceId

DELETE/v1/orgs/:orgId/storage/:resourceId

Deletes an empty bucket (old versions of deleted files go with it) and its record.

Parameters and answers
curl -X DELETE 'https://api.cactive.com.au/v1/orgs/{orgId}/storage/{resourceId}' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"