Storage

The storage data API provides full access to the data stored in the Flow database.

Members

Batch create

Requires authorization

Creates multiple objects of a given class.

Request

POST /api/v1/storage/data/{object-class}/batch

Payload

[
    {
        ... (custom fields, depending on object definition)
    },
    ...
]
Response

Status Codes

  • 200 - success
  • 400 - bad request, response containg details
  • 404 - class does not exist
  • 401 - provided token is not valid

Payload

[
    url of newly created object as string,
    ...
]

Batch update

Requires authorization

Updates multiple objects of a given class.

Request

PUT /api/v1/storage/data/{object-class}/batch

Payload

[
    {
        "_id": "object id",
        ... (custom fields, depending on object definition)
    },
    ...
]
Response

Status Codes

  • 200 - success
  • 400 - bad request, response containg details
  • 404 - class does not exist
  • 401 - provided token is not valid

Create object attachment

Requires authorization

Create attachment for specified object.

Request

POST /api/v1/storage/data/{object-class}/{object-id}/attachments/{attachment-name}

Payload
Request body should contain base64 encoded content of the file.

Response

Status Codes

  • 200 - created
  • 404 - bad request, response contains details
  • 404 - attachment, object or class does not exist
  • 401 - provided token is not valid

Payload
Response header Location contains the URL of the created attachment.

Create single object

Requires authorization

Create single object for a given class.

Request

POST /api/v1/storage/data/{object-class}/

Payload

{
    ... (custom fields, depending on object definition)
}
Response

Status Codes

  • 200 - created
  • 400 - bad request, response contains details
  • 404 - class does not exist
  • 401 - provided token is not valid

Payload
Response header Location contains the URL of the created object.

Delete object attachment

Requires authorization

Delete object attachment.

Request

DELETE /api/v1/storage/data/{object-class}/{object-id}/attachments/{attachment-name}

Response

Status Codes

  • 200 - success
  • 404 - attachment, object or class does not exist
  • 401 - provided token is not valid

Delete single object

Requires authorization

Deletes existing object of a given class and id.

Request

DELETE /api/v1/storage/data/{object-class}/{object-id}

Response

Status Codes

  • 200 - success
  • 404 - object or class does not exist
  • 401 - provided token is not valid

Retrieve object attachment

Requires authorization

Returns object attachment by name.

Request

GET /api/v1/storage/data/{object-class}/{object-id}/attachments/{attachment-name}

Response

Status Codes

  • 200 - success
  • 404 - attachment, object or class does not exist
  • 401 - provided token is not valid

Payload
Response contains binary data of attachment. Content-Type header corresponds to attachment type.

Retrieve objects

Requires authorization

Retrieve objects of a given class.

Request

GET /api/v1/storage/data/{object-class}/

Request Parameters

  • limit - max number of objects to return on one page
  • page - number of page
  • query - query filter as JSON in following format: {fieldname: {operator: value}}, where
    • fieladname is object field
    • operator is one of $eq, $neq, $gt, $gte, $lt, $lte, $in, $nin
    • value is anything
Response

Status Codes

  • 200 - success
  • 404 - class does not exist
  • 401 - provided token is not valid

Payload

{
    "metadata": {
        "page": number of current page,
        "pages": total number of pages,
    },
    "objects": [
        {
            "_id": object id,
            "attachments": [
                {
                    "url": url of attachment file,
                    "name": name of attachment file,
                    "mime_type": content type,
                    "size": size in bytes
                },
                ...
            ],
            ... (other custom fields, depending on object definition)
        }
    ]
}

Retrieve single object

Requires authorization

Retrieve object of a given class by id.

Request

GET /api/v1/storage/data/{object-class}/{object-id}

Response

Status Codes

  • 200 - success
  • 404 - object or class does not exist
  • 401 - provided token is not valid

Payload

{
    "_id": object id,
    "attachments": [
        {
            "url": url of attachment file,
            "name": name of attachment file,
            "mime_type": content type,
            "size": size in bytes
        },
        ...
    ],
    ... (other custom fields, depending on object definition)
}

Update object attachment

Requires authorization

Update object attachment.

Request

PUT /api/v1/storage/data/{object-class}/{object-id}/attachments/{attachment-name}

Payload
Request body should contain base64 encoded content of the file.

Response

Status Codes

  • 200 - success
  • 404 - bad request, response contains details
  • 404 - attachment, object or class does not exist
  • 401 - provided token is not valid

Update single object

Requires authorization

Updates existing object of a given class and id.

Request

PUT /api/v1/storage/data/{object-class}/{object-id}

Payload

{
    ... (custom fields, depending on object definition)
}
Response

Status Codes

  • 200 - success
  • 400 - bad request, response contains details
  • 404 - object or class does not exist
  • 401 - provided token is not valid