Resources

Generic resources are rooted in the /v1/resources/{org_label}/{project_label}/{schema_id} collection.

Each resource…

  • belongs to a project identifier by the label {project_label}
  • inside an organization identifier by the label {org_label}
  • it is validated against a schema with id {schema_id}. In case of using _ for this segment, the schema segment reads as irrelevant.

Access to resources in the system depends on the access control list set for them. Depending on the access control list, a caller may need to prove its identity by means of an access token passed to the Authorization header (Authorization: Bearer {token}). Please visit Authentication to learn more about how to retrieve an access token.

Authorization notes

When modifying resources, the caller must have resources/write permissions on the current path of the project or the ancestor paths.

When reading resources, the caller must have resources/read permissions on the current path of the project or the ancestor paths.

Create a resource using POST

POST /v1/resources/{org_label}/{project_label}/{schema_id}
  {...}

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
curl -XPOST -H "Content-Type: application/json" "https://nexus.example.com/v1/resources/myorg/myproj/myschema" -d \
'{
  "@context": {
    "ex": "http://example.com/",
    "@vocab": "http://example.com/"
  },
  "@type": "ex:Custom",
  "name": "Alex",
  "number": 24,
  "bool": false
}'
Full source at GitHub
Payload
{
  "@context": {
    "ex": "http://example.com/",
    "@vocab": "http://example.com/"
  },
  "@type": "ex:Custom",
  "name": "Alex",
  "number": 24,
  "bool": false
}
Full source at GitHub
Response
{
  "@context": "https://bluebrain.github.io/nexus/contexts/resource.json",
  "@id": "https://nexus.example.com/v1/resources/myorg/myproj/fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "@type": "http://example.com/Custom",
  "_incoming": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/incoming",
  "_outgoing": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/outgoing",
  "_self": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/resource",
  "_project": "https://nexus.example.com/v1/projects/myorg/myproj",
  "_rev": 1,
  "_deprecated": false,
  "_createdAt": "2018-09-17T14:54:42.939Z",
  "_createdBy": "https://nexus.example.com/v1/realms/myrealm/users/john",
  "_updatedAt": "2018-09-17T14:54:42.939Z",
  "_updatedBy": "https://nexus.example.com/v1/realms/myrealm/users/john"
}
Full source at GitHub

Create a resource 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/resources/{org_label}/{project_label}/{schema_id}/{resource_id}
  {...}

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

Example

Request
curl -XPUT -H "Content-Type: application/json" "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0" -d \
'{
  "@context": {
    "ex": "http://example.com/",
    "@vocab": "http://example.com/"
  },
  "@type": "ex:Custom",
  "name": "Alex",
  "number": 24,
  "bool": false
}'
Full source at GitHub
Payload
{
  "@context": {
    "ex": "http://example.com/",
    "@vocab": "http://example.com/"
  },
  "@type": "ex:Custom",
  "name": "Alex",
  "number": 24,
  "bool": false
}
Full source at GitHub
Response
{
  "@context": "https://bluebrain.github.io/nexus/contexts/resource.json",
  "@id": "https://nexus.example.com/v1/resources/myorg/myproj/fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "@type": "http://example.com/Custom",
  "_incoming": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/incoming",
  "_outgoing": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/outgoing",
  "_self": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/resource",
  "_project": "https://nexus.example.com/v1/projects/myorg/myproj",
  "_rev": 1,
  "_deprecated": false,
  "_createdAt": "2018-09-17T14:54:42.939Z",
  "_createdBy": "https://nexus.example.com/v1/realms/myrealm/users/john",
  "_updatedAt": "2018-09-17T14:54:42.939Z",
  "_updatedBy": "https://nexus.example.com/v1/realms/myrealm/users/john"
}
Full source at GitHub

Update a resource

This operation overrides the payload.

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

PUT /v1/resources/{org_label}/{project_label}/{schema_id}/{resource_id}?rev={previous_rev}
  {...}

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

Example

