Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Protocol Database

Rick Mak edited this page Apr 7, 2017 · 1 revision

Overview

Database Object Format

  • id (string)

    The database identifier.

    The database identifier uniquely identify a database in the container. Database identifier starting with the underscore character (_) is reserved by the system and cannot be created by the client.

  • visibility (string)

    Specify how this database is visible to other users in the container.

    One of the following:

    • public: public database

      Visible to all users in the container.

    • private: private database

      Visible only to the current user.

    • shared: shared database

      (TBD) Visible to some users. / Content subject to access control.

database:fetch

Overview

Fetch database information.

Parameters

  • access_token (string, required)

  • ids (array of strings, required)

    The identifiers of the database to fetch information for.

Returns

  • result (array of objects)

    Database objects of the specified database identifiers.

Example

curl -X POST -H "Content-Type: application/json" \
  -d @- https://example.com/api/v1/databases <<EOF
{
    "action": "database:fetch",
    "access_token": "ACCESS_TOKEN"
    "ids": ["DATABASE_ID1", "_public"]
}
EOF

{
    "result": [
        {
            "id": "DATABASE_ID1",
            "visibility": "private"
        },
        {
            "id": "_public",
            "visibility": "public"
        }
    ]
}

database:save

Overview

Create a new database.

Parameters

  • access_token (string, required)

  • database (object, required)

    The database object to be created in the container.

Returns

  • result (object)

    Database object created.

Example

curl -X POST -H "Content-Type: application/json" \
  -d @- https://example.com/api/v1 <<EOF
{
    "action": "database:save",
    "access_token": "ACCESS_TOKEN"
    "database": {
        "id": "EMwmzumyOTVp",
        "visibility": "private"
    }
}
EOF

{
    "result": {
        "id": "EMwmzumyOTVp",
        "visibility": "private"
    }
}