Outdated version

You are browsing the docs for Nexus v1.7.x, the latest release is available here

Files

Files are attachment resources rooted in the /v1/files/{org_label}/{project_label}/ collection.

Each file belongs to a project identifier by the label {project_label} inside an organization identifier by the label {org_label}.

Authorization notes

When creating, updating and reading files, the caller must have the permissions defined on the storage associated to the file on the current path of the project or the ancestor paths.

Please visit Authentication & authorization section to learn more about it.

Indexing

All the API calls modifying a file (creation, update, tagging, deprecation) can specify whether the file should be indexed synchronously or in the background. This behaviour is controlled using indexing query param, which can be one of two values:

  • async - (default value) the file will be indexed asynchronously
  • sync - the file will be indexed synchronously and the API call won’t return until the indexing is finished

Create using POST

POST /v1/files/{org_label}/{project_label}?storage={storageId}

… where {storageId} selects a specific storage backend where the file will be uploaded. This field is optional. When not specified, the default storage of the project is used.

The json payload:

  • If the @id value is found on the payload, this @id will be used.
  • If the @id value is not found on the payload, an @id will be generated as follows: base:{UUID}. The base is the prefix defined on the resource’s project ({project_label}).

Example

Request
sourcecurl -X POST \
     -F "file=@/path/to/myfile.jpg;type=image/jpeg" \
     "http://localhost:8080/v1/files/myorg/myproject"
Response
source{
  "@context": [
    "https://bluebrain.github.io/nexus/contexts/files.json",
    "https://bluebrain.github.io/nexus/contexts/metadata.json"
  ],
  "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/c581fdd4-6151-4430-aa33-f97ab6aa0b38",
  "@type": "File",
  "_bytes": 8615,
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/files.json",
  "_createdAt": "2021-05-12T07:28:30.472Z",
  "_createdBy": "http://localhost:8080/v1/anonymous",
  "_deprecated": false,
  "_digest": {
    "_algorithm": "SHA-256",
    "_value": "057a3811ecfbeb99506c538d42474d1916f1d9b66965b9e9378a00eab1bb913a"
  },
  "_filename": "myfile.jpg",
  "_incoming": "http://localhost:8080/v1/files/myorg/myproject/c581fdd4-6151-4430-aa33-f97ab6aa0b38/incoming",
  "_mediaType": "image/jpeg",
  "_origin": "Client",
  "_outgoing": "http://localhost:8080/v1/files/myorg/myproject/c581fdd4-6151-4430-aa33-f97ab6aa0b38/outgoing",
  "_project": "http://localhost:8080/v1/projects/myorg/myproject",
  "_rev": 1,
  "_self": "http://localhost:8080/v1/files/myorg/myproject/c581fdd4-6151-4430-aa33-f97ab6aa0b38",
  "_storage": {
    "@id": "https://bluebrain.github.io/nexus/vocabulary/diskStorageDefault",
    "@type": "DiskStorage",
    "_rev": 1
  },
  "_updatedAt": "2021-05-12T07:28:30.472Z",
  "_updatedBy": "http://localhost:8080/v1/anonymous",
  "_uuid": "9af35be9-b2f2-4734-9646-c3423a62685d"
}

Create using PUT

This alternative endpoint to create a resource is useful in case the json payload does not contain an @id but you want to specify one. The @id will be specified in the last segment of the endpoint URI.

PUT /v1/files/{org_label}/{project_label}/{file_id}?storage={storageId}

… where {storageId} selects a specific storage backend where the file will be uploaded. This field is optional. When not specified, the default storage of the project is used.

Note that if the payload contains an @id different from the {file_id}, the request will fail.

Example

Request
sourcecurl -X PUT \
     -F "file=@/path/to/myfile.pdf;type=application/pdf" \
     "http://localhost:8080/v1/files/myorg/myproject/myfile?storage=remote"
Response
source{
  "@context": [
    "https://bluebrain.github.io/nexus/contexts/files.json",
    "https://bluebrain.github.io/nexus/contexts/metadata.json"
  ],
  "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/myfile",
  "@type": "File",
  "_bytes": 5963969,
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/files.json",
  "_createdAt": "2021-05-12T07:30:54.576Z",
  "_createdBy": "http://localhost:8080/v1/anonymous",
  "_deprecated": false,
  "_digest": {
    "_algorithm": "SHA-256",
    "_value": "d14a7cb4602a2c6e1e7035809aa319d07a6d3c58303ecce7804d2e481cd4965f"
  },
  "_filename": "myfile.pdf",
  "_incoming": "http://localhost:8080/v1/files/myorg/myproject/myfile/incoming",
  "_location": "file:///tmp/test/nexus/myorg/myproject/c/b/5/c/4/d/8/e/myfile.pdf",
  "_mediaType": "application/pdf",
  "_origin": "Client",
  "_outgoing": "http://localhost:8080/v1/files/myorg/myproject/myfile/outgoing",
  "_project": "http://localhost:8080/v1/projects/myorg/myproject",
  "_rev": 1,
  "_self": "http://localhost:8080/v1/files/myorg/myproject/myfile",
  "_storage": {
    "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/remote",
    "@type": "RemoteDiskStorage",
    "_rev": 1
  },
  "_updatedAt": "2021-05-12T07:30:54.576Z",
  "_updatedBy": "http://localhost:8080/v1/anonymous",
  "_uuid": "cb5c4d8e-0189-49ab-b761-c92b2d4f49d2"
}

