Skip to content

Traverse a Repository


To work with a document, SEAL Operator has to have access to the document. This means that the document has to be available in the repository of an installed service such as the operator-fileupload service.


Documents contained in a repository can be found by endpoints for listing and traversing the repository. The calls to these endpoints are HTTP GET requests and, if supported by the repository, have query parameters to limit the number of results, change the sort order, skip some results or search for documents by metadata. For more information, refer to the OpenAPI specification.

Each repository has a root collection which is usually the starting point when traversing a repository.

Example - endpoint URL for listing the documents in the operator-fileupload service

/v1/services/operator-fileupload/repo/

The result contains an array of document and collection objects containing the administrative data such as the ID and the metadata. The array may be empty if no documents and collections are available.


If the repository is hierarchically structured, the root collection may contain other collections. The children of a collection can be listed with the children endpoint.

Example - endpoint URL for a collection with the ID collectionID found in the operator-fileupload service

/v1/services/operator-fileupload/repo/<collectionId>/children

The result contains an array of document and collection objects. The array may be empty if no documents or collections are available.


Code Examples

Bash

#!/bin/bash

# !Assuming $TOKEN contains a valid JWT access token!
AUTH="Authorization: Bearer $TOKEN"
JSON="Content-Type:application/json"

# list repository root
curl -k -s -X GET -H "$AUTH" -H "$JSON" "https://localhost:3008/v1/services/operator-fileupload/repo" | jq .

# list children of a collection with collection id 37a4fd08-2832-4ac8-a3d0-2684464cf1e9
curl -k -s -X GET -H "$AUTH" -H "$JSON" "https://localhost:3008/v1/services/operator-fileupload/repo/37a4fd08-2832-4ac8-a3d0-2684464cf1e9/children" | jq .

JavaScript

'use strict';

const request = require('request-promise-native');

const listDocuments = async function(token) {
  // list repository root
  let req = {
    url: 'https://localhost:3008/v1/services/operator-fileupload/repo',
    headers: {
      Authorization: `Bearer ${token}`
    },
    resolveWithFullResponse: true,
    json: true,
    strictSSL: false
  };
  let res = await request.get(req);
  console.log(JSON.stringify(res.body, null, 2));


  // list children of collection 37a4fd08-2832-4ac8-a3d0-2684464cf1e9
  req = {
    url: 'https://localhost:3008/v1/services/operator-fileupload/repo/37a4fd08-2832-4ac8-a3d0-2684464cf1e9/children',
    headers: {
      Authorization: `Bearer ${token}`
    },
    resolveWithFullResponse: true,
    json: true,
    strictSSL: false
  };
  res = await request.get(req);
  console.log(JSON.stringify(res.body, null, 2));
};

Back to top