Resources

The emurestapi server provides access to each Texpress table as a resource. All CRUD operations are supported via the REST API. The format of an API call is:

VERB /{tenant}/{resource}/{id}

where VERB is the HTTP verb for the API operation. The {tenant} component defines which EMu environment is to be accessed. The available tenants are defined in the restapi/conf/tenants.conf file. The {resource} component determines the EMu table to be used and {id} provides the key used to identify a single record, typically the IRN.

The following requests are supported through the REST API:

Request
Description
GET /{tenant}/{resource}/{id} Retrieve a single record. For example a request of GET /museum/eparties/10 will return the data for the eparties record with IRN 10 in the museum EMu environment. See Retrieve for full details.
GET /{tenant}/{resource} Perform a search returning matching records. A filter may be applied to determine which records are returned. See Search for full details.
DELETE /{tenant}/{resource}/{id} Delete a single record. Once the record is deleted it can no longer be retrieved. See Delete for full details.
PATCH /{tenant}/{resource}/{id} Modify values in a single record. The payload consists of JSON Patch commands detailing which values are to be updated. See Edit for full details.
POST /{tenant}/{resource} Create a new record. The payload contains the record to be inserted in JSON format. An IRN is allocated and the contents of the new record returned. See Insert for full details.
PUT /{tenant}/{resource}/{id} Create a new record or replace an existing record with the specified IRN. The payload contains the record to be inserted/replaced in JSON format. The IRN allocated to the inserted/replaced record is the {id} provided in the request. See Insert/Replace for full details.

The shim also has a number of predefined resources used to access administrative parts of the system and EMu environments. The system based resources use a tenant value of shared:

Resource Description
servers List information about the emurestapi server. The information includes the interface and port the server is listening on, the server version along with a timestamp indicating when the server was started. See Servers for full details.
tenants List the registered tenants. The information for each tenant includes the tenant name along with details about the tenant (legal name, email address, web address and physical address). See Tenants for full details.

The EMu environment administrative resources are:

Resource Description
tokens List of tokens currently allocated to the tenant. A token is created each time a user logs into a tenant. A token’s information includes the username and role of the person logged in along with the login time and expiry time. A list of the user’s roles is also provided. See Tokens for full details.
resources List of the resources available for the given tenant. The list includes all Texpress tables along with the system and EMu administrative tables. A resource’s information consists of a JSON Schema document describing the allowed JSON format for a valid record of the resource type. See Schemas for full details.
media Streams a media resource associated with a multimedia record for the given tenant. The media is delivered as an octet stream using the HTTP chunked transfer encoding. The Content-Type header reflects the type and format of the media document. See Media for full details.
attachments List all records that reference a given record of the supplied tenant. The list contains the resource name and column name along with the number of records where the given record is referenced. Optionally a list of all referring records may be listed with each column. See Attachments for full details.
users List information about all registered users for the given tenant. The information includes the username, their preferred locale, a list of their roles along with their current role and personal information (given and family names, email address and physical address). See Users for full details.
roles List of roles registered for the given tenant. The information includes the name of the role, a description of its purpose and a list of users who are members of the role. See Roles for full details.

The following sections cover each of the above predefined resources in detail along with Texpress table access.