Request
curl -XPUT -H "Content-Type: application/json" "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0?rev=1" -d \
'{
  "@context": {
    "ex": "http://example.com/",
    "@vocab": "http://example.com/"
  },
  "@type": "ex:Custom",
  "name": "Alex",
  "number": 24,
  "bool": false
}'
Full source at GitHub
Payload
{
  "@context": {
    "ex": "http://example.com/",
    "@vocab": "http://example.com/"
  },
  "@type": "ex:Custom",
  "name": "Alex",
  "number": 24,
  "bool": false
}
Full source at GitHub
Response
{
  "@context": "https://bluebrain.github.io/nexus/contexts/resource.json",
  "@id": "https://nexus.example.com/v1/resources/myorg/myproj/fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "@type": "http://example.com/Custom",
  "_incoming": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/incoming",
  "_outgoing": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/outgoing",
  "_self": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/resource",
  "_project": "https://nexus.example.com/v1/projects/myorg/myproj",
  "_rev": 2,
  "_deprecated": false,
  "_createdAt": "2018-09-17T14:54:42.939Z",
  "_createdBy": "https://nexus.example.com/v1/realms/myrealm/users/john",
  "_updatedAt": "2018-09-17T14:56:42.939Z",
  "_updatedBy": "https://nexus.example.com/v1/realms/myrealm/users/john"
}
Full source at GitHub

Tag a resource

Links a resource revision to a specific name.

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

POST /v1/resources/{org_label}/{project_label}/{schema_id}/{resource_id}/tags?rev={previous_rev}
  {
    "tag": "{name}",
    "rev": {rev}
  }

… where

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

Example

Request
curl -XPOST -H "Content-Type: application/json" "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/tags?rev=2" -d \
'{
  "tag": "mytag",
  "rev": 1
}'
Full source at GitHub
Payload
{
  "tag": "mytag",
  "rev": 1
}
Full source at GitHub
Response
{
  "@context": "https://bluebrain.github.io/nexus/contexts/resource.json",
  "@id": "https://nexus.example.com/v1/resources/myorg/myproj/fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "@type": "http://example.com/Custom",
  "_incoming": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/incoming",
  "_outgoing": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/outgoing",
  "_self": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/resource",
  "_project": "https://nexus.example.com/v1/projects/myorg/myproj",
  "_rev": 3,
  "_deprecated": false,
  "_createdAt": "2018-09-17T14:54:42.939Z",
  "_createdBy": "https://nexus.example.com/v1/realms/myrealm/users/john",
  "_updatedAt": "2018-09-17T14:58:42.939Z",
  "_updatedBy": "https://nexus.example.com/v1/realms/myrealm/users/john"
}
Full source at GitHub

Deprecate a resource

Locks the resource, so no further operations can be performed. It also deletes the resource from listing/querying results.

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

DELETE /v1/resources/{org_label}/{project_label}/{schema_id}/{resource_id}?rev={previous_rev}

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

Example

Request
curl -XDELETE -H "Content-Type: application/json" "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0?rev=5"
Full source at GitHub
Response
{
  "@context": "https://bluebrain.github.io/nexus/contexts/resource.json",
  "@id": "https://nexus.example.com/v1/resources/myorg/myproj/fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "@type": "http://example.com/Custom",
  "_incoming": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/incoming",
  "_outgoing": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/outgoing",
  "_self": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/resource",
  "_project": "https://nexus.example.com/v1/projects/myorg/myproj",
  "_rev": 6,
  "_deprecated": true,
  "_createdAt": "2018-09-17T14:54:42.939Z",
  "_createdBy": "https://nexus.example.com/v1/realms/myrealm/users/john",
  "_updatedAt": "2018-09-17T15:02:42.939Z",
  "_updatedBy": "https://nexus.example.com/v1/realms/myrealm/users/john"
}
Full source at GitHub

Fetch a resource (current version)

GET /v1/resources/{org_label}/{project_label}/{schema_id}/{resource_id}

Example

Request
curl "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0"
Full source at GitHub
Response
{
  "@context": [
    {
      "@vocab": "http://example.com/",
      "ex": "http://example.com/"
    },
    "https://bluebrain.github.io/nexus/contexts/resource.json"
  ],
  "@id": "https://nexus.example.com/v1/resources/myorg/myproj/fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "@type": "Custom",
  "bool": false,
  "name": "Alex",
  "number": 24,
  "_incoming": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/incoming",
  "_outgoing": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/outgoing",
  "_self": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/resource",
  "_project": "https://nexus.example.com/v1/projects/myorg/myproj",
  "_rev": 4,
  "_deprecated": true,
  "_createdAt": "2018-09-17T14:54:42.939Z",
  "_createdBy": "https://nexus.example.com/v1/realms/myrealm/users/john",
  "_updatedAt": "2018-09-17T15:02:42.939Z",
  "_updatedBy": "https://nexus.example.com/v1/realms/myrealm/users/john"
}
Full source at GitHub

