{

"components": {
  "request": {
    "parameters": {
      "token_param": {
        "name": "X-Samanage-Authorization",
        "in": "header",
        "schema": { "type": "string" },
        "example": "Bearer TOKEN"
      },
      "id_param": {
        "name": "id",
        "in": "path",
        "schema": { "type": "string" },
        "required": true,
        "description": "Numeric ID of the object to get or update"
      },
      "object_param": {
        "name": "object_type",
        "in": "path",
        "schema": { "type": "string" },
        "required": true,
        "description": "Source object type",
        "example": "incidents"
      }
    },
    "schemas": {
      "association_by_name": {
        "type": "object",
        "oneOf": [{
          "type": "object",
          "required": ["name"],
          "properties": {
            "name": { "type": "string", "example": "Object Name" }
          }
        },
        { "enum": ["nil", "", null] }]
      },
      "association_by_email": {
        "type": "object",
        "oneOf": [{
          "type": "object",
          "required": ["email"],
          "properties": {
            "email": {
              "type": "string",
              "format": "email",
              "example": "john.doe@email.com"
            }
          }
        },
        { "enum": ["nil", "", null] }]
      },
      "attachment_numbers": {
        "anyOf": [
          { "$ref": "components.json#/components/request/schemas/numbers_array" },
          { "$ref": "components.json#/components/request/schemas/number_property" }
        ]
      },
      "number_property": {
        "type": "object",
        "properties": {
          "number": { "anyOf": [ { "type": "string", "example": "1" }, { "type": "integer", "example": 1 }] }
        }
      },
      "numbers_array": {
        "type": "array",
        "items": { "$ref": "components.json#/components/request/schemas/number_property" }
      },
      "value_of_custom_field": {
        "anyOf":[
          { "type": "string", "example": "content" }, { "type": "integer", "example": 1 }, { "type": "null" },
          { "content": { "application/octet-stream": {} }, "description": "attachment custom field" }, { "nullable": true }
        ]
      },
      "custom_field": {
        "type": "object",
        "required": ["name"],
        "properties": {
          "name": { "type": "string", "example": "Name of custom text field" },
          "value": { "$ref": "components.json#/components/request/schemas/value_of_custom_field" },
          "user_value": { "anyOf": [{ "$ref": "components.json#/components/request/schemas/association_by_email" }, { "nullable": true }] }
        }
      },
      "custom_fields_value": {
        "anyOf": [
          { "type": "array", "items": { "$ref": "components.json#/components/request/schemas/custom_field" } },
          { "$ref": "components.json#/components/request/schemas/custom_field" }
        ]
      },
      "custom_fields_values": {
        "type": "object",
        "required": ["custom_fields_value"],
        "properties": { "custom_fields_value": { "$ref": "components.json#/components/request/schemas/custom_fields_value" } }
      },
      "custom_field_by_id": {
        "type": "object",
        "properties": {
          "id": { "$ref": "components.json#/components/common/schemas/association_by_id" },
          "custom_field_id": { "$ref": "components.json#/components/common/schemas/association_by_id" },
          "value": { "$ref": "components.json#/components/request/schemas/value_of_custom_field" }
        }
      },
      "custom_fields_values_attributes": {
        "anyOf": [
          { "type": "array", "items": { "$ref": "components.json#/components/request/schemas/custom_field_by_id" } },
          { "type": "object", "items": { "$ref": "components.json#/components/request/schemas/custom_field_by_id" } }
        ]
      },
      "approval_levels_attributes": {
        "anyOf": [
          { "type": "array", "items": { "$ref": "components.json#/components/request/schemas/approval_level" } },
          { "type": "object", "items": { "$ref": "components.json#/components/request/schemas/approval_level" } }
        ]
      },
      "approval_level": {
        "type": "object",
        "properties": {
          "id": { "$ref": "components.json#/components/common/schemas/association_by_id" },
          "approver_ids": { "type": "string", "example": "1, 2" },
          "approval_condition": { "type": "string", "example": "1" }
        }
      },
      "bio": {
        "type": "object",
        "properties": {
          "manufacturer": { "type": "string", "example": "Dell" },
          "ssn": { "anyOf": [{ "type": "string", "example": "1" },{ "type": "integer", "example": 1 }] },
          "model": { "type": "string", "example": "model description" },
          "version": { "anyOf": [{ "type": "string", "example": "1" },{ "type": "integer", "example": 1 }] },
          "bios_date": { "type": "string", "example": "2020-01-01 00:00" }
        }
      },
      "variable": {
        "type": "object",
        "required": ["name"],
        "properties": {
          "name": { "type": "string", "example": "Variable name" },
          "value": { "type": "string", "example": "Content" },
          "user_value": { "$ref": "components.json#/components/request/schemas/association_by_email" }
        }
      },
      "cc_array": {
        "type": "array",
        "items": { "type": "string", "format": "email", "example": "john.doe@email.com" },
        "xml": { "wrapped": true },
        "description": "for xml requests, please add: type=\"array\". for example: \"\\<cc type='array'\\> \\<cc\\>john.doe@email.com\\<\/cc\\> \\<\/cc\\>\""
      },
      "reports_to": {
        "oneOf": [
          {
            "type": "object",
            "required": ["id"],
            "properties": { "id": { "$ref": "components.json#/components/common/schemas/association_by_id" } }
          },
          { "$ref": "components.json#/components/request/schemas/association_by_email" }
        ]
      },
      "purchase_order_items_attributes": {
        "type": "array",
        "items": { "$ref": "components.json#/components/request/schemas/purchase_order_items_attribute" }
      },
      "purchase_order_items_attribute": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "components.json#/components/common/schemas/association_by_id",
            "description": "Required field for update operations"
          },
          "name": { "type": "string", "example": "Item Name" },
          "description": { "type": "string", "example": "Item Decription" },
          "serial_number": { "type": "string", "example": "XXXXX" },
          "part_number": { "$ref": "components.json#/components/common/schemas/number_or_string" },
          "price": { "$ref": "components.json#/components/common/schemas/number_or_string" },
          "quantity": { "$ref": "components.json#/components/common/schemas/number_or_string" },
          "discount": { "$ref": "components.json#/components/common/schemas/number_or_string" },
          "tax": { "$ref": "components.json#/components/common/schemas/number_or_string" }
        }
      }
    }
  },
  "response": {
    "schemas": {
      "id": {
        "readOnly": true,
        "oneOf": [{ "type": "string", "example": "1" }, { "type": "integer", "example": 1 }]
      },
      "custom_field": {
        "type": "object",
        "properties": {
          "id": { "$ref": "components.json#/components/response/schemas/id" },
          "custom_field_id": { "$ref": "components.json#/components/response/schemas/id" },
          "name": { "type": "string", "example": " Name of custom text field" },
          "value": { "type": "string", "example": "content" },
          "type_name": { "type": "string", "example": "Text" }
        }
      },
      "custom_fields_values": {
        "type": "array",
        "items": { "$ref": "components.json#/components/response/schemas/custom_field" }
      },
      "category_subcategory": {
        "type": "object",
        "properties": {
          "id": { "$ref": "components.json#/components/response/schemas/id" },
          "name": { "type": "string", "example": "Category / Subcategory name" },
          "default_tags": { "type": "string", "example": "tag1, tag2" },
          "parent_id": { "$ref": "components.json#/components/response/schemas/id" },
          "default_assignee_id": { "$ref": "components.json#/components/response/schemas/id" }
        }
      },
      "avatar": {
        "type": "object",
        "properties": {
          "type": { "type": "string", "example": "initials" },
          "color": { "type": "string", "example": "#1000" },
          "initials": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2,
            "example": "JD"
          }
        }
      },
      "group_details": {
        "type": "object",
        "properties": {
          "group_id": { "$ref": "components.json#/components/common/schemas/association_by_id" },
          "is_user": { "oneOf": [{ "type": "string", "example": "true" }, { "type": "boolean" }] },
          "id":  { "$ref": "components.json#/components/response/schemas/id" },
          "name": { "type": "string", "example": "John Doe" },
          "email": { "type": "string", "example": "john.doe@email.com" },
          "avatar": { "$ref": "components.json#/components/response/schemas/avatar" }
        }
      },
      "user_details": {
        "type": "object",
        "properties": {
          "id": { "$ref": "components.json#/components/response/schemas/id" },
          "account_id": { "$ref": "components.json#/components/response/schemas/id" },
          "user_id": { "$ref": "components.json#/components/response/schemas/id" },
          "email": { "type": "string", "example": "john.doe@email.com" },
          "name": { "type": "string", "example": "John Doe" },
          "disabled": { "type": "boolean", "example": false },
          "avatar": { "$ref": "components.json#/components/response/schemas/avatar" }
        }
      },
      "site_response": {
        "type": "object",
        "properties": {
          "id":  { "$ref": "components.json#/components/response/schemas/id" },
          "name": { "type": "string", "example": "Austin TX, USA" },
          "description": { "type": "string", "example": "AUS" },
          "location": { "type": "string", "example": "AUS" },
          "timezone": { "type": "string", "example": "UTC-6h" }
        }
      },
      "department_response": {
        "type": "object",
        "properties": {
          "id": { "$ref": "components.json#/components/response/schemas/id" },
          "name": { "type": "string", "example": "Support" },
          "description": { "type": "string", "example": "Support Department" },
          "default_assignee_id": { "$ref": "components.json#/components/response/schemas/id" }
        }
      },
      "response_attachments": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": { "$ref": "components.json#/components/common/schemas/association_by_id" },
            "href": { "type": "string", "example": "https://mydomain.com/object_type/1" }
          }
        }
      },
      "role": {
        "type": "object",
        "properties": {
          "id": { "$ref": "components.json#/components/response/schemas/id" },
          "name": { "type": "string", "example": "Requester" },
          "description": { "type": "string", "example": "Requester role" },
          "portal": { "type": "boolean", "example": true },
          "show_my_tasks": { "type": "boolean", "example": true }
        }
      },
      "tag": {
        "type": "object",
        "properties": {
          "id": { "$ref": "components.json#/components/response/schemas/id" },
          "name": { "type": "string", "example": "tag name" },
          "taggings_count": { "type": "integer", "example": 1 }
        }
      },
      "tags": {
        "type": "array",
        "items": { "$ref": "components.json#/components/response/schemas/tag" }
      },
      "approvers": {
        "type": "array",
        "items": { "$ref": "components.json#/components/response/schemas/group_details" }
      },
      "creator": {
        "type": "object",
        "properties": {
          "id": { "$ref": "components.json#/components/response/schemas/id" },
          "name": { "type": "string", "example": "tag name" },
          "email": { "type": "string", "format": "email", "example": "john.doe@email.com" }
        }
      },
      "ci_type": {
        "type": "object",
        "properties": {
          "id": { "$ref": "components.json#/components/response/schemas/id" },
          "name": { "type": "string", "example": "Building" },
          "description": { "type": "string", "example": "Configuration Item - Building" },
          "parent_id": { "$ref": "components.json#/components/response/schemas/id" },
          "custom": { "type": "boolean", "example": false },
          "icon_name": { "type": "string", "example": "BUILDING" },
          "updated_at": { "type": "string", "example": "2025-01-01T00:00:00.000+01:00" }
        }
      },
      "bioses": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": { "$ref": "components.json#/components/response/schemas/id" },
            "manufacturer": { "type": "string", "example": "Dell" },
            "ssn": { "type": "string", "example": "1" },
            "model": { "type": "string", "example": "model description" },
            "version": { "type": "string", "example": "1" },
            "bios_date": { "type": "string", "example": "2020-01-01 00:00" },
            "reported_at": { "type": "string", "example": "2020-01-01 00:00" }
          }
        }
      },
      "asset_type": {
        "type": "object",
        "properties": {
          "id": { "$ref": "components.json#/components/response/schemas/id" },
          "account_id": { "$ref": "components.json#/components/response/schemas/id" },
          "parent_id": { "$ref": "components.json#/components/response/schemas/id" },
          "name": { "type": "string", "example": "Asset Type" }
        }
      },
      "vendor": {
        "type": "object",
        "properties": {
          "id": { "$ref": "components.json#/components/response/schemas/id" },
          "name": { "type": "string", "example": "Google" },
          "address": { "type": "string", "example": "address description" },
          "country": { "type": "string", "example": "US" },
          "city": { "type": "string", "example": "Texas" },
          "zip": { "type": "string", "example": "1" },
          "tech_support": { "type": "string", "example": "+000000000", "description": "support phone number" },
          "business_phone": { "type": "string", "example": "+000000000", "description": "business phone" },
          "url": { "type": "string", "example": "www.google.com" },
          "created_at": { "type": "string", "example": "2020-01-01T00:00:00.000+01:00" },
          "updated_at": { "type": "string", "example": "2020-10-01T00:00:00.000+01:00" }
        }
      },
      "procurement_items": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "name": { "type": "string", "example": "Item Name" },
            "version": { "type": "string", "example": "0.0.0" },
            "quantity": { "type": "string", "example": "1" },
            "notes": { "type": "string", "example": "Item notes" },
            "created_at": { "type": "string", "example": "2020-01-01T00:00:00.000+01:00" },
            "updated_at": { "type": "string", "example": "2020-10-01T00:00:00.000+01:00" },
            "tag": { "type": "string", "example": "example tag" }
          }
        }
      },
      "id_name_href": {
        "type": "object",
        "properties": {
          "id": { "$ref": "components.json#/components/response/schemas/id" },
          "name": { "type": "string", "example": "Object Name" },
          "href": { "type": "string", "example": "/objects/1" }
        }
      },
      "parent_object": {
        "type": "object",
        "properties": {
          "id": { "$ref": "components.json#/components/response/schemas/id" },
          "class": { "type": "string", "example": "Incident" }
        }
      },
      "purchase_order_items": {
        "type": "array",
        "items": { "$ref": "components.json#/components/response/schemas/purchase_order_item" }
      },
      "purchase_order_item": {
        "type": "object",
        "properties": {
          "created_at": { "type": "string", "example": "2020-01-01T00:00:00.000+01:00" },
          "updated_at": { "type": "string", "example": "2020-10-01T00:00:00.000+01:00" },
          "id": { "$ref": "components.json#/components/common/schemas/association_by_id" },
          "name": { "type": "string", "example": "Item Name" },
          "description": { "type": "string", "example": "Item Decription" },
          "serial_number": { "type": "string", "example": "XXXXX" },
          "part_number": { "$ref": "components.json#/components/common/schemas/number_or_string" },
          "price": { "$ref": "components.json#/components/common/schemas/number_or_string" },
          "quantity": { "$ref": "components.json#/components/common/schemas/number_or_string" },
          "discount": { "$ref": "components.json#/components/common/schemas/number_or_string" },
          "tax": { "$ref": "components.json#/components/common/schemas/number_or_string" }
        }
      }
    }
  },
  "common": {
    "schemas": {
      "association_by_id": {
        "anyOf": [{ "type": "string", "example": "1" }, { "type": "integer", "example": 1 }]
      },
      "ids_array": {
        "type": "array",
        "items": {
          "$ref": "components.json#/components/common/schemas/association_by_id"
        },
        "xml": { "wrapped": true },
        "description": "for xml requests, please add: type=\"array\", for example: <incident_ids type=\"array\"><incident_id>1</incident_id></incident_ids>"
      },
      "number_or_string": {
        "anyOf": [{ "type": "string", "example": "1" }, { "type": "integer", "example": 1 }]
      },
      "string_or_null": {
        "type": "string",
        "nullable": true,
        "example": "string"
      }
    }
  }
}

}