{
  "swagger": "2.0",
  "info": {
    "title": "Units service",
    "version": "0.1507.0",
    "description": "Send your API key as a bearer token: `Authorization: Bearer <api key>`."
  },
  "tags": [
    {
      "name": "UnitsService",
      "x-displayName": "Units service",
      "description": "The Units Service serves as a comprehensive catalog of the units of measurement supported by Nominal. Units, by default, follow the UCUM convention for representation.",
      "x-errors": [
        {
          "status": 400,
          "errorCode": "INVALID_ARGUMENT",
          "errorName": "NominalUnitsV1:ScoutErrorCannotDeserializeSearchToken",
          "message": "CannotDeserializeSearchToken"
        },
        {
          "status": 400,
          "errorCode": "INVALID_ARGUMENT",
          "errorName": "NominalUnitsV1:ScoutErrorInvalidRange",
          "message": "The start time of the provided Range is greater than its end time."
        },
        {
          "status": 400,
          "errorCode": "INVALID_ARGUMENT",
          "errorName": "NominalUnitsV1:ScoutErrorRequestedPageSizeTooLarge",
          "message": "RequestedPageSizeTooLarge"
        }
      ]
    }
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/units/v2/units": {
      "get": {
        "operationId": "UnitsService_GetAllUnits",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/GetAllUnitsResponse"
            },
            "x-example": {
              "unitsByProperty": {
                "<key>": {
                  "value": [
                    {
                      "name": "<name>",
                      "symbol": "<symbol>",
                      "property": "<property>",
                      "dimension": {
                        "baseDimensions": {
                          "<key>": 1
                        }
                      },
                      "system": "<system>"
                    }
                  ]
                }
              }
            }
          }
        },
        "tags": [
          "UnitsService"
        ],
        "summary": "Get all units",
        "description": "Returns all known units, grouped by the physical property they measure."
      }
    },
    "/units/v2/units/batch-get": {
      "post": {
        "operationId": "UnitsService_GetBatchUnits",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/GetBatchUnitsResponse"
            },
            "x-example": {
              "responses": {
                "<key>": {
                  "name": "<name>",
                  "symbol": "<symbol>",
                  "property": "<property>",
                  "dimension": {
                    "baseDimensions": {
                      "<key>": 1
                    }
                  },
                  "system": "<system>"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/GetBatchUnitsRequest"
            },
            "x-example": {
              "units": [
                "<units>"
              ]
            }
          }
        ],
        "tags": [
          "UnitsService"
        ],
        "summary": "Get batch units",
        "description": "Returns information for the unit symbols if available. If the provided symbol cannot be parsed, it will be omitted from the map."
      }
    },
    "/units/v2/units/commensurable-units": {
      "post": {
        "operationId": "UnitsService_GetCommensurableUnits",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/GetCommensurableUnitsResponse"
            },
            "x-example": {
              "units": [
                {
                  "name": "<name>",
                  "symbol": "<symbol>",
                  "property": "<property>",
                  "dimension": {
                    "baseDimensions": {
                      "<key>": 1
                    }
                  },
                  "system": "<system>"
                }
              ]
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/GetCommensurableUnitsRequest"
            },
            "x-example": {
              "unit": "<unit>"
            }
          }
        ],
        "tags": [
          "UnitsService"
        ],
        "summary": "Get commensurable units",
        "description": "Returns the set of cataloged units that can be converted to and from the given unit. No commensurable units does not imply the unit is invalid. Use /get-unit to check for validity."
      }
    },
    "/units/v2/units/get-unit": {
      "post": {
        "operationId": "UnitsService_GetUnit",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/GetUnitResponse"
            },
            "x-example": {
              "unit": {
                "name": "<name>",
                "symbol": "<symbol>",
                "property": "<property>",
                "dimension": {
                  "baseDimensions": {
                    "<key>": 1
                  }
                },
                "system": "<system>"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/GetUnitRequest"
            },
            "x-example": {
              "unit": "<unit>"
            }
          }
        ],
        "tags": [
          "UnitsService"
        ],
        "summary": "Get unit",
        "description": "Returns information for a unit symbol if available. Returns as empty if the provided symbol cannot be parsed."
      }
    }
  },
  "definitions": {
    "GetAllUnitsResponse": {
      "type": "object",
      "properties": {
        "unitsByProperty": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/GetUnitsResponseUnitsByPropertyWrapper"
          }
        }
      }
    },
    "GetUnitsResponseUnitsByPropertyWrapper": {
      "type": "object",
      "properties": {
        "value": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/Unit"
          }
        }
      }
    },
    "GetBatchUnitsRequest": {
      "type": "object",
      "properties": {
        "units": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "example": {
        "units": [
          "<units>"
        ]
      }
    },
    "GetBatchUnitsResponse": {
      "type": "object",
      "properties": {
        "responses": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/Unit"
          }
        }
      }
    },
    "GetCommensurableUnitsRequest": {
      "type": "object",
      "properties": {
        "unit": {
          "type": "string"
        }
      },
      "example": {
        "unit": "<unit>"
      }
    },
    "GetCommensurableUnitsResponse": {
      "type": "object",
      "properties": {
        "units": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/Unit"
          }
        }
      }
    },
    "GetUnitRequest": {
      "type": "object",
      "properties": {
        "unit": {
          "type": "string"
        }
      },
      "example": {
        "unit": "<unit>"
      }
    },
    "GetUnitResponse": {
      "type": "object",
      "properties": {
        "unit": {
          "$ref": "#/definitions/Unit"
        }
      }
    },
    "Unit": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "symbol": {
          "type": "string"
        },
        "property": {
          "type": "string",
          "description": "Empty if no property is available. If two units measure different properties, it is not possible to convert between them."
        },
        "dimension": {
          "$ref": "#/definitions/UnitDimension",
          "description": "The physical dimensions in terms of the base units of the system. It is only possible to convert units if they have the same dimension. Empty if the unit is a base unit."
        },
        "system": {
          "type": "string"
        }
      }
    },
    "UnitDimension": {
      "type": "object",
      "properties": {
        "baseDimensions": {
          "type": "object",
          "additionalProperties": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "description": "The fundamental base dimensions and their exponents, whose product compose a unit."
    }
  },
  "securityDefinitions": {
    "ApiKey": {
      "type": "apiKey",
      "in": "header",
      "name": "Authorization",
      "description": "Your API key as a bearer token: `Authorization: Bearer <api key>`."
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ]
}
