Save external units

POST /v1/api/units.json

Operation id: saveExternalUnits

Description

Creates or updates units for the domain (EDIT^UNITS). Multipart body; provide unit_details and/or data_load_details.

Validation rule: at least one save input must be provided — unit_details or data_load_details. Send idempotency-key to make retries safe.

Tags: Units

Parameters

Header parameters

NameTypeRequiredDescription
idempotency-keystringNoOptional but recommended client-supplied unique identifier for a write request. Used by save / delete endpoints to make retries idempotent. Use a UUID v4 or similar.
X-reflexis-auth-token-XstringYesMandatory auth token header value provided by the user.

Responses

200 — List of transaction statuses

Content type: application/json

400 — One or more request parameters are invalid.

Content type: application/json

401 — Authentication failed. The request is missing a token, the token is invalid, or the token has expired.

Content type: application/json

403 — User lacks the required permission for this operation.

Content type: application/json

500 — An unexpected error occurred while processing the request.

Content type: application/json

Request body

Required: Yes

multipart/form-data

Schema

PropertyTypeRequiredDescription
data_load_detailsstring (binary)No
unit_detailsarrayNoJSON array of unit objects.
{
  "type": "object",
  "properties": {
    "data_load_details": {
      "type": "string",
      "format": "binary"
    },
    "unit_details": {
      "type": "array",
      "description": "JSON array of unit objects.",
      "items": {
        "type": "object",
        "properties": {
          "unit_id": {
            "type": "string"
          },
          "unit_name": {
            "type": "string"
          },
          "parent_unit_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "org_level": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              }
            ]
          },
          "unit_category": {
            "type": "string"
          },
          "time_zone": {
            "type": "string"
          },
          "unit_radius": {
            "type": "number",
            "nullable": true
          },
          "language": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "latitude": {
            "type": "number",
            "nullable": true
          },
          "longitude": {
            "type": "number",
            "nullable": true
          },
          "street": {
            "type": "string",
            "nullable": true
          },
          "zip_code": {
            "type": "string",
            "nullable": true
          },
          "county": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "email_id": {
            "type": "string"
          },
          "tel_no": {
            "type": "string",
            "nullable": true
          },
          "fax_no": {
            "type": "string",
            "nullable": true
          },
          "functional_parent_id": {
            "type": "string",
            "nullable": true
          },
          "status_of_date": {
            "type": "string",
            "nullable": true
          },
          "unit_logo": {
            "type": "object"
          },
          "description_lang_map": {
            "type": "object"
          },
          "dept_id": {
            "type": "string"
          }
        }
      }
    }
  }
}

Response models

200 — List of transaction statuses

Content type: application/json

Schema

{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "status_code": {
        "type": "integer"
      },
      "meta_info": {
        "type": "object"
      },
      "message": {
        "type": "string"
      }
    }
  }
}

400 — One or more request parameters are invalid.

Content type: application/json

Schema

