Listing Content Information

A Generic, General Purpose Research Data Repository Service.

Listing Content Information

If you just uploaded the data you still have the data access URL in the Location header of the upload response. However, if you are not the uploader you have to check first, which files are associated with a resource in order to obtain a data access URL before download. This can be done by submitting an HTTP GET request to an arbitraty ‘virtual folder’ as shown in the next example.

$ curl 'http://localhost:8080/api/v1/dataresources/edbf964c-f215-4fc6-9ef1-2ff1ea5a811e/data/' -i -X GET \
    -H 'Accept: application/vnd.datamanager.content-information+json'

This request will return all content information associated with the addressed resource as we perform a listing of the root data folder. By providing the Accept header with a value ‘application/vnd.datamanager.content-information+json’ we ask for ContentInformation metadata as we’ve learned before. Currently, it is NOT possible to access a ‘virtual folder’ without providing this header.

GET /api/v1/dataresources/edbf964c-f215-4fc6-9ef1-2ff1ea5a811e/data/ HTTP/1.1
Accept: application/vnd.datamanager.content-information+json
Host: localhost:8080

In the response we get all ContentInformation entries starting with the accessed path. As we provided the root path of the resource’s data, we receive all three content elements we’ve uploaded until now.

HTTP/1.1 200 OK
Content-Type: application/vnd.datamanager.content-information+json
Content-Length: 2149

[ {
  "id" : 1,
  "parentResource" : {
    "id" : "edbf964c-f215-4fc6-9ef1-2ff1ea5a811e",
    "identifier" : {
      "value" : "(:tba)",
      "identifierType" : "DOI"
    },
    "alternateIdentifiers" : [ {
      "value" : "edbf964c-f215-4fc6-9ef1-2ff1ea5a811e",
      "identifierType" : "INTERNAL"
    } ]
  },
  "relativePath" : "randomFile.txt",
  "version" : 1,
  "fileVersion" : "1",
  "versioningService" : "simple",
  "depth" : 1,
  "contentUri" : "file:/tmp/repo-basepath/2022/2/25/edbf964cf2154fc69ef12ff1ea5a811e/randomFile.txt_1648212427612",
  "uploader" : "SELF",
  "mediaType" : "text/plain",
  "hash" : "sha1:4c29d7ed12eb7e0308a595ddaaf2b79a5a14bf2c",
  "size" : 64,
  "metadata" : { },
  "tags" : [ ],
  "filename" : "randomFile.txt"
}, {
  "id" : 2,
  "parentResource" : {
    "id" : "edbf964c-f215-4fc6-9ef1-2ff1ea5a811e",
    "identifier" : {
      "value" : "(:tba)",
      "identifierType" : "DOI"
    },
    "alternateIdentifiers" : [ {
      "value" : "edbf964c-f215-4fc6-9ef1-2ff1ea5a811e",
      "identifierType" : "INTERNAL"
    } ]
  },
  "relativePath" : "randomFile2.txt",
  "version" : 1,
  "fileVersion" : "1",
  "versioningService" : "none",
  "depth" : 1,
  "contentUri" : "file:/tmp/repo-basepath/2022/2/25/edbf964cf2154fc69ef12ff1ea5a811e/randomFile2.txt_1648212427903",
  "mediaType" : "text/plain",
  "hash" : "sha1:4c29d7ed12eb7e0308a595ddaaf2b79a5a14bf2c",
  "size" : 64,
  "metadata" : {
    "test" : "ok"
  },
  "tags" : [ ],
  "filename" : "randomFile2.txt"
}, {
  "id" : 3,
  "parentResource" : {
    "id" : "edbf964c-f215-4fc6-9ef1-2ff1ea5a811e",
    "identifier" : {
      "value" : "(:tba)",
      "identifierType" : "DOI"
    },
    "alternateIdentifiers" : [ {
      "value" : "edbf964c-f215-4fc6-9ef1-2ff1ea5a811e",
      "identifierType" : "INTERNAL"
    } ]
  },
  "relativePath" : "referencedContent",
  "version" : 1,
  "fileVersion" : "1",
  "versioningService" : "none",
  "depth" : 1,
  "contentUri" : "https://www.google.com",
  "size" : 0,
  "metadata" : { },
  "tags" : [ ],
  "filename" : "referencedContent"
} ]

Listing ContentInformation also support pagination. Furthermore, the results are sorted by their depth within the entire hierarchy of the resource’s content. This means, when listing the root folder of a complex content hierarchy, you’ll first receive all elements directly located at the root folder followed by all elements located in folders of the first hierarchy level and so on.

In addition, you can provide a tag as query argument in order to return only elements having this tag assigned. This allows you to overlay different hierarchies easily and perform a very selective listing of elements.