Link using POST

Brings a file existing in a storage to Nexus Delta as a file resource. This operation is supported for files using S3Storage and RemoteDiskStorage.

POST /v1/files/{org_label}/{project_label}?storage={storageId}
  {
    "path": "{path}",
    "filename": "{filename}",
    "mediaType": "{mediaType}"
  }
  • {storageId}: String - Selects a specific storage backend that supports linking existing files. This field is optional. When not specified, the default storage of the project is used.
  • {path}: String - the relative location (from the point of view of storage folder) on the remote storage where the file exists.
  • {filenane}: String - the name that will be given to the file during linking. This field is optional. When not specified, the original filename is retained.
  • {mediaType}: String - the MediaType fo the file. This field is optional. When not specified, Nexus Delta will attempt to detectput

Example

Request
sourcecurl -X POST \
   -H "Content-Type: application/json" \
   "http://localhost:8080/v1/files/myorg/myproject?storage=remote" -d \
   '{
      "path": "relative/path/to/myfile.png",
      "filename": "myfile.png",
      "mediaType": "image/png"
   }'
Payload
source{
  "path": "relative/path/to/myfile.png",
  "filename": "myfile.png",
  "mediaType": "image/png"
}
Response
source{
  "@context": [
    "https://bluebrain.github.io/nexus/contexts/files.json",
    "https://bluebrain.github.io/nexus/contexts/metadata.json"
  ],
  "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/9ca0d270-35f0-4369-9c17-296fe36fd9a5",
  "@type": "File",
  "_bytes": 1658857,
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/files.json",
  "_createdAt": "2021-05-12T07:56:42.991Z",
  "_createdBy": "http://localhost:8080/v1/anonymous",
  "_deprecated": false,
  "_digest": {
    "_value": ""
  },
  "_filename": "myfile.png",
  "_incoming": "http://localhost:8080/v1/files/myorg/myproject/9ca0d270-35f0-4369-9c17-296fe36fd9a5/incoming",
  "_location": "file:///tmp/test/nexus/myorg/myproject/3/4/c/4/9/1/a/1/myfile.png",
  "_mediaType": "image/png",
  "_origin": "Storage",
  "_outgoing": "http://localhost:8080/v1/files/myorg/myproject/9ca0d270-35f0-4369-9c17-296fe36fd9a5/outgoing",
  "_project": "http://localhost:8080/v1/projects/myorg/myproject",
  "_rev": 1,
  "_self": "http://localhost:8080/v1/files/myorg/myproject/9ca0d270-35f0-4369-9c17-296fe36fd9a5",
  "_storage": {
    "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/remote",
    "@type": "RemoteDiskStorage",
    "_rev": 1
  },
  "_updatedAt": "2021-05-12T07:56:42.991Z",
  "_updatedBy": "http://localhost:8080/v1/anonymous",
  "_uuid": "34c491a1-17ba-4726-bdf2-3b4e1e150750"
}

Link using PUT

Brings a file existing in a storage to Nexus Delta as a file resource. This operation is supported for files using S3Storage and RemoteDiskStorage.

This alternative endpoint allows to specify the resource @id.

PUT /v1/files/{org_label}/{project_label}/{file_id}?storage={storageId}
  {
    "path": "{path}",
    "filename": "{filename}",
    "mediaType": "{mediaType}"
  }

… where

  • {storageId}: String - Selects a specific storage backend that supports linking existing files. This field is optional. When not specified, the default storage of the project is used.
  • {path}: String - the relative location (from the point of view of the storage folder) on the remote storage where the file exists.
  • {filenane}: String - the name that will be given to the file during linking. This field is optional. When not specified, the original filename is retained.
  • {mediaType}: String - the MediaType fo the file. This field is optional. When not specified, Nexus Delta will attempt to detect it.

Example

Request
sourcecurl -X PUT \
   -H "Content-Type: application/json" \
   "http://localhost:8080/v1/files/myorg/myproject/mylink?storage=remote" -d \
   '{
      "path": "relative/path/to/myfile2.png"
   }'
Payload
source{
  "path": "relative/path/to/myfile2.png"
}
Response
source{
  "@context": [
    "https://bluebrain.github.io/nexus/contexts/files.json",
    "https://bluebrain.github.io/nexus/contexts/metadata.json"
  ],
  "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/mylink",
  "@type": "File",
  "_bytes": 1658857,
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/files.json",
  "_createdAt": "2021-05-12T08:00:34.563Z",
  "_createdBy": "http://localhost:8080/v1/anonymous",
  "_deprecated": false,
  "_digest": {
    "_value": ""
  },
  "_filename": "myfile2.png",
  "_incoming": "http://localhost:8080/v1/files/myorg/myproject/mylink/incoming",
  "_location": "file:///tmp/test/nexus/myorg/myproject/6/6/0/4/9/9/d/9/myfile2.png",
  "_origin": "Storage",
  "_outgoing": "http://localhost:8080/v1/files/myorg/myproject/mylink/outgoing",
  "_project": "http://localhost:8080/v1/projects/myorg/myproject",
  "_rev": 1,
  "_self": "http://localhost:8080/v1/files/myorg/myproject/mylink",
  "_storage": {
    "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/remote",
    "@type": "RemoteDiskStorage",
    "_rev": 1
  },
  "_updatedAt": "2021-05-12T08:00:34.563Z",
  "_updatedBy": "http://localhost:8080/v1/anonymous",
  "_uuid": "660499d9-c522-4f90-beda-2d79e538ffce"
}

Update

This operation overrides the file content.

In order to ensure a client does not perform any changes to a file without having had seen the previous revision of the file, the last revision needs to be passed as a query parameter.

PUT /v1/files/{org_label}/{project_label}/{resource_id}?rev={previous_rev}

… where {previous_rev} is the last known revision number for the resource.

Example

Request
sourcecurl -X PUT \
   -F "file=@/path/to/myfile2.pdf;type=application/pdf" \
   "http://localhost:8080/v1/files/myorg/myproject/myfile?rev=1"
Response
source{
  "@context": [
    "https://bluebrain.github.io/nexus/contexts/files.json",
    "https://bluebrain.github.io/nexus/contexts/metadata.json"
  ],
  "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/myfile",
  "@type": "File",
  "_bytes": 13896460,
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/files.json",
  "_createdAt": "2021-05-12T07:30:54.576Z",
  "_createdBy": "http://localhost:8080/v1/anonymous",
  "_deprecated": false,
  "_digest": {
    "_algorithm": "SHA-256",
    "_value": "4c9f4292e3c0c5fc23cd60722adb8a1535f1dd7f0cf9203140d61fb889eef3cf"
  },
  "_filename": "myfile2.pdf",
  "_incoming": "http://localhost:8080/v1/files/myorg/myproject/myfile/incoming",
  "_mediaType": "application/pdf",
  "_origin": "Client",
  "_outgoing": "http://localhost:8080/v1/files/myorg/myproject/myfile/outgoing",
  "_project": "http://localhost:8080/v1/projects/myorg/myproject",
  "_rev": 2,
  "_self": "http://localhost:8080/v1/files/myorg/myproject/myfile",
  "_storage": {
    "@id": "https://bluebrain.github.io/nexus/vocabulary/diskStorageDefault",
    "@type": "DiskStorage",
    "_rev": 1
  },
  "_updatedAt": "2021-05-12T08:04:08.440Z",
  "_updatedBy": "http://localhost:8080/v1/anonymous",
  "_uuid": "3e86d93a-c196-407d-a13c-cea7168e32e3"
}

Tag

Links a file revision to a specific name.

Tagging a file is considered to be an update as well.

POST /v1/files/{org_label}/{project_label}/{file_id}/tags?rev={previous_rev}
  {
    "tag": "{name}",
    "rev": {rev}
  }

… where

  • {previous_rev}: is the last known revision number for the file.
  • {name}: String - label given to the file at specific revision.
  • {rev}: Number - the revision to link the provided {name}.

Example

Request
sourcecurl -X POST \
   -H "Content-Type: application/json" \
   "http://localhost:8080/v1/files/myorg/myproject/myfile/tags?rev=2" -d \
  '{
    "tag": "mytag",
    "rev": 1
  }'
Payload
source{
  "tag": "mytag",
  "rev": 1
}
Response
source{
  "@context": [
    "https://bluebrain.github.io/nexus/contexts/files.json",
    "https://bluebrain.github.io/nexus/contexts/metadata.json"
  ],
  "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/myfile",
  "@type": "File",
  "_bytes": 13896460,
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/files.json",
  "_createdAt": "2021-05-12T07:30:54.576Z",
  "_createdBy": "http://localhost:8080/v1/anonymous",
  "_deprecated": false,
  "_digest": {
    "_algorithm": "SHA-256",
    "_value": "4c9f4292e3c0c5fc23cd60722adb8a1535f1dd7f0cf9203140d61fb889eef3cf"
  },
  "_filename": "myfile2.pdf",
  "_incoming": "http://localhost:8080/v1/files/myorg/myproject/myfile/incoming",
  "_mediaType": "application/pdf",
  "_origin": "Client",
  "_outgoing": "http://localhost:8080/v1/files/myorg/myproject/myfile/outgoing",
  "_project": "http://localhost:8080/v1/projects/myorg/myproject",
  "_rev": 3,
  "_self": "http://localhost:8080/v1/files/myorg/myproject/myfile",
  "_storage": {
    "@id": "https://bluebrain.github.io/nexus/vocabulary/diskStorageDefault",
    "@type": "DiskStorage",
    "_rev": 1
  },
  "_updatedAt": "2021-05-12T08:07:55.442Z",
  "_updatedBy": "http://localhost:8080/v1/anonymous",
  "_uuid": "3e86d93a-c196-407d-a13c-cea7168e32e3"
}

