Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Endpoint: http://localhost:8080/fcrepo/rest/fcr:search

Method: GET

Parameters: 

Name

Type

 

Used in condition

condition

string

A condition consists of a metadata element name followed directly by an operator, followed directly by a value. 

Valid element names are (TBD) 

Valid operators are:  =, >, <, =>, <=

A search URI may specify one or more conditions

N

fields

string

A comma separated list of fields to be returned in the search results

N

max_results

int

Maximum number of results to return in a single “page”

N

offset

int

The offset of the first result in the page.  The field is used in conjunction with max_results in order to present paged results.

N

order_by

string

Field name to order the query by 

N

order

string

asc or desc

N

format

string

The format of the results. Valid values are: 

  • json
  • text
  • csv

N

modified

date string : Rfc 8601

The modification date: eg 2020-05-01T20:05:14+00:00

Y

created

date string : Rfc 8601

The creation date: eg 2020-05-01T20:05:14+00:00

Y

sha1

string

The SHA-1 of the resource

Y

md5

string

The MD5 of the resource

Y

rdf_type

string (URI)

The URI or abbreviated string representing the RDF type. Here are some examples: 

http://www.w3.org/ns/ldp#NonRDFSource

ldp:NonRDFSource

http://www.w3.org/ns/ldp#RDFSource

ldp:RDFSource

Y

mime_type

string

The mimetype

Y

fedora_id

string (URI)

The fedora resource ID*.  Given the resource http://localhost:8080/rest/resource1,  you may format this condition in the following three ways: 

fedora_id=resource1

fedora_id=/resource1

fedora_id=info:fedora/resource1

fedora_id=http://localhost:8080/rest/resource1

Y

ocfl_id

string

The OCFL Object ID* 

Y

size

int

The size of a resource in bytes

Y

ancestor

URI

URI of the ancestral resource 

Y

ancestors

boolean

Used in conjunction with the fedora_id field. When set to true, display the ancestors.

Y

descendants

boolean

Used in conjunction with the fedora_id field. When set to true, display the descendants.

Y

*Supports the wild-card operator(*)

...

Anatomy of a Search Result (HTTP Response Body)


{

  input_params: {

    conditions: [“fedora_id=*”], 

    max_results: 10,

    ...

  },

  pagination: {

    max_results: 10,

    offset: 0, 

    ...  

  },

  results: [

   {

      “fedora_id”:  “http://localhost:8080/rest/resource1”,

      ...

    }, 

    {

      “fedora_id”:  “http://localhost:8080/rest/resource2”,

      ...

    }, 

    ...

  ]

}



Condition Parameter

A search query may specify one or more condition parameters.  A condition parameter consists of three parts:  field, operation, and value.  For example the condition "fedora_id is equal to /myresource" would translate to the following query parameter value:

...

GET http://localhost:8080/fcrepo/rest/fcr:search?condition=fedora_id%3D/my/fedora/resource1&condition=descendants%3Dtrue&return_fields=fedora_id,mime_type

Return Body (JSON)

{

  ...

  [

  {

    “fedora_id”:  “http://localhost:8080/rest/resource1”,

    “mime_type”: “image/jpg”

  }, 

  {

    “fedora_id”:  “http://localhost:8080/rest//resource2”,

    “mime_type”: “text/plain”

  }, 

  ...

  ]

}