Gemini Docs
  • Gemini Overview
  • 🎯Use cases & Benefits
  • 🚴‍♂️Getting Started
  • Backend Module
    • Overview
    • Getting Started
      • REST API - Micronaut MongoDB
    • Rest API
      • Basic CRUD
        • POST /data/{entity}
        • GET /data/{entity}/{id}
        • PUT /data/{entity}/{id}
        • PATCH /data/{entity}/{id}
        • DELETE /data/{entity}/{id}
      • Getting Data
        • GET All Data
        • Pagination
        • Filters
        • Sorting
      • Rest Configuration
        • Big Entities
        • Reference
    • The Schema (DDD)
      • Entities
      • Fields
        • String
        • Number
        • Boolean
        • Date & Time
        • Enum & Select
        • Object
        • Array
        • Dictionary
    • Data Drivers
Powered by GitBook
On this page
  • Request
  • Endpoint
  • Responses
  • 200 - Success
  • 404 - Not Found
  1. Backend Module
  2. Rest API
  3. Basic CRUD

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"
    }
}
PreviousPOST /data/{entity}NextPUT /data/{entity}/{id}

Last updated 3 years ago