Remove tag

Removes a given tag.

Removing a tag is considered to be an update as well.

DELETE /v1/files/{org_label}/{project_label}/{file_id}/tags/{tag_name}?rev={previous_rev}

… where

  • {previous_rev}: is the last known revision number for the resource.
  • {tag_name}: String - label of the tag to remove.

Example

Request
sourcecurl -X DELETE \
     "http://localhost:8080/v1/files/myorg/myproj/myfile/tags/mytag?rev=2"
Response
source{
  "@context": [
    "https://bluebrain.github.io/nexus/contexts/files.json",
    "https://bluebrain.github.io/nexus/contexts/metadata.json"
  ],
  "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/myfile",
  "@type": "File",
  "_bytes": 13896460,
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/files.json",
  "_createdAt": "2021-05-12T07:30:54.576Z",
  "_createdBy": "http://localhost:8080/v1/anonymous",
  "_deprecated": false,
  "_digest": {
    "_algorithm": "SHA-256",
    "_value": "4c9f4292e3c0c5fc23cd60722adb8a1535f1dd7f0cf9203140d61fb889eef3cf"
  },
  "_filename": "myfile2.pdf",
  "_incoming": "http://localhost:8080/v1/files/myorg/myproject/myfile/incoming",
  "_mediaType": "application/pdf",
  "_origin": "Client",
  "_outgoing": "http://localhost:8080/v1/files/myorg/myproject/myfile/outgoing",
  "_project": "http://localhost:8080/v1/projects/myorg/myproject",
  "_rev": 3,
  "_self": "http://localhost:8080/v1/files/myorg/myproject/myfile",
  "_storage": {
    "@id": "https://bluebrain.github.io/nexus/vocabulary/diskStorageDefault",
    "@type": "DiskStorage",
    "_rev": 1
  },
  "_updatedAt": "2021-05-12T08:07:55.442Z",
  "_updatedBy": "http://localhost:8080/v1/anonymous",
  "_uuid": "3e86d93a-c196-407d-a13c-cea7168e32e3"
}

Deprecate

Locks the file, so no further operations can be performed.

Deprecating a file is considered to be an update as well.

DELETE /v1/files/{org_label}/{project_label}?rev={previous_rev}

… where {previous_rev} is the last known revision number for the file.

Example

Request
sourcecurl -X DELETE \
   "http://localhost:8080/v1/files/myorg/myproject/myfile?rev=3"
Response
source{
  "@context": [
    "https://bluebrain.github.io/nexus/contexts/files.json",
    "https://bluebrain.github.io/nexus/contexts/metadata.json"
  ],
  "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/myfile",
  "@type": "File",
  "_bytes": 13896460,
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/files.json",
  "_createdAt": "2021-05-12T07:30:54.576Z",
  "_createdBy": "http://localhost:8080/v1/anonymous",
  "_deprecated": true,
  "_digest": {
    "_algorithm": "SHA-256",
    "_value": "4c9f4292e3c0c5fc23cd60722adb8a1535f1dd7f0cf9203140d61fb889eef3cf"
  },
  "_filename": "myfile2.pdf",
  "_incoming": "http://localhost:8080/v1/files/myorg/myproject/myfile/incoming",
  "_mediaType": "application/pdf",
  "_origin": "Client",
  "_outgoing": "http://localhost:8080/v1/files/myorg/myproject/myfile/outgoing",
  "_project": "http://localhost:8080/v1/projects/myorg/myproject",
  "_rev": 4,
  "_self": "http://localhost:8080/v1/files/myorg/myproject/myfile",
  "_storage": {
    "@id": "https://bluebrain.github.io/nexus/vocabulary/diskStorageDefault",
    "@type": "DiskStorage",
    "_rev": 1
  },
  "_updatedAt": "2021-05-12T08:09:23.658Z",
  "_updatedBy": "http://localhost:8080/v1/anonymous",
  "_uuid": "3e86d93a-c196-407d-a13c-cea7168e32e3"
}

Fetch

