APIs

Grandezas e Unidades de Medida

Este tema contém os padrões MDM para grandezas e unidades de medida

Grandezas (measuringMagnitude)


Unidades de medida (measuringUnit)

  • Descrição
    Esta entidade padroniza os seguintes atributos de unidades de medida:

    • Id
    • nome
    • sigla
    • grandeza
  • Estrutura dos Campos

    CampoDescriçãoTipoLink
    dataIdidentificador da unidade de medidaint
    namenome da unidade de medidastring
    abbrevsigla da unidade de medidastring
    measuringMagnitudeIddata.id (identificador) da grandeza associada à unidade de medidaintmeasuringMagnitudeId
    measuringMagnitudeNamenome da grandeza associada à unidade de medidastringmeasuringMagnitudeName
    dataIdentifieridentificador de unicidade da entidadestring
  • Como consultar ultima versão do schema da entidade

    • Exemplo de retorno
      Clique em "JSON"
      
      {
          "statusCode": 200,
          "success": true,
          "message": "Success",
          "document": {
              "_id": "6408e4882fdf838348471edf",
              "entityType": "measuringUnit",
              "revision": 3,
              "dataIdentifierSetup": [
                  "name"
              ],
              "jsonSchema": {
                  "title": "MeasuringUnit Entity",
                  "required": [
                      "entityType",
                      "revision",
                      "data"
                  ],
                  "properties": {
                      "entityType": {
                          "title": "This entity provides the default most commom model used at nstech Platform",
                          "pattern": "^(.*)$",
                          "$id": "#/properties/entityType",
                          "type": "string"
                      },
                      "revision": {
                          "title": "The review of this entity. An integer value.",
                          "default": 1,
                          "$id": "#/properties/revision",
                          "type": "integer"
                      },
                      "data": {
                          "title": "The composition of the document object",
                          "$id": "#/properties/data",
                          "type": "object",
                          "required": [
                              "name",
                              "abbrev",
                              "measuringMagnitude"
                          ],
                          "properties": {
                              "name": {
                                  "title": "Name of measuring unit type.",
                                  "$id": "#/properties/data/properties/name",
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLenght": 200
                              },
                              "abbrev": {
                                  "title": "Abbreviation of measuring unit type.",
                                  "$id": "#/properties/data/properties/abbrev",
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLenght": 200
                              },
                              "measuringMagnitude": {
                                  "$id": "#/properties/data/properties/measuringMagnitude",
                                  "type": "object",
                                  "examples": [
                                      "{\"customer_code\": \"11222333000199\"}"
                                  ],
                                  "required": [
                                      "dataid",
                                      "name"
                                  ],
                                  "properties": {
                                      "dataid": {
                                          "title": "id of measuring magnitude type.",
                                          "$id": "#/properties/data/properties/measuringMagnitude/properties/dataId",
                                          "type": "integer"
                                      },
                                      "name": {
                                          "title": "Name of measuring magnitude type.",
                                          "$id": "#/properties/data/properties/measuringMagnitude/properties/name",
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLenght": 200
                                      }
                                  }
                              },
                              "dataId": {
                                  "title": "The Unique Key for a document of this entity. If you don't know, don't put this in the document and it will be generated automatically.",
                                  "$id": "#/properties/data/properties/dataId",
                                  "type": "integer"
                              }
                          }
                      }
                  },
                  "$id": "http://example.org/root.json#",
                  "type": "object",
                  "definitions": {},
                  "$schema": "http://json-schema.org/draft-07/schema#"
              },
              "authDefinition": {
                  "resources": {
                      "measuringUnit": {
                          "create": true,
                          "update": true,
                          "delete": true,
                          "view": true
                      }
                  }
              },
              "sensiblePropertiesPath": [],
              "effectiveDate": "2023-01-25T17:45:25.522Z",
              "status": true,
              "deleted": false
          }
      }
      
  • Exemplo de chamada ao endpoint (GET) pela API get records by queryTemplate

  • Exemplo de chamada ao endpoint (GET) usando “data id”

  • Exemplo de chamada ao endpoint (GET) usando “updatedAt”

  • Exemplo de retorno

    Clique em "JSON"
    
    {
        "statusCode": 200,
        "success": true,
        "message": "Success",
        "document": [
            {
                "_id": "636fbfc6dd04eb0288a17ddd",
                "entityType": "measuringUnit",
                "revision": 1,
                "data": {
                    "name": "Ampere",
                    "abbrev": "A",
                    "measuringMagnitude": {
                        "dataid": 3,
                        "name": "Corrente elétrica"
                    },
                    "dataId": 1,
                    "dataIdentifier": {
                        "name": "Ampere"
                    }
                },
                "createdAt": "2022-11-12T15:46:14.644Z",
                "deleted": false,
                "userCreator": "service-account-mdm",
                "updatedAt": "2022-11-12T15:46:14.644Z"
            },
            {
                "_id": "636fbfd1062b1fff9d9d02a8",
                "entityType": "measuringUnit",
                "revision": 1,
                "data": {
                    "name": "Candela",
                    "abbrev": "cd",
                    "measuringMagnitude": {
                        "dataid": 7,
                        "name": "Intensidade luminosa"
                    },
                    "dataId": 2,
                    "dataIdentifier": {
                        "name": "Candela"
                    }
                },
                "createdAt": "2022-11-12T15:46:25.433Z",
                "deleted": false,
                "userCreator": "service-account-mdm",
                "updatedAt": "2022-11-12T15:46:25.433Z"
            }
        ],
        "page": 1,
        "limit": 2,
        "nextPageURL": "https://dev.nstech.com.br:8080/platform/mdm-stg/platform/api/mdm-stg/entities/measuringUnit/queryByTemplate/all?page=2&limit=2"
    }