Access API provides access to the content collection for a storage unit. Content can be fetched by key. Content 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, all scopes are returned.
Fetch
Fetches a single record from the content database by the record key. If a scope is provided, only this scope will be included in the content response.
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.
{ "version": 1447374169544, "content": { "ocr": {...} }, "key": "667E2D4E4344AE4813AD719B88D14EC6" }
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 from the content database by the records keys. If a scope is provided, only this scope will be included in the content response.
Request
The fetch multiple GET request requires the name of the storage unit and optionally the scope can be provided. The keys are passed in the keys parameter as a comma separated list of values.
GET access/fetchMultiple/<storage-unit-name>/<optional:scope>?keys=key1,key2,key3
The fetch multiple POST request requires the name of the storage unit and optionally the scope can be provided. The keys are passed in the JSON body keys field as an array of values.
POST access/fetchMultiple/<storage-unit-name>/<optional:scope>
{ "keys": [ "addff324e6d09222031f87da77854d84", "addff324e6d09222031f87da77854d88", "addff324e6d09222031f87da77854d74" ] }
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.
[ { "version": 1447374169544, "content": { "ocr": {...} }, "key": "667E2D4E4344AE4813AD719B88D14EC6" }, { "version": 1447374169198, "content": { "ocr": {...} }, "key": "E0F57D337D5021236E353C7AB305F147" } ]
Fetch Page
Fetches a page of data from a storage unit. Use this to fetch all content 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.
Request
The fetch page GET/POST request requires the storage unit name and optionally the scope. Parameters startId and batchSize are optional.
POST access/fetchPage/<storage-unit-name>/<optional:scope>?startId=123456&batchSize=20
Response
Fetch page responds with a 200 response code and the content of X (batchSize) elements from the storage unit. If more items are available a nextPageStartId field is also part of the response. Use this value as the startId to retrieve the next page of content.
{ "records": [ { "key": "123451", "content": { "connector": { ... } } }, ..., { "key": "123458", "content": { "connector": { ... } } } ], "nextPageStartId": "123465" }