When fetching a file, the response format can be chosen through HTTP content negotiation. In order to fetch the file metadata, the client can use any of the following MIME types. However, in order to fetch the file content, the HTTP Accept header */* (or any MIME type that matches the file MediaType) should be provided.

GET /v1/files/{org_label}/{project_label}/{file_id}?rev={rev}&tag={tag}

where …

  • {rev}: Number - the targeted revision to be fetched. This field is optional and defaults to the latest revision.
  • {tag}: String - the targeted tag to be fetched. This field is optional.

{rev} and {tag} fields cannot be simultaneously present.

Example

Request (binary)
sourcecurl -o myfile2.pdf \
   -H "Accept: */*" \
   "http://localhost:8080/v1/files/myorg/myproject/myfile"
Request (metadata)
sourcecurl -H "Accept: application/ld+json" \
   "http://localhost:8080/v1/files/myorg/myproject/myfile"
Response (metadata)
source{
  "@context": [
    "https://bluebrain.github.io/nexus/contexts/files.json",
    "https://bluebrain.github.io/nexus/contexts/metadata.json"
  ],
  "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/myfile",
  "@type": "File",
  "_bytes": 13896460,
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/files.json",
  "_createdAt": "2021-05-12T07:30:54.576Z",
  "_createdBy": "http://localhost:8080/v1/anonymous",
  "_deprecated": true,
  "_digest": {
    "_algorithm": "SHA-256",
    "_value": "4c9f4292e3c0c5fc23cd60722adb8a1535f1dd7f0cf9203140d61fb889eef3cf"
  },
  "_filename": "myfile2.pdf",
  "_incoming": "http://localhost:8080/v1/files/myorg/myproject/myfile/incoming",
  "_mediaType": "application/pdf",
  "_origin": "Client",
  "_outgoing": "http://localhost:8080/v1/files/myorg/myproject/myfile/outgoing",
  "_project": "http://localhost:8080/v1/projects/myorg/myproject",
  "_rev": 4,
  "_self": "http://localhost:8080/v1/files/myorg/myproject/myfile",
  "_storage": {
    "@id": "https://bluebrain.github.io/nexus/vocabulary/diskStorageDefault",
    "@type": "DiskStorage",
    "_rev": 1
  },
  "_updatedAt": "2021-05-12T08:09:23.658Z",
  "_updatedBy": "http://localhost:8080/v1/anonymous",
  "_uuid": "3e86d93a-c196-407d-a13c-cea7168e32e3"
}

Fetch tags

Retrieves all the tags available for the {file_id}.

GET /v1/files/{org_label}/{project_label}/{file_id}/tags?rev={rev}&tag={tag}

where …

  • {rev}: Number - the targeted revision of the tags to be fetched. This field is optional and defaults to the latest revision.
  • {tag}: String - the targeted tag of the tags to be fetched. This field is optional.

{rev} and {tag} fields cannot be simultaneously present.

Example

Request
sourcecurl "http://localhost:8080/v1/files/myorg/myproject/myfile/tags"
Response
source{
  "@context": "https://bluebrain.github.io/nexus/contexts/tags.json",
  "tags": [
    {
      "rev": 1,
      "tag": "mytag"
    }
  ]
}

List

There are three available endpoints to list files in different scopes.

Within a project

GET /v1/files/{org_label}/{project_label}?from={from}
                                         &size={size}
                                         &deprecated={deprecated}
                                         &rev={rev}
                                         &type={type}
                                         &createdBy={createdBy}
                                         &updatedBy={updatedBy}
                                         &q={search}
                                         &sort={sort}

Within an organization

This operation returns only files from projects defined in the organisation {org_label} and where the caller has the resources/read permission.

GET /v1/files/{org_label}?from={from}
                         &size={size}
                         &deprecated={deprecated}
                         &rev={rev}
                         &type={type}
                         &createdBy={createdBy}
                         &updatedBy={updatedBy}
                         &q={search}
                         &sort={sort}

Within all projects

This operation returns only files from projects where the caller has the resources/read permission.

GET /v1/files?from={from}
             &size={size}
             &deprecated={deprecated}
             &rev={rev}
             &type={type}
             &createdBy={createdBy}
             &updatedBy={updatedBy}
             &q={search}
             &sort={sort}

Parameter description

  • {from}: Number - is the parameter that describes the offset for the current query; defaults to 0
  • {size}: Number - is the parameter that limits the number of results; defaults to 20
  • {deprecated}: Boolean - can be used to filter the resulting files based on their deprecation status
  • {rev}: Number - can be used to filter the resulting files based on their revision value
  • {type}: Iri - can be used to filter the resulting files based on their @type value. This parameter can appear multiple times, filtering further the @type value.
  • {createdBy}: Iri - can be used to filter the resulting files based on their creator
  • {updatedBy}: Iri - can be used to filter the resulting files based on the person which performed the last update
  • {search}: String - can be provided to select only the files in the collection that have attribute values matching (containing) the provided string
  • {sort}: String - can be used to sort files based on a payloads’ field. This parameter can appear multiple times to enable sorting by multiple fields. The default is done by _createdBy and @id.

Example

Request
sourcecurl "http://localhost:8080/v1/files/myorg/myproject?deprecated=false"
Response
source{
  "@context": [
    "https://bluebrain.github.io/nexus/contexts/metadata.json",
    "https://bluebrain.github.io/nexus/contexts/search.json",
    "https://bluebrain.github.io/nexus/contexts/search-metadata.json"
  ],
  "_total": 3,
  "_results": [
    {
      "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/c581fdd4-6151-4430-aa33-f97ab6aa0b38",
      "@type": "File",
      "_bytes": 8615,
      "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/files.json",
      "_createdAt": "2021-05-12T07:28:30.472Z",
      "_createdBy": "http://localhost:8080/v1/anonymous",
      "_deprecated": false,
      "_digest": {
        "_algorithm": "SHA-256",
        "_value": "057a3811ecfbeb99506c538d42474d1916f1d9b66965b9e9378a00eab1bb913a"
      },
      "_filename": "myfile.jpg",
      "_incoming": "http://localhost:8080/v1/files/myorg/myproject/c581fdd4-6151-4430-aa33-f97ab6aa0b38/incoming",
      "_mediaType": "image/jpeg",
      "_outgoing": "http://localhost:8080/v1/files/myorg/myproject/c581fdd4-6151-4430-aa33-f97ab6aa0b38/outgoing",
      "_project": "http://localhost:8080/v1/projects/myorg/myproject",
      "_rev": 1,
      "_self": "http://localhost:8080/v1/files/myorg/myproject/c581fdd4-6151-4430-aa33-f97ab6aa0b38",
      "_storage": {
        "@id": "https://bluebrain.github.io/nexus/vocabulary/diskStorageDefault",
        "@type": "DiskStorage",
        "_rev": 1
      },
      "_updatedAt": "2021-05-12T07:28:30.472Z",
      "_updatedBy": "http://localhost:8080/v1/anonymous",
      "_uuid": "9af35be9-b2f2-4734-9646-c3423a62685d"
    },
    {
      "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/9ca0d270-35f0-4369-9c17-296fe36fd9a5",
      "@type": "File",
      "_bytes": 1658857,
      "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/files.json",
      "_createdAt": "2021-05-12T07:56:42.991Z",
      "_createdBy": "http://localhost:8080/v1/anonymous",
      "_deprecated": false,
      "_digest": {
        "_algorithm": "SHA-256",
        "_value": "e88fd2d76dd7c1a144c68e89a38c972251623dacf4c898154aae4c3b03eb4a84"
      },
      "_filename": "myfile.png",
      "_incoming": "http://localhost:8080/v1/files/myorg/myproject/9ca0d270-35f0-4369-9c17-296fe36fd9a5/incoming",
      "_location": "file:///tmp/test/nexus/myorg/myproject/3/4/c/4/9/1/a/1/myfile.png",
      "_mediaType": "image/png",
      "_outgoing": "http://localhost:8080/v1/files/myorg/myproject/9ca0d270-35f0-4369-9c17-296fe36fd9a5/outgoing",
      "_project": "http://localhost:8080/v1/projects/myorg/myproject",
      "_rev": 2,
      "_self": "http://localhost:8080/v1/files/myorg/myproject/9ca0d270-35f0-4369-9c17-296fe36fd9a5",
      "_storage": {
        "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/remote",
        "@type": "RemoteDiskStorage",
        "_rev": 1
      },
      "_updatedAt": "2021-05-12T07:56:48.380Z",
      "_updatedBy": "http://localhost:8080/v1/anonymous",
      "_uuid": "34c491a1-17ba-4726-bdf2-3b4e1e150750"
    },
    {
      "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/mylink",
      "@type": "File",
      "_bytes": 1658857,
      "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/files.json",
      "_createdAt": "2021-05-12T08:00:34.563Z",
      "_createdBy": "http://localhost:8080/v1/anonymous",
      "_deprecated": false,
      "_digest": {
        "_algorithm": "SHA-256",
        "_value": "e88fd2d76dd7c1a144c68e89a38c972251623dacf4c898154aae4c3b03eb4a84"
      },
      "_filename": "myfile2.png",
      "_incoming": "http://localhost:8080/v1/files/myorg/myproject/mylink/incoming",
      "_location": "file:///tmp/test/nexus/myorg/myproject/6/6/0/4/9/9/d/9/myfile2.png",
      "_mediaType": "image/png",
      "_outgoing": "http://localhost:8080/v1/files/myorg/myproject/mylink/outgoing",
      "_project": "http://localhost:8080/v1/projects/myorg/myproject",
      "_rev": 2,
      "_self": "http://localhost:8080/v1/files/myorg/myproject/mylink",
      "_storage": {
        "@id": "http://localhost:8080/v1/resources/myorg/myproject/_/remote",
        "@type": "RemoteDiskStorage",
        "_rev": 1
      },
      "_updatedAt": "2021-05-12T08:00:40.790Z",
      "_updatedBy": "http://localhost:8080/v1/anonymous",
      "_uuid": "660499d9-c522-4f90-beda-2d79e538ffce"
    }
  ]
}

Server Sent Events

From Delta 1.5, it is possible to fetch SSEs for all files or just files in the scope of an organization or a project.

GET /v1/files/events                              # for all file events in the application
GET /v1/files/{org_label}/events                  # for file events in the given organization
GET /v1/files/{org_label}/{project_label}/events  # for file events in the given project

The caller must have respectively the events/read permission on /, {org_label} and {org_label}/{project_label}.

  • {org_label}: String - the selected organization for which the events are going to be filtered
  • {project_label}: String - the selected project for which the events are going to be filtered
  • Last-Event-Id: String - optional HTTP Header that identifies the last consumed resource event. It can be used for cases when a client does not want to retrieve the whole event stream, but to start after a specific event.
Note

The event type for files SSEs have been changed so that it is easier to distinguish them from other types of resources.

Example

Request
sourcecurl -H "Last-Event-Id: fc6078f0-b2f3-11eb-96af-ed7fe24c2ccf" \
   "http://localhost:8080/v1/files/myorg/myproject/events"
Response
sourcedata:{"@context":["https://bluebrain.github.io/nexus/contexts/metadata.json","https://bluebrain.github.io/nexus/contexts/files.json"],"@type":"FileCreated","_attributes":{"_bytes":1658857,"_digest":{"_value":""},"_filename":"myfile.png","_location":"file:///tmp/test/nexus/myorg/myproject/3/4/c/4/9/1/a/1/myfile.png","_mediaType":"image/png","_origin":"Storage","_uuid":"34c491a1-17ba-4726-bdf2-3b4e1e150750"},"_fileId":"http://localhost:8080/v1/resources/myorg/myproject/_/9ca0d270-35f0-4369-9c17-296fe36fd9a5","_instant":"2021-05-12T07:56:42.991Z","_organizationUuid":"eeeb1e5e-1773-4a87-bf24-5412918a5938","_project":"http://localhost:8080/v1/projects/myorg/myproject","_projectUuid":"7422af2a-8d64-4a6f-adfc-c1b4efb89f68","_resourceId":"http://localhost:8080/v1/resources/myorg/myproject/_/9ca0d270-35f0-4369-9c17-296fe36fd9a5","_rev":1,"_storage":{"@id":"http://localhost:8080/v1/resources/myorg/myproject/_/remote","@type":"RemoteDiskStorage","_resourceId":"http://localhost:8080/v1/resources/myorg/myproject/_/remote","_rev":1},"_subject":"http://localhost:8080/v1/anonymous"}
event:FileCreated
id:9750c010-b2f7-11eb-96af-ed7fe24c2ccf

data:{"@context":["https://bluebrain.github.io/nexus/contexts/metadata.json","https://bluebrain.github.io/nexus/contexts/files.json"],"@type":"FileAttributesUpdated","_bytes":1658857,"_digest":{"_algorithm":"SHA-256","_value":"e88fd2d76dd7c1a144c68e89a38c972251623dacf4c898154aae4c3b03eb4a84"},"_fileId":"http://localhost:8080/v1/resources/myorg/myproject/_/9ca0d270-35f0-4369-9c17-296fe36fd9a5","_instant":"2021-05-12T07:56:48.380Z","_mediaType":"image/png","_organizationUuid":"eeeb1e5e-1773-4a87-bf24-5412918a5938","_project":"http://localhost:8080/v1/projects/myorg/myproject","_projectUuid":"7422af2a-8d64-4a6f-adfc-c1b4efb89f68","_resourceId":"http://localhost:8080/v1/resources/myorg/myproject/_/9ca0d270-35f0-4369-9c17-296fe36fd9a5","_rev":2,"_subject":"http://localhost:8080/v1/anonymous"}
event:FileAttributesUpdated
id:9a8229e0-b2f7-11eb-96af-ed7fe24c2ccf

data:{"@context":["https://bluebrain.github.io/nexus/contexts/metadata.json","https://bluebrain.github.io/nexus/contexts/files.json"],"@type":"FileCreated","_attributes":{"_bytes":1658857,"_digest":{"_value":""},"_filename":"myfile2.png","_location":"file:///tmp/test/nexus/myorg/myproject/6/6/0/4/9/9/d/9/myfile2.png","_origin":"Storage","_uuid":"660499d9-c522-4f90-beda-2d79e538ffce"},"_fileId":"http://localhost:8080/v1/resources/myorg/myproject/_/mylink","_instant":"2021-05-12T08:00:34.563Z","_organizationUuid":"eeeb1e5e-1773-4a87-bf24-5412918a5938","_project":"http://localhost:8080/v1/projects/myorg/myproject","_projectUuid":"7422af2a-8d64-4a6f-adfc-c1b4efb89f68","_resourceId":"http://localhost:8080/v1/resources/myorg/myproject/_/mylink","_rev":1,"_storage":{"@id":"http://localhost:8080/v1/resources/myorg/myproject/_/remote","@type":"RemoteDiskStorage","_resourceId":"http://localhost:8080/v1/resources/myorg/myproject/_/remote","_rev":1},"_subject":"http://localhost:8080/v1/anonymous"}
event:FileCreated
id:21564eb0-b2f8-11eb-96af-ed7fe24c2ccf

