{
  "swagger": "2.0",
  "info": {
    "title": "Weight",
    "version": "2019-03-22",
    "license": {
      "name": "OCF Data Model License",
      "url": "https://github.com/openconnectivityfoundation/core/blob/e28a9e0a92e17042ba3e83661e4c0fbce8bdc4ba/LICENSE.md",
      "x-copyright": "Copyright 2016-2019 Open Connectivity Foundation, Inc. All rights reserved."
    },
    "termsOfService": "https://openconnectivityfoundation.github.io/core/DISCLAIMER.md"
  },
  "schemes": [
    "http"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/WeightResURI": {
      "get": {
        "description": "This Resource describes the Properties associated with weight of an object.\nThe unit is a single value that is one of kg, g, lb or oz.\nIf the unit Property is missing the default is kilograms [kg].\nThe unit Property is a read-only value that is provided by the server.\nWhen range is omitted the default is 0 to +MAXFLOAT.",
        "parameters": [
          {
            "$ref": "#/parameters/interface"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "x-example": {
              "rt": [
                "oic.r.weight"
              ],
              "weight": 80,
              "units": "kg"
            },
            "schema": {
              "$ref": "#/definitions/Weight"
            }
          }
        }
      },
      "post": {
        "description": "Sets the Weight.",
        "parameters": [
          {
            "$ref": "#/parameters/interface"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/Weight"
            },
            "x-example": {
              "weight": 75,
              "units": "kg"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Indicates that the weight was successfully changed.\nThe new weight is provided in the response.",
            "x-example": {
              "weight": 75,
              "units": "kg"
            },
            "schema": {
              "$ref": "#/definitions/Weight"
            }
          },
          "403": {
            "description": "Indicates that OCF client sent an invalid Property value to the Server.\nThe Server responds with the current resource representation.",
            "x-example": {
              "weight": 80,
              "units": "kg"
            },
            "schema": {
              "$ref": "#/definitions/Weight"
            }
          }
        }
      }
    }
  },
  "parameters": {
    "interface": {
      "in": "query",
      "name": "if",
      "type": "string",
      "enum": [
        "oic.if.s",
        "oic.if.a",
        "oic.if.baseline"
      ]
    }
  },
  "definitions": {
    "Weight": {
      "properties": {
        "rt": {
          "description": "Resource Type",
          "items": {
            "enum": [
              "oic.r.weight"
            ],
            "type": "string",
            "maxLength": 64
          },
          "minItems": 1,
          "uniqueItems": true,
          "readOnly": true,
          "type": "array"
        },
        "weight": {
          "description": "Weight of an object",
          "minimum": 0,
          "type": "number"
        },
        "units": {
          "description": "Weight unit",
          "enum": [
            "kg",
            "g",
            "lb",
            "oz"
          ],
          "readOnly": true,
          "type": "string",
          "default": "kg"
        },
        "range": {
          "$ref": "https://openconnectivityfoundation.github.io/IoTDataModels/schemas/oic.baseresource.properties-schema.json#/definitions/range_number"
        },
        "step": {
          "$ref": "https://openconnectivityfoundation.github.io/IoTDataModels/schemas/oic.baseresource.properties-schema.json#/definitions/step_number"
        },
        "precision": {
          "$ref": "https://openconnectivityfoundation.github.io/IoTDataModels/schemas/oic.baseresource.properties-schema.json#/definitions/precision"
        },
        "n": {
          "$ref": "https://openconnectivityfoundation.github.io/core/schemas/oic.common.properties.core-schema.json#/definitions/n"
        },
        "id": {
          "$ref": "https://openconnectivityfoundation.github.io/core/schemas/oic.common.properties.core-schema.json#/definitions/id"
        },
        "if": {
          "description": "The OCF Interface set supported by this Resource",
          "items": {
            "enum": [
              "oic.if.s",
              "oic.if.a",
              "oic.if.baseline"
            ],
            "type": "string",
            "maxLength": 64
          },
          "minItems": 1,
          "readOnly": true,
          "uniqueItems": true,
          "type": "array"
        }
      },
      "type": "object",
      "required": [
        "weight",
        "units"
      ]
    }
  }
}