Page tree
Skip to end of metadata
Go to start of metadata

Access API provides access to the records of a storage unit. Records can be fetched by key. Records can contain one or more scopes, the access API allows to fetch a single scope for the record(s) requested. If the special $record scope is used or no scope is provided, all scopes are returned.

Fetch


Fetches a single record by key from the storage unit. If the special $record scope is used or no scope is provided, all scopes are returned. If the zone for the key is not specified as a prefix for the key, the local zone is used.


On this page:

Request

The fetch GET/POST request requires the name of the storage unit and the key to fetch. Optionally the scope can be provided.

GET access/fetch/<storage-unit-name>/<record-key>/<optional:scope>

Response

If the key exists, returns a 200 response code and the content record with the specified scope for the key.

{
    "key": "<record-key>",
	"content": {
        "<scope>": {...}
    }
}
 

If the key doesn't exist, a 400 response code and a KEY_NOT_FOUND message is returned.

{"message": "KEY_NOT_FOUND"}
 

Fetch Multiple


Fetches one or more records by keys from the storage unit by the records keys. If the special $record scope is used or no scope is provided, all scopes are returned. If the zone for the key is not specified as a prefix for the key, the local zone is used.

Request

The fetch multiple request requires the name of the storage unit and optionally the scope can be provided.

In the GET request, the keys are passed in the keys parameter as a comma separated list of values.

GET access/fetchMultiple/<storage-unit-name>/<optional:scope>?keys=APP_ZONE:667E2D4E4344AE4813AD719B88D14EC6,APP_ZONE:E0F57D337D5021236E353C7AB305F147
 

In the POST request, the keys are passed in the JSON body keys field as an array of values.

POST access/fetchMultiple/<storage-unit-name>/<optional:scope>
{
    "keys": [
        "APP_ZONE:667E2D4E4344AE4813AD719B88D14EC6",
        "APP_ZONE:E0F57D337D5021236E353C7AB305F147"
    ]
}


Response

Returns a 200 response code and an array of records with the specified scope for each key that matched the fetch query, or an empty array if non matched.

[
    {
        "key": "APP_ZONE:667E2D4E4344AE4813AD719B88D14EC6",
        "content": {
            "<scope>": {...}
        }
    },
    {
        "key": "APP_ZONE:E0F57D337D5021236E353C7AB305F147",
        "content": {
            "<scope>": {...}
        }
    }
]

Fetch Page


Fetches a batch of records of a specific zone from a storage unit sorted by record key. 

Request

The fetch page GET/POST request requires the storage unit name and optionally the scope. Parameters startId (Optional: mongo record id. If not specified, the first page of data will be returned. Use the last id of the returned page as the startId for the next page request), size (10 by default) and zone (local zone by default).

POST access/fetchPage/<storage-unit-name>/<optional:scope>?startId=123456&size=20

Response

Fetch page returns a 200 response code and a response body with a records array with batchSize number of records from zone of the storage unit starting at element startId. To check if more items are available send a new fetchPage request with the last _id of the page's list as the new startId, if the result is an empty array, you have reached the end of the storage unit.

[
  {
    "key": "APP_ZONE:1234567",
    "version": 3,
    "content": {
      "<scope>": {
        "doc": {
          "test": "value 3"
        }
      }
    },
    "_id": "58793d3e7536e718b41fcf62"
  },
  {
    "key": "APP_ZONE:1234568",
    "version": 3,
    "content": {
      "<scope>": {
        "doc": {
          "test": "value 2"
        }
      }
    },
    "_id": "58793d3f7536e718b41fcf65"
  },
  {
    "key": "APP_ZONE:1234569",
    "version": 4,
    "content": {
      "<scope>": {
        "doc": {
          "test": "value 3"
        }
      }
    },
    "_id": "58793d3f7536e718b41fcf67"
  }
]

Fetch all records by zone

Fetch Page can be used to fetch all records from a storage unit.

  1. Call fetch page without a startId. This will return the first batch of records of size from the storage unit sorted by _id.
  2. Make subsequent calls with the last _id of the array as the startId
  3. Finish when page response returns an empty array.

Get File


Downloads a file attached to a file scope of a record key in a storage unit.

Request

The get file GET request requires the storage unit name, the record key, the file scope and the file name to download (See putFile for upload info).

GET access/getFile/<storage-unit>/<record-key>/<scope>/<file-name>

Response

File is downloaded as a stream of bytes.

If the file doesn't exist, a 400 response code is returned and a FILE_NOT_FOUND message.


Get File Metadata


Returns the metadata associated with the requested file.

Request

The get file metadata GET request requires the storage unit name, the record key, the file scope and the file name (See putFile for upload info).

GET access/getFileMetadata/<storage-unit>/<record-key>/<scope>/<file-name>

Response

Returns a 200 response code and a JSON body with the file metadata.

{
	"title": "Logo",
	"description": "logo-small"
}

If the file doesn't exist, a 400 response code is returned and a FILE_NOT_FOUND message.




  • No labels