data:{"@context":["https://bluebrain.github.io/nexus/contexts/metadata.json","https://bluebrain.github.io/nexus/contexts/files.json"],"@type":"FileAttributesUpdated","_bytes":1658857,"_digest":{"_algorithm":"SHA-256","_value":"e88fd2d76dd7c1a144c68e89a38c972251623dacf4c898154aae4c3b03eb4a84"},"_fileId":"http://localhost:8080/v1/resources/myorg/myproject/_/mylink","_instant":"2021-05-12T08:00:40.790Z","_mediaType":"image/png","_organizationUuid":"eeeb1e5e-1773-4a87-bf24-5412918a5938","_project":"http://localhost:8080/v1/projects/myorg/myproject","_projectUuid":"7422af2a-8d64-4a6f-adfc-c1b4efb89f68","_resourceId":"http://localhost:8080/v1/resources/myorg/myproject/_/mylink","_rev":2,"_subject":"http://localhost:8080/v1/anonymous"}
event:FileAttributesUpdated
id:2508f670-b2f8-11eb-96af-ed7fe24c2ccf

data:{"@context":["https://bluebrain.github.io/nexus/contexts/metadata.json","https://bluebrain.github.io/nexus/contexts/files.json"],"@type":"FileUpdated","_attributes":{"_bytes":13896460,"_digest":{"_algorithm":"SHA-256","_value":"4c9f4292e3c0c5fc23cd60722adb8a1535f1dd7f0cf9203140d61fb889eef3cf"},"_filename":"myfile2.pdf","_mediaType":"application/pdf","_origin":"Client","_uuid":"3e86d93a-c196-407d-a13c-cea7168e32e3"},"_fileId":"http://localhost:8080/v1/resources/myorg/myproject/_/myfile","_instant":"2021-05-12T08:04:08.440Z","_organizationUuid":"eeeb1e5e-1773-4a87-bf24-5412918a5938","_project":"http://localhost:8080/v1/projects/myorg/myproject","_projectUuid":"7422af2a-8d64-4a6f-adfc-c1b4efb89f68","_resourceId":"http://localhost:8080/v1/resources/myorg/myproject/_/myfile","_rev":2,"_storage":{"@id":"https://bluebrain.github.io/nexus/vocabulary/diskStorageDefault","@type":"DiskStorage","_resourceId":"https://bluebrain.github.io/nexus/vocabulary/diskStorageDefault","_rev":1},"_subject":"http://localhost:8080/v1/anonymous"}
event:FileUpdated
id:a0cdd690-b2f8-11eb-96af-ed7fe24c2ccf

data:{"@context":["https://bluebrain.github.io/nexus/contexts/metadata.json","https://bluebrain.github.io/nexus/contexts/files.json"],"@type":"FileTagAdded","tag":"mytag","targetRev":1,"_fileId":"http://localhost:8080/v1/resources/myorg/myproject/_/myfile","_instant":"2021-05-12T08:07:55.442Z","_organizationUuid":"eeeb1e5e-1773-4a87-bf24-5412918a5938","_project":"http://localhost:8080/v1/projects/myorg/myproject","_projectUuid":"7422af2a-8d64-4a6f-adfc-c1b4efb89f68","_resourceId":"http://localhost:8080/v1/resources/myorg/myproject/_/myfile","_rev":3,"_subject":"http://localhost:8080/v1/anonymous"}
event:FileTagAdded
id:281b9830-b2f9-11eb-96af-ed7fe24c2ccf

data:{"@context":["https://bluebrain.github.io/nexus/contexts/metadata.json","https://bluebrain.github.io/nexus/contexts/files.json"],"@type":"FileDeprecated","_fileId":"http://localhost:8080/v1/resources/myorg/myproject/_/myfile","_instant":"2021-05-12T08:09:23.658Z","_organizationUuid":"eeeb1e5e-1773-4a87-bf24-5412918a5938","_project":"http://localhost:8080/v1/projects/myorg/myproject","_projectUuid":"7422af2a-8d64-4a6f-adfc-c1b4efb89f68","_resourceId":"http://localhost:8080/v1/resources/myorg/myproject/_/myfile","_rev":4,"_subject":"http://localhost:8080/v1/anonymous"}
event:FileDeprecated
id:5cb049b0-b2f9-11eb-96af-ed7fe24c2ccf