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

Storage Values API

Elvin Morales edited this page Jan 24, 2019 · 1 revision

Put value by collectionId and key

PUT /v1/collections/<collectionId>/values/<key>

Saves a value by collectionId and Key. Body of the request is of the format: { "data":"data to store" }

Response

  • Returns 200 OK and list of device objects:
{
    "$metadata": {
        "$type": "Value;1",
        "$modified": "...",
        "$uri": "/v1/collections/test/values/filename"
    },
    "Key": "filename",
    "Data": "data to store",
    "ETag": "\"...\""
}
  • Status Code 400 - Empty or invalid collection id or key. Valid characters are a-Z,A-Z,0-9,_ and -.

Put value by collectionId and randomly generated key

POST /v1/collections/<collectionId>/values/

Saves a value by collectionId and assigned a randomly generated key. Body of the request is of the format: { "data":"data to store" }

Response

  • Returns 200 OK and list of device objects:
{
    "$metadata": {
        "$type": "Value;1",
        "$modified": "...",
        "$uri": "/v1/collections/test/values/filename"
    },
    "Key": "randomGUID",
    "Data": "data to store",
    "ETag": "\"...\""
}
  • Status Code 400 - Empty or invalid collection id or key. Valid characters are a-Z,A-Z,0-9,_ and -.

Get value for given collectionId and key

GET /v1/collections/<collectionId>/values/<key>

Retrieves the value for a given collection and key.

Response

  • Returns 200 OK and list of device objects:
{
    "$metadata": {
        "$type": "Value;1",
        "$modified": "...",
        "$uri": "/v1/collections/test/values/filename"
    },
    "Key": "filename",
    "Data": "data to store",
    "ETag": "\"...\""
}
  • Status Code 400 - Empty or invalid collection id or key. Valid characters are a-Z,A-Z,0-9,_ and -.
  • Status Code 404 - If collection or key is not found.

Get value for given collectionId and key

GET /v1/collections/<collectionId>/values

Retrieves the all of the values under a given collection.

Response

  • Status Code 200 - Returns list of all values :
{
    "Items": [
        {
            "$metadata": {
                "$type": "Value;1",
                "$modified": "...",
                "$uri": "/v1/collections/test/values/key1"
            },
            "Key": "key1",
            "Data": "data to store",
            "ETag": "\"...\""
        }
    ],
    "$metadata": {
        "$type": "ValueList;1",
        "$uri": "/v1/collections/test/values"
    }
}
  • Status Code 400 - Empty or invalid collection id. Valid characters are a-Z,A-Z,0-9,_ and -.

Delete value from storage

DELETE /v1/collections/<collectionId>/values/<key>

Response

  • Status Code 200 - Value has been deleted or didn't exist
  • Status Code 400 - Empty or invalid collection id or key. Valid characters are a-Z,A-Z,0-9,_ and -.