Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Access API provides access to the content collection for records of a storage unit. Content Records can be fetched by key. Content records 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 content database by the record key. If a scope is provided, only this scope will be included in the content responsestorage 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.

Request

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

...

Code Block
languagejs
themeRDark
{
    "versionkey": 1447374169544"<record-key>",
    	"content": {
        "ocr<scope>": {...}
    },
    "key": "667E2D4E4344AE4813AD719B88D14EC6"
}
 

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

...

Fetches one or more records by keys from the content database storage unit by the records keys. If a  If the special $record scope is used or no scope is provided, only this scope will be included in the content responseall 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 GET request requires the name of the storage unit and optionally the scope can be provided. The

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

Code Block
languagejs
themetextRDark
GET access/fetchMultiple/<storage-unit-name>/<optional:scope>?keys=key1,key2,key3APP_ZONE:667E2D4E4344AE4813AD719B88D14EC6,APP_ZONE:E0F57D337D5021236E353C7AB305F147
 

The fetch multiple In the POST request requires the name of the storage unit and optionally the scope can be provided. The , the keys are passed in the JSON body keys field as an array of values.

Code Block
languagejs
themeRDarktext
POST access/fetchMultiple/<storage-unit-name>/<optional:scope>

...

languagejs
themeRDark

{
    "keys": [
        "

...

APP_ZONE:667E2D4E4344AE4813AD719B88D14EC6",
        "

...

APP_ZONE:E0F57D337D5021236E353C7AB305F147"
    ]
}

 

Response

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

Code Block
languagejs
themeRDark
[
    {
        "versionkey": 1447374169544"APP_ZONE:667E2D4E4344AE4813AD719B88D14EC6",
        "content": {
            "ocr<scope>": {...}
        },
        "key": "667E2D4E4344AE4813AD719B88D14EC6"
    },
    {
        "versionkey": 1447374169198"APP_ZONE:E0F57D337D5021236E353C7AB305F147",
        "content": {
            "ocr<scope>": {...}
        },
        "key": "E0F57D337D5021236E353C7AB305F147"
    }
]

Fetch Page

Fetches a page batch of records of data from a storage unit. Use this to fetch all content a specific zone from a storage unit . First call without a startId will return the first X (batchSize) elements of the content source sorted by key and a reference to the startId for the next page. Make subsequent calls with the startId of the previous request. Last page doesn't contain a next page startId.record key. 

Request

The fetch page GET/POST request requires the storage unit name and optionally the scope. Parameters startId and batchSize are startId (first record by default), batchSize (10 by default) and zone (local zone by default) are optional.

Code Block
languagetext
POST access/fetchPage/<storage-unit-name>/<optional:scope>?startId=123456&batchSize=20

Response

Fetch page responds with returns a 200 response code and the content of X (batchSize) elements from a response body with a records array with batchSize number of records from zone of the storage unit starting at element startId. If more items are available a nextPageStartId field is also part of the response . Use this value to be used as the startId to retrieve of a subsequent call for the next page of contentrecords.

Code Block
languagejs
themeRDark
{
    "records": [
        {
            "key": "123451",
            "content": {
                "connector": {
                    ...
                }
            }
        },
        ...,
        {
            "key": "123458",
            "content": {
                "connector": {
                    ...
                }
            }
        }
    ],
    "nextPageStartId": "123465"
}

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 batchSize records of the storage unit sorted by key and a reference to the startId for the next page. 
  2. Make subsequent calls with the startId of the previous request. 
  3. Finish when page response doesn't contain a next page startId.