Fetch a resource (specific version)

GET /v1/resources/{org_label}/{project_label}/{schema_id}/{resource_id}?rev={rev}

… where {rev} is the revision number of the resource to be retrieved.

Example

Request
curl "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0?rev=4"
Full source at GitHub
Response
{
  "@context": [
    {
      "@vocab": "http://example.com/",
      "ex": "http://example.com/"
    },
    "https://bluebrain.github.io/nexus/contexts/resource.json"
  ],
  "@id": "https://nexus.example.com/v1/resources/myorg/myproj/fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "@type": "Custom",
  "bool": false,
  "name": "Alex",
  "number": 24,
  "_incoming": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/incoming",
  "_outgoing": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/outgoing",
  "_self": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/resource",
  "_project": "https://nexus.example.com/v1/projects/myorg/myproj",
  "_rev": 4,
  "_deprecated": true,
  "_createdAt": "2018-09-17T14:54:42.939Z",
  "_createdBy": "https://nexus.example.com/v1/realms/myrealm/users/john",
  "_updatedAt": "2018-09-17T15:02:42.939Z",
  "_updatedBy": "https://nexus.example.com/v1/realms/myrealm/users/john"
}
Full source at GitHub

Fetch a resource (specific tag)

GET /v1/resources/{org_label}/{project_label}/{schema_id}/{resource_id}?tag={tag}

… where {tag} is the tag of the resource to be retrieved.

Example

Request
curl "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0?tag=mytag"
Full source at GitHub
Response
{
  "@context": [
    {
      "@vocab": "http://example.com/",
      "ex": "http://example.com/"
    },
    "https://bluebrain.github.io/nexus/contexts/resource.json"
  ],
  "@id": "https://nexus.example.com/v1/resources/myorg/myproj/fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "@type": "Custom",
  "_incoming": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/incoming",
  "_outgoing": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/outgoing",
  "_self": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
  "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/resource",
  "_project": "https://nexus.example.com/v1/projects/myorg/myproj",
  "_rev": 1,
  "_deprecated": false,
  "_createdAt": "2018-09-17T14:54:42.939Z",
  "_createdBy": "https://nexus.example.com/v1/realms/myrealm/users/john",
  "_updatedAt": "2018-09-17T14:54:42.939Z",
  "_updatedBy": "https://nexus.example.com/v1/realms/myrealm/users/john"
}
Full source at GitHub

List resources

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

where…

  • {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 resources based on their deprecation status
  • {rev}: Number - can be used to filter the resulting resources based on their revision value
  • {type}: Iri - can be used to filter the resulting resources 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 resources based on their creator
  • {updatedBy}: Iri - can be used to filter the resulting resources based on the person which performed the last update
  • {schema}: Iri - can be used to filter the resulting resources based on the conformant schema
  • {search}: String - can be provided to select only the resources in the collection that have attribute values matching (containing) the provided string

Example

Request
curl "https://nexus.example.com/v1/resources/myorg/myproj"
Full source at GitHub
Response
{
  "@context": [
    "https://bluebrain.github.io/nexus/contexts/search.json",
    "https://bluebrain.github.io/nexus/contexts/resource.json"
  ],
  "_total": 1,
  "_results": [
    {
      "@id": "https://nexus.example.com/v1/resources/myorg/myproj/fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
      "@type": "http://example.com/Custom",
      "_incoming": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/incoming",
      "_outgoing": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/outgoing",
      "_self": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
      "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/resource",
      "_project": "https://nexus.example.com/v1/projects/myorg/myproj",
      "_rev": 4,
      "_deprecated": true,
      "_createdAt": "2018-09-17T14:54:42.939Z",
      "_createdBy": "https://nexus.example.com/v1/realms/myrealm/users/john",
      "_updatedAt": "2018-09-17T15:02:42.939Z",
      "_updatedBy": "https://nexus.example.com/v1/realms/myrealm/users/john"
    }
  ],
  "_next": "https://nexus.example.com/v1/resources/myorg/myproj?after=%5B1559045718752,%22https://nexus.example.com/v1/resources/myorg/myproj/fd8a2b32-170e-44e8-808f-44a8cbbc49b029%22%5D"
}
Full source at GitHub

List resources belonging to a schema

GET /v1/resources/{org_label}/{project_label}/{schemaId}?from={from}&size={size}&deprecated={deprecated}&rev={rev}&type={type}&createdBy={createdBy}&updatedBy={updatedBy}

where…

  • {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 resources based on their deprecation status
  • {rev}: Number - can be used to filter the resulting resources based on their revision value
  • {type}: Iri - can be used to filter the resulting resources 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 resources based on their creator
  • {updatedBy}: Iri - can be used to filter the resulting resources based on the person which performed the last update

Example

Request
curl "https://nexus.example.com/v1/resources/myorg/myproj/myschema"
Full source at GitHub
Response
{
  "@context": [
    "https://bluebrain.github.io/nexus/contexts/search.json",
    "https://bluebrain.github.io/nexus/contexts/resource.json"
  ],
  "_total": 1,
  "_results": [
    {
      "@id": "https://nexus.example.com/v1/resources/myorg/myproj/fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
      "@type": "http://example.com/Custom",
      "_incoming": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/incoming",
      "_outgoing": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/outgoing",
      "_self": "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0",
      "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/resource",
      "_project": "https://nexus.example.com/v1/projects/myorg/myproj",
      "_rev": 4,
      "_deprecated": true,
      "_createdAt": "2018-09-17T14:54:42.939Z",
      "_createdBy": "https://nexus.example.com/v1/realms/myrealm/users/john",
      "_updatedAt": "2018-09-17T15:02:42.939Z",
      "_updatedBy": "https://nexus.example.com/v1/realms/myrealm/users/john"
    }
  ],
  "_next": "https://nexus.example.com/v1/resources/myorg/myproj?after=%5B1559045718752,%22https://nexus.example.com/v1/resources/myorg/myproj/fd8a2b32-170e-44e8-808f-44a8cbbc49b029%22%5D"
}
Full source at GitHub

List incoming links

Provides a list of resources where the current resource {resource_id} is being referenced in the payload.

GET /v1/resources/{org_label}/{project_label}/{schema_id}/{resource_id}/incoming?from={from}&size={size}

where…

  • {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

Example

Request
curl "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/incoming"
Full source at GitHub
Response
{
  "@context": [
    "https://bluebrain.github.io/nexus/contexts/search.json",
    "https://bluebrain.github.io/nexus/contexts/resource.json"
  ],
  "_total": 1,
  "_results": [
    {
      "@id": "https://bluebrain.github.io/nexus/vocabulary/reconstruction1",
      "@type": [
        "https://nexus.example.com/v1/vocabs/myorg/myproject/Entity",
        "https://nexus.example.com/v1/vocabs/myorg/myproject/Dataset",
        "https://nexus.example.com/v1/vocabs/myorg/myproject/ReconstructedPatchedCell"
      ],
      "paths": "https://nexus.example.com/v1/vocabs/myorg/myproject/subject",
      "_self": "https://nexus.example.com/v1/resources/myorg/myproject/_/https://bluebrain.github.io/nexus/vocabulary/reconstruction1",
      "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/unconstrained.json",
      "_project": "https://nexus.example.com/v1/projects/myorg/myproject",
      "_rev": 4,
      "_deprecated": false,
      "_createdAt": "2019-05-28T13:28:00.186Z",
      "_createdBy": "https://nexus.example.com/v1/realms/myrealm/users/john",
      "_updatedAt": "2019-05-29T13:41:45.357Z",
      "_updatedBy": "https://nexus.example.com/v1/realms/myrealm/users/john"
    }
  ]
}
Full source at GitHub

List outgoing links

Provides a list of resources that are being used in the current resource {resource_id} payload. It also offers information

GET /v1/resources/{org_label}/{project_label}/{schema_id}/{resource_id}/outgoing?from={from}&size={size}&includeExternalLinks={includeExternalLinks}

where…

  • {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
  • {includeExternalLinks}: Boolean - flag to decide whether or not external links are to be included. External links are references to resources in other projects, or even resources external to Nexus; defaults to true

Example

Request
curl "https://nexus.example.com/v1/resources/myorg/myproj/myschema/base:fd8a2b32-170e-44e8-808f-44a8cbbc49b0/outgoing?includeExternalLinks=true"
Full source at GitHub
Response
{
  "@context": [
    "https://bluebrain.github.io/nexus/contexts/search.json",
    "https://bluebrain.github.io/nexus/contexts/resource.json"
  ],
  "_total": 4,
  "_results": [
    {
      "@id": "https://bluebrain.github.io/nexus/vocabulary/mouse1",
      "@type": [
        "https://nexus.example.com/v1/vocabs/myorg/myproject/Entity",
        "https://nexus.example.com/v1/vocabs/myorg/myproject/Subject"
      ],
      "paths": "https://nexus.example.com/v1/vocabs/myorg/myproject/subject",
      "_self": "https://nexus.example.com/v1/resources/myorg/myproject/_/https://bluebrain.github.io/nexus/vocabulary/mouse1",
      "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/unconstrained.json",
      "_project": "https://nexus.example.com/v1/projects/myorg/myproject",
      "_rev": 1,
      "_deprecated": false,
      "_createdAt": "2019-05-28T13:27:42.707Z",
      "_createdBy": "https://nexus.example.com/v1/realms/myrealm/users/john",
      "_updatedAt": "2019-05-28T13:27:42.707Z",
      "_updatedBy": "https://nexus.example.com/v1/realms/myrealm/users/john"
    },
    {
      "@id": "https://bluebrain.github.io/nexus/vocabulary/jane",
      "@type": [
        "https://nexus.example.com/v1/vocabs/myorg/myproject/Agent",
        "https://nexus.example.com/v1/vocabs/myorg/myproject/Person"
      ],
      "paths": [
        "https://nexus.example.com/v1/vocabs/myorg/myproject/contribution",
        "https://nexus.example.com/v1/vocabs/myorg/myproject/agent"
      ],
      "_self": "https://nexus.example.com/v1/resources/myorg/myproject/_/https://bluebrain.github.io/nexus/vocabulary/jane",
      "_constrainedBy": "https://bluebrain.github.io/nexus/schemas/unconstrained.json",
      "_project": "https://nexus.example.com/v1/projects/myorg/myproject",
      "_rev": 1,
      "_deprecated": false,
      "_createdAt": "2019-05-28T13:26:27.627Z",
      "_createdBy": "https://nexus.example.com/v1/realms/myrealm/users/john",
      "_updatedAt": "2019-05-28T13:26:27.627Z",
      "_updatedBy": "https://nexus.example.com/v1/realms/myrealm/users/john"
    },
    {
      "@id": "http://uri.interlex.org/base/ilx_0383233",
      "@type": "https://nexus.example.com/v1/vocabs/myorg/myproject/MType",
      "paths": [
        "https://nexus.example.com/v1/vocabs/myorg/myproject/annotation",
        "https://nexus.example.com/v1/vocabs/myorg/myproject/hasBody"
      ]
    },
    {
      "@id": "http://purl.obolibrary.org/obo/UBERON_0008933",
      "paths": [
        "https://nexus.example.com/v1/vocabs/myorg/myproject/brainLocation",
        "https://nexus.example.com/v1/vocabs/myorg/myproject/brainRegion"
      ]
    }
  ]
}
Full source at GitHub

Resources Server Sent Events

This endpoint allows clients to receive automatic updates from the realms in a streaming fashion.

The server sent events response contains a series of resource events, represented in the following way

data:{payload}
event:{type}
id:{id}

where…

  • {payload}: Json - is the actual payload of the current resource
  • {type}: String - is a type identifier for the current realm. Possible types are: Created, Updated, Deprecated, TagAdded, FileCreated, FileUpdated
  • {id}: String - is the identifier of the resource event. It can be used in the Last-Event-Id query parameter

Server Sent Events all resources

GET /v1/resources/events

where Last-Event-Id is an 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.

Example

Request
curl "https://nexus.example.com/v1/resources/events"
Full source at GitHub
Response
data:{"@context":"https://bluebrain.github.io/nexus/contexts/resource.json","@type":"Created","_resourceId":"https://nexus.example.com/v1/resources/myorg/myproject/_/7887416b-d501-4508-a625-2a6664dfca94","_source":{"@type":"Hobbit","age":23,"name":"Frodo"},"_types":["https://nexus.example.com/v1/vocabs/myorg/myproject/Hobbit"],"_constrainedBy":"https://bluebrain.github.io/nexus/schemas/unconstrained.json","_projectUuid":"1089947c-dc76-4cbc-8b04-3f919b436828","_organizationUuid":"ba7053ba-54ea-41b6-baab-96ec1acd7ad4","_instant":"2019-06-24T07:35:47.447631Z","_subject":"https://nexus.example.com/v1/realms/github/users/myuser"}
event:Created
id:aebbf8f4-9652-11e9-89a7-6d3c5701d287

data:{"@context":"https://bluebrain.github.io/nexus/contexts/resource.json","@type":"Updated","_resourceId":"https://nexus.example.com/v1/resources/myorg/myproject/_/7887416b-d501-4508-a625-2a6664dfca94","_source":{"@type":"Hobbit","age":25,"name":"Frodo"},"_types":["https://nexus.example.com/v1/vocabs/myorg/myproject/Hobbit"],"_projectUuid":"1089947c-dc76-4cbc-8b04-3f919b436828","_organizationUuid":"ba7053ba-54ea-41b6-baab-96ec1acd7ad4","_rev":2,"_instant":"2019-06-24T07:36:27.130185Z","_subject":"https://nexus.example.com/v1/realms/github/users/myuser"}
event:Updated
id:c6642f90-9652-11e9-89a7-6d3c5701d287

data:{"@context":"https://bluebrain.github.io/nexus/contexts/resource.json","@type":"Deprecated","_resourceId":"https://nexus.example.com/v1/resources/myorg/myproject/_/7887416b-d501-4508-a625-2a6664dfca94","_types":["https://nexus.example.com/v1/vocabs/myorg/myproject/Hobbit"],"_projectUuid":"1089947c-dc76-4cbc-8b04-3f919b436828","_organizationUuid":"ba7053ba-54ea-41b6-baab-96ec1acd7ad4","_rev":3,"_instant":"2019-06-24T07:36:40.558514Z","_subject":"https://nexus.example.com/v1/realms/github/users/myuser"}
event:Deprecated
id:ce6549e0-9652-11e9-89a7-6d3c5701d287

data:{"@context":"https://bluebrain.github.io/nexus/contexts/resource.json","@type":"FileCreated","_resourceId":"https://nexus.example.com/v1/resources/otherorg/myproject/_/myfile","_attributes":{"_bytes":48144,"_digest":{"_value":"721d03056b82a22c54f30fd3c68b41dfe5f53828911984e47182d82cfbac9f36","_algorithm":"SHA-256"},"_filename":"brain.jpg","_location":"file:///opt/binaries/1089947c-dc76-4cbc-8b04-3f919b436828/b/8/4/a/b/f/9/c/brain.jpg","_mediaType":"image/jpeg"},"_storage":{"@type":"DiskStorage","_storageId":"https://bluebrain.github.io/nexus/vocabulary/diskStorageDefault","default":true,"volume":"/opt/binaries","readPermission":"resources/read","writePermission":"files/write"},"_projectUuid":"1089947c-dc76-4cbc-8b04-3f919b436828","_organizationUuid":"aa7053ba-54ea-41b6-baab-96ec1acd7a44","_instant":"2019-06-24T07:37:10.311391Z","_subject":"https://nexus.example.com/v1/realms/github/users/myuser"}
event:FileCreated
id:e024e5f0-9652-11e9-89a7-6d3c5701d287
Full source at GitHub

Server Sent Events organization resources

GET /v1/resources/{org_label}/events

where

  • {org_label}: String - the selected organization 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.

Example

Request
curl "https://nexus.example.com/v1/resources/myorg/events"
Full source at GitHub
Response
data:{"@context":"https://bluebrain.github.io/nexus/contexts/resource.json","@type":"Created","_resourceId":"https://nexus.example.com/v1/resources/myorg/myproject/_/7887416b-d501-4508-a625-2a6664dfca94","_source":{"@type":"Hobbit","age":23,"name":"Frodo"},"_types":["https://nexus.example.com/v1/vocabs/myorg/myproject/Hobbit"],"_constrainedBy":"https://bluebrain.github.io/nexus/schemas/unconstrained.json","_projectUuid":"1089947c-dc76-4cbc-8b04-3f919b436828","_organizationUuid":"ba7053ba-54ea-41b6-baab-96ec1acd7ad4","_instant":"2019-06-24T07:35:47.447631Z","_subject":"https://nexus.example.com/v1/realms/github/users/myuser"}
event:Created
id:aebbf8f4-9652-11e9-89a7-6d3c5701d287

data:{"@context":"https://bluebrain.github.io/nexus/contexts/resource.json","@type":"Updated","_resourceId":"https://nexus.example.com/v1/resources/myorg/myproject/_/7887416b-d501-4508-a625-2a6664dfca94","_source":{"@type":"Hobbit","age":25,"name":"Frodo"},"_types":["https://nexus.example.com/v1/vocabs/myorg/myproject/Hobbit"],"_projectUuid":"1089947c-dc76-4cbc-8b04-3f919b436828","_organizationUuid":"ba7053ba-54ea-41b6-baab-96ec1acd7ad4","_rev":2,"_instant":"2019-06-24T07:36:27.130185Z","_subject":"https://nexus.example.com/v1/realms/github/users/myuser"}
event:Updated
id:c6642f90-9652-11e9-89a7-6d3c5701d287

data:{"@context":"https://bluebrain.github.io/nexus/contexts/resource.json","@type":"Deprecated","_resourceId":"https://nexus.example.com/v1/resources/myorg/myproject/_/7887416b-d501-4508-a625-2a6664dfca94","_types":["https://nexus.example.com/v1/vocabs/myorg/myproject/Hobbit"],"_projectUuid":"1089947c-dc76-4cbc-8b04-3f919b436828","_organizationUuid":"ba7053ba-54ea-41b6-baab-96ec1acd7ad4","_rev":3,"_instant":"2019-06-24T07:36:40.558514Z","_subject":"https://nexus.example.com/v1/realms/github/users/myuser"}
event:Deprecated
id:ce6549e0-9652-11e9-89a7-6d3c5701d287
Full source at GitHub

Server Sent Events project resources

GET /v1/resources/{org_label}/{project_label}/events

where

  • {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.

Example

Request
curl "https://nexus.example.com/v1/resources/myorg/myproject/events"
Full source at GitHub
Response
data:{"@context":"https://bluebrain.github.io/nexus/contexts/resource.json","@type":"Created","_resourceId":"https://nexus.example.com/v1/resources/myorg/myproject/_/7887416b-d501-4508-a625-2a6664dfca94","_source":{"@type":"Hobbit","age":23,"name":"Frodo"},"_types":["https://nexus.example.com/v1/vocabs/myorg/myproject/Hobbit"],"_constrainedBy":"https://bluebrain.github.io/nexus/schemas/unconstrained.json","_projectUuid":"1089947c-dc76-4cbc-8b04-3f919b436828","_organizationUuid":"ba7053ba-54ea-41b6-baab-96ec1acd7ad4","_instant":"2019-06-24T07:35:47.447631Z","_subject":"https://nexus.example.com/v1/realms/github/users/myuser"}
event:Created
id:aebbf8f4-9652-11e9-89a7-6d3c5701d287

data:{"@context":"https://bluebrain.github.io/nexus/contexts/resource.json","@type":"Updated","_resourceId":"https://nexus.example.com/v1/resources/myorg/myproject/_/7887416b-d501-4508-a625-2a6664dfca94","_source":{"@type":"Hobbit","age":25,"name":"Frodo"},"_types":["https://nexus.example.com/v1/vocabs/myorg/myproject/Hobbit"],"_projectUuid":"1089947c-dc76-4cbc-8b04-3f919b436828","_organizationUuid":"ba7053ba-54ea-41b6-baab-96ec1acd7ad4","_rev":2,"_instant":"2019-06-24T07:36:27.130185Z","_subject":"https://nexus.example.com/v1/realms/github/users/myuser"}
event:Updated
id:c6642f90-9652-11e9-89a7-6d3c5701d287

data:{"@context":"https://bluebrain.github.io/nexus/contexts/resource.json","@type":"Deprecated","_resourceId":"https://nexus.example.com/v1/resources/myorg/myproject/_/7887416b-d501-4508-a625-2a6664dfca94","_types":["https://nexus.example.com/v1/vocabs/myorg/myproject/Hobbit"],"_projectUuid":"1089947c-dc76-4cbc-8b04-3f919b436828","_organizationUuid":"ba7053ba-54ea-41b6-baab-96ec1acd7ad4","_rev":3,"_instant":"2019-06-24T07:36:40.558514Z","_subject":"https://nexus.example.com/v1/realms/github/users/myuser"}
event:Deprecated
id:ce6549e0-9652-11e9-89a7-6d3c5701d287
Full source at GitHub