GET /data/{entity}/{id}

GET entity record by id (logical key)

When you need a specific entity record and you know the id (logical key).

Request

Endpoint

GET <base_url>/data/{entity}/{id}

{entity} is the Entity name according to the name provided in the schema

{id} is the record identifier (the logical key for the record)

Responses

Gemini responses always contains a proper HTTP status code, and a JSON body with a status text, the data inserted and a meta object that holds metadata about the response.

Lets take a look by using some real examples and the following schema:

type: ENTITY
entity:
  name: CATEGORY
  lk: [id]
  fields:
    - name: id
      type: STRING
      required: true
    - name: description
      type: STRING

200 - Success

Success response contains the data record and some useful metadata, for example the last update time in both ISO and unix format.

curl "http://localhost:8080/data/category/smartphone-1"
{
    "status": "success",
    "data": {
        "description": "Smartphone",
        "id": "smartphone-1"
    },
    "meta": {
        "lastUpdateTimeUnix": 1640185956675,
        "lastUpdateTimeISO": "2021-12-22T15:12:36.675Z",
    }
}

404 - Not Found

curl "http://localhost:8080/data/category/smartphone-noex"
{
    "status": "error",
    "error": {
        "reason": "EntityRecord with id smartphone-noex not found for CATEGORY"
    }
}

Last updated