{
  "openapi": "3.0.1",
  "info": {
    "title": "Approval Status",
    "version": "9.1.20.0",
    "description": "Manage approval status resources.",
    "x-introduced": "9.1.0.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": "Approval Status",
      "description": "Provides RESTful services to manage approval status resources."
    }
  ],
  "paths": {
    "/approval-statuses": {
      "get": {
        "tags": [
          "Approval Status"
        ],
        "summary": "Find all approval status records available to the current user.",
        "operationId": "getApprovalStatuses",
        "parameters": [
          {
            "name": "flowTypeId",
            "in": "query",
            "description": "Query by flow type identifier which must be one of the values listed below.\n * 10001 - RFQ response\n * 10002 - Order approval\n * 10003 - Contract approval\n * 10004 - Buyer approval\n * 10005 - Seller org approval\n * 10006 - Seller approval",
            "schema": {
              "type": "string",
              "enum": [
                "10001",
                "10002",
                "10003",
                "10004",
                "10005",
                "10006"
              ]
            }
          },
          {
            "name": "submitterFirstName",
            "in": "query",
            "description": "Query by approval request submitter's first name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "submitterMiddleName",
            "in": "query",
            "description": "Query by approval request submitter's middle name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "submitterLastName",
            "in": "query",
            "description": "Query by approval request submitter's last name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "startSubmitDate",
            "in": "query",
            "description": "Query by approval request start time formatted as standard ISO date.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "endSubmitDate",
            "in": "query",
            "description": "Query by approval request end time formatted as standard ISO date.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Query by approval request status.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "description": "Query by approval request entity ID, such as order ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "approverId",
            "in": "query",
            "description": "Query by approver ID. Only returns approval requests that can be approved by the current user.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "The comma-separated set of properties that control the order of the listed items. Properties can be prefixed by either (-) to sort in descending order, or (+) to sort in ascending order. By default, properties are sorted in ascending order. For example, sort=name,-id will order the items first based on the name value in ascending order, and then by their ID value in descending order.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "searchString",
            "in": "query",
            "description": "Limits search results to only include users whose first name, last name or logon ID matches the value of this parameter.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "The position within the resulting dataset where the query begins returning item records. If the offset is \"5\", the records that returned begin with the sixth record that matches the query parameters. If the offset is \"0\", the records that are returned begin with the first record that matches the query parameters.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "The maximum number of records to return.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The requested completed successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalStatusCollection"
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Some of the inputs provided to the request aren't valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. The user session isn't valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "403": {
            "description": "The user isn't authorized to perform the specified request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error. Additional details will be contained on the server logs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          }
        }
      }
    },
    "/approval-statuses/{id}": {
      "get": {
        "tags": [
          "Approval Status"
        ],
        "summary": "Find an approval status record by its ID.",
        "operationId": "findByApprovalStatusId",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The unique numeric ID for identifying the approval status record.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The requested completed successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalStatus"
                },
                "example": {
                  "approveDate": "2021-06-24T05:20:58.032000000Z",
                  "approverLastName": "asd",
                  "approverId": "2",
                  "stateId": "10030",
                  "submitDate": "2021-06-24T05:20:46.771000000Z",
                  "entityId": "1004",
                  "approverGroupId": "8000000000000001502",
                  "approverMiddleName": null,
                  "submitterId": "1004",
                  "lastUpdate": "2021-06-24T05:20:58.032000000Z",
                  "approverFirstName": "asd",
                  "submitterLogonId": "buyer_buyerAOrg",
                  "submitterMiddleName": null,
                  "comment": null,
                  "id": "10007",
                  "submitterLastName": "asd",
                  "flowId": "10004",
                  "flowTypeId": "10004",
                  "submitterFirstName": null,
                  "approverLogonId": "cradmin",
                  "status": 1
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalStatus"
                }
              },
              "application/xhtml+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalStatus"
                }
              },
              "application/atom+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalStatus"
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Some of the inputs provided to the request aren't valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xhtml+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/atom+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. The user session isn't valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xhtml+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/atom+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "403": {
            "description": "The user isn't authorized to perform the specified request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xhtml+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/atom+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "404": {
            "description": "The specified resource couldn't be found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xhtml+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/atom+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error. Additional details will be contained on the server logs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xhtml+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/atom+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Approval Status"
        ],
        "summary": "Update the status to approve (1) or reject (2) and add an optional comment to the approval status record. Note that only an approval record that is pending approval. For example, an approval status record with a status of 0 can be approved or rejected. Only the status and comment property values from the body are used when updating the approval record.",
        "operationId": "updateApprovalStatus",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The unique numeric ID for identifying the approval status record.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The request body for updating an approval status record.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApprovalStatus"
              },
              "example": {
                "approveDate": "2021-06-24T05:20:58.032000000Z",
                "approverLastName": "asd",
                "approverId": "2",
                "stateId": "10030",
                "submitDate": "2021-06-24T05:20:46.771000000Z",
                "entityId": "1004",
                "approverGroupId": "8000000000000001502",
                "approverMiddleName": null,
                "submitterId": "1004",
                "lastUpdate": "2021-06-24T05:20:58.032000000Z",
                "approverFirstName": "asd",
                "submitterLogonId": "buyer_buyerAOrg",
                "submitterMiddleName": null,
                "comment": null,
                "id": "10007",
                "submitterLastName": "asd",
                "flowId": "10004",
                "flowTypeId": "10004",
                "submitterFirstName": null,
                "approverLogonId": "cradmin",
                "status": 1
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The requested completed successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/approval-statuses"
                },
                "example": {
                  "resultmsg": "approvalsFailed",
                  "viewTaskName": "RedirectView",
                  "redirecturl": ""
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Some of the inputs provided to the request aren't valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xhtml+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/atom+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. The user session isn't valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xhtml+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/atom+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "403": {
            "description": "The user isn't authorized to perform the specified request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xhtml+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/atom+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error. Additional details will be contained on the server logs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/xhtml+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              },
              "application/atom+xml": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          }
        },
        "x-codegen-request-body-name": "body"
      }
    }
  },
  "components": {
    "schemas": {
      "ErrorResponseContainer": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Error"
            }
          },
          "requestId": {
            "type": "string",
            "description": "The request identifier."
          }
        },
        "description": "The error message model."
      },
      "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."
      },
      "ApprovalStatusCollection": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer",
            "description": "The number of approval status records in total based on the query parameters specified.",
            "format": "int32"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalStatus"
            }
          },
          "limit": {
            "type": "integer",
            "description": "The number of approval status records returned.",
            "format": "int32"
          },
          "offset": {
            "type": "integer",
            "description": "The starting position of the first approval status record.",
            "format": "int32"
          }
        }
      },
      "ApprovalStatus": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The unique identifier of the approval status record."
          },
          "approveDate": {
            "type": "string",
            "description": "The time when the approval record was acted on; that is, the time it was approved or rejected.",
            "format": "date"
          },
          "approverGroupId": {
            "type": "string",
            "description": "The unique numeric ID for identifying the member group to which the approver belongs, making the approver an approver for this record."
          },
          "approverId": {
            "type": "string",
            "description": "The unique numeric ID for identifying the user eligible to approve or reject the requested action."
          },
          "comment": {
            "type": "string",
            "nullable": true,
            "description": "Comments entered by approver during approval or rejection."
          },
          "entityId": {
            "type": "string",
            "description": "A reference to an approval status object instance within a flow type."
          },
          "flowId": {
            "type": "string",
            "description": "Reference to the flow for the steps in the approval process."
          },
          "flowTypeId": {
            "type": "string",
            "description": "Reference to the type of flow that determines the type of business object included in the approval. There are different IDs for each type of approval, including RFQ, order, user registration, contract, organization registration approvals and so on."
          },
          "stateId": {
            "type": "string",
            "description": "The current state of the approval flow."
          },
          "status": {
            "type": "integer",
            "description": "Approval status of this action. Valid values are as follows: \n0=pending\n1=approved\n2=rejected.",
            "format": "int32"
          },
          "submitDate": {
            "type": "string",
            "description": "The time that the action requiring approval was requested.",
            "format": "date"
          },
          "submitterId": {
            "type": "string",
            "description": "ID of the user requesting the action which needs approval."
          },
          "approverLastName": {
            "type": "string"
          },
          "approverMiddleName": {
            "type": "string",
            "nullable": true
          },
          "lastUpdate": {
            "type": "string"
          },
          "approverFirstName": {
            "type": "string"
          },
          "submitterLogonId": {
            "type": "string"
          },
          "submitterMiddleName": {
            "type": "string",
            "nullable": true
          },
          "submitterLastName": {
            "type": "string"
          },
          "submitterFirstName": {
            "type": "string",
            "nullable": true
          },
          "approverLogonId": {
            "type": "string"
          }
        }
      },
      "approval-statuses": {
        "type": "object",
        "properties": {
          "redirecturl": {
            "type": "string"
          },
          "resultmsg": {
            "type": "string"
          },
          "viewTaskName": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "security": [
    {
      "basicAuth": []
    }
  ]
}