Structured error envelope returned by external gateway endpoints (/v1/api/*). Wraps a single error object with type, code, human-readable message, the offending param (when applicable), and an optional documentation URL.

PropertyTypeRequiredDescription
errorobjectNo
{
  "type": "object",
  "description": "Structured error envelope returned by external gateway endpoints (`/v1/api/*`).\nWraps a single `error` object with `type`, `code`, human-readable `message`, the offending\n`param` (when applicable), and an optional documentation URL.\n",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "High-level error category (for example `unauthorized`, `invalid_parameter`, `validation_error`).",
          "example": "invalid_parameter"
        },
        "code": {
          "type": "string",
          "description": "Machine-readable error code; clients should branch on this rather than `message`.",
          "example": "invalid_parameter"
        },
        "message": {
          "type": "string",
          "description": "Human-readable description of the error.",
          "example": "One or more request parameters are invalid."
        },
        "param": {
          "type": "string",
          "description": "Name of the request parameter or field that caused the error, when applicable.",
          "example": "page_number",
          "nullable": true
        },
        "doc_url": {
          "type": "string",
          "description": "Optional URL to documentation describing the error.",
          "example": "https://{APP_URL}/kernel/errors/invalid_parameter",
          "nullable": true
        }
      }
    }
  }
}

401 — Authentication failed. The request is missing a token, the token is invalid, or the token has expired.

Content type: application/json

Schema

Structured error envelope returned by external gateway endpoints (/v1/api/*). Wraps a single error object with type, code, human-readable message, the offending param (when applicable), and an optional documentation URL.

PropertyTypeRequiredDescription
errorobjectNo
{
  "type": "object",
  "description": "Structured error envelope returned by external gateway endpoints (`/v1/api/*`).\nWraps a single `error` object with `type`, `code`, human-readable `message`, the offending\n`param` (when applicable), and an optional documentation URL.\n",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "High-level error category (for example `unauthorized`, `invalid_parameter`, `validation_error`).",
          "example": "invalid_parameter"
        },
        "code": {
          "type": "string",
          "description": "Machine-readable error code; clients should branch on this rather than `message`.",
          "example": "invalid_parameter"
        },
        "message": {
          "type": "string",
          "description": "Human-readable description of the error.",
          "example": "One or more request parameters are invalid."
        },
        "param": {
          "type": "string",
          "description": "Name of the request parameter or field that caused the error, when applicable.",
          "example": "page_number",
          "nullable": true
        },
        "doc_url": {
          "type": "string",
          "description": "Optional URL to documentation describing the error.",
          "example": "https://{APP_URL}/kernel/errors/invalid_parameter",
          "nullable": true
        }
      }
    }
  }
}

403 — User lacks the required permission for this operation.

Content type: application/json

Schema

Structured error envelope returned by external gateway endpoints (/v1/api/*). Wraps a single error object with type, code, human-readable message, the offending param (when applicable), and an optional documentation URL.

PropertyTypeRequiredDescription
errorobjectNo
{
  "type": "object",
  "description": "Structured error envelope returned by external gateway endpoints (`/v1/api/*`).\nWraps a single `error` object with `type`, `code`, human-readable `message`, the offending\n`param` (when applicable), and an optional documentation URL.\n",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "High-level error category (for example `unauthorized`, `invalid_parameter`, `validation_error`).",
          "example": "invalid_parameter"
        },
        "code": {
          "type": "string",
          "description": "Machine-readable error code; clients should branch on this rather than `message`.",
          "example": "invalid_parameter"
        },
        "message": {
          "type": "string",
          "description": "Human-readable description of the error.",
          "example": "One or more request parameters are invalid."
        },
        "param": {
          "type": "string",
          "description": "Name of the request parameter or field that caused the error, when applicable.",
          "example": "page_number",
          "nullable": true
        },
        "doc_url": {
          "type": "string",
          "description": "Optional URL to documentation describing the error.",
          "example": "https://{APP_URL}/kernel/errors/invalid_parameter",
          "nullable": true
        }
      }
    }
  }
}

500 — An unexpected error occurred while processing the request.

Content type: application/json

Schema

Structured error envelope returned by external gateway endpoints (/v1/api/*). Wraps a single error object with type, code, human-readable message, the offending param (when applicable), and an optional documentation URL.

PropertyTypeRequiredDescription
errorobjectNo
{
  "type": "object",
  "description": "Structured error envelope returned by external gateway endpoints (`/v1/api/*`).\nWraps a single `error` object with `type`, `code`, human-readable `message`, the offending\n`param` (when applicable), and an optional documentation URL.\n",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "High-level error category (for example `unauthorized`, `invalid_parameter`, `validation_error`).",
          "example": "invalid_parameter"
        },
        "code": {
          "type": "string",
          "description": "Machine-readable error code; clients should branch on this rather than `message`.",
          "example": "invalid_parameter"
        },
        "message": {
          "type": "string",
          "description": "Human-readable description of the error.",
          "example": "One or more request parameters are invalid."
        },
        "param": {
          "type": "string",
          "description": "Name of the request parameter or field that caused the error, when applicable.",
          "example": "page_number",
          "nullable": true
        },
        "doc_url": {
          "type": "string",
          "description": "Optional URL to documentation describing the error.",
          "example": "https://{APP_URL}/kernel/errors/invalid_parameter",
          "nullable": true
        }
      }
    }
  }
}