{
  "openapi": "3.0.1",
  "info": {
    "title": "Order Change Reasons",
    "description": "Fetch order change reason codes and descriptions.",
    "version": "9.1.20.0",
    "x-introduced": "9.1.13.0"
  },
  "servers": [
    {
      "url": "https://{hostname}:{port}/rest/admin/v2",
      "variables": {
        "port": {
          "default": "443",
          "enum": [
            "443",
            "8000"
          ]
        },
        "hostname": {
          "default": "localhost",
          "enum": [
            "localhost",
            "test.hcl.com"
          ]
        }
      }
    }
  ],
  "tags": [
    {
      "name": "Order Change Reasons",
      "description": "Provide RESTful services to fetch order change reason codes and descriptions."
    }
  ],
  "paths": {
    "/order-change-reasons": {
      "get": {
        "tags": [
          "Order Change Reasons"
        ],
        "description": "Get a collection of order Change reasons.",
        "operationId": "getChangeReasonCodes",
        "parameters": [
          {
            "name": "storeId",
            "in": "query",
            "description": "The unique identifier of the store which is associated to the order change reason. Please note any shared reasons, i.e. reasons associated with the store group (-1), will always be in the response.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "reasonType",
            "in": "query",
            "description": "A broad classification for the reason code. 'all' to select all reasons, 'reserved' to select only commerce reserved reasons for internal use, and 'user-defined' to select  user defined reasons for customization usage. It default to user-defined when it is not specified.",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "reserved",
                "user-defined"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A collection of order change reason codes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderChangeReasonCodeCollection"
                }
              }
            }
          },
          "400": {
            "description": "There was a client error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "500": {
            "description": "There was a server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          }
        }
      }
    },
    "/order-change-reasons/{id}": {
      "get": {
        "tags": [
          "Order Change Reasons"
        ],
        "description": "Get an order change reason code.",
        "operationId": "getChangeReasonCodeById",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The unique reason code Id for the change reason.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The order change reason code.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderChangeReasonCode"
                }
              }
            }
          },
          "400": {
            "description": "There was a client error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found.",
            "content": {}
          },
          "500": {
            "description": "There was a server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          }
        }
      }
    },
    "/order-change-reasons/{id}/descriptions": {
      "get": {
        "tags": [
          "Order Change Reasons"
        ],
        "description": "Get order change reason descriptions.",
        "operationId": "getChangeReasonDescriptionById",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The unique reason code Id for the change reason.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "dataLanguageIds",
            "required": true,
            "in": "query",
            "description": "The integer(s) for identifying the language of the order change reason descriptions. For a list of the integers that map to the supported default languages, refer to the Knowledge Center. Multiple identifiers should be specified as a comma-separated list.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The order change reason descriptions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderChangeReasonDescriptionCollection"
                }
              }
            }
          },
          "400": {
            "description": "There was a client error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found.",
            "content": {}
          },
          "500": {
            "description": "There was a server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "errorCode": {
            "type": "string",
            "description": "The error message code."
          },
          "errorMessage": {
            "type": "string",
            "description": "The error message."
          },
          "errorKey": {
            "type": "string",
            "description": "The error message key."
          },
          "errorParameters": {
            "type": "array",
            "description": "The arguments used to construct the error message.",
            "items": {
              "type": "object",
              "properties": {}
            }
          },
          "errorLevel": {
            "type": "string",
            "description": "The error level."
          },
          "errorHref": {
            "type": "string",
            "description": "The error hypertext reference."
          }
        },
        "description": "The error message item model."
      },
      "ErrorResponseContainer": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "description": "The request identifier."
          },
          "errors": {
            "type": "array",
            "description": "The errors.",
            "items": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "The error message model."
      },
      "OrderChangeReasonCode": {
        "type": "object",
        "required": [
          "code"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "The change reason code."
          },
          "id": {
            "type": "integer",
            "format": "int32",
            "description": "The unique identifier of the change reason."
          },
          "storeId": {
            "type": "integer",
            "format": "int32",
            "description": "The unique identifier of the store where the change reason can be applied to."
          }
        }
      },
      "OrderChangeReasonCodeCollection": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "description": "The items.",
            "items": {
              "$ref": "#/components/schemas/OrderChangeReasonCode"
            }
          }
        },
        "description": "A collection of order change reason codes."
      },
      "OrderChangeReasonDescriptionCollection": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "description": "The items.",
            "items": {
              "$ref": "#/components/schemas/OrderChangeReasonDescription"
            }
          }
        },
        "description": "A collection of order change reason descriptions."
      },
      "OrderChangeReasonDescription": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "description": "The order change reason description"
          },
          "languageId": {
            "type": "integer",
            "description": "The unique ID for identifying the language for the order change reason description.",
            "format": "int32"
          }
        },
        "description": "A language specific change reason description."
      }
    },
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "security": [
    {
      "basicAuth": []
    }
  ],
  "externalDocs": {
    "description": "Some REST services take languageId as a request parameter. For a list of the integers that map to the supported default languages, please refer to this Help Center page.",
    "url": "https://help.hcltechsw.com/commerce/9.1.0/database/database/language.html"
  }
}
