Developer / Reference / HTTP API / Endpoints

Query

Last updated on 13-Mar-2021 by Jakob Jakobsen Boysen
Jakob Jakobsen Boysen

Platform Lead
boysen@scifeon.com

Dataset

POST /api/query/dataset

Query one or several entities or views.

Request

Body parameters

The request is a list of queries that can be inter-related:

Filter

  • field: the name of the field to filter by
  • op: can be one of the OData $filter operators
  • value: value type must match the field. Can also refer to other queries with $-syntax, see examples below
  • in: refers to other queries, see examples below
  • values: a list of filter values

Response

The response is an object with the keys defined as collection or entity:

Example 1

Get Step and Experiment related to a Fermentation named "FERM-001":

This will return:

Example 2

Get all Experiments of type "AdvancedAnalysis", sort them by last modified, and also get the related Steps:

This will return:

Pivot

POST /api/query/pivot

Pivot data from a table or view.

Request

Body parameters

The request is the parameters used to pivot data.

Response

The response is an object with data and columns:

Example 1

Pivot

This will return:

Database view

GET /api/query/view/{name}

Request

Path parameters

  • name

Freetext search

GET /api/query/freetext/{query}

Search across...

Request

Path parameters

  • query

Hierarchy

GET /api/query/hierarchy/{eClass}/{id}

Request

Path parameters

  • eClass
  • id

Valid statuses

GET /api/query/status/{eClass}/{id?}

Request

Path parameters

  • eClass
  • id

Suggest entities

GET /api/query/suggest/entity/{eClass}/{query?}

Request

Path parameters

  • eClass
  • query

Suggest field values

GET /api/query/suggest/field/{eClass}/{field}/{query?}

Get all available field values for an entity class, possibly filtered by a contains query. Only existing entities the current user has access to are taken into consideration.

Request

Path parameters

  • eClass The entity class.
  • field The field to get suggestions for.
  • query The contains query (optional).

Query parameters

Response

A simple JSON array of suggestions:

The name property is only set, when the requested field is a foreign key to another table and this table contains a name field. For more, see the example below.

Examples

To get all possible types for the experiment entity:

GET /api/query/suggest/field/experiment/type

To get all possible types for an experiment where the scientist is USER1 and the type contains 'FA':

GET /api/query/suggest/field/experiment/type/FA?$filter=Scientist eq 'USER1'

To get all possible analyst IDs for an experiment:

GET /api/query/suggest/field/experiment/analystID

This result includes the name property as well, because the AnalystID field is a foreign key to the User table:

Unique field value

GET /api/query/unique/field/{eClass}/{field}/{query}

Query if a field value of a entity class is unique.

Request

Path parameters

  • eClass
  • field
  • query

Returns

A simple JSON object: