Get authenticated user organization structure

GET /mywork/v1/org-structure

Operation id: getUserOrgStructure

Description

Returns the Kernel user org-structure payload for the authenticated session (home unit, home unit departments, switchable units, current unit departments, etc.).

Next-gen replacement for legacy POST /service/execute/getUserOrgStructureInfo. Authentication is Kernel token validation (X-reflexis-csrf-token-X) via ApiUserSessionUtils. The service then calls LoginService / ServiceRouter with isAlreadyAuthenticated=Y, which skips the MyWork RRC_USER_AUTH lookup (same pattern as UIC config and other next-gen → LoginService flows).

Authentication: domainId and user identity are resolved from the validated session. They cannot be overridden by the client.


Error Scenarios

ScenarioHTTPError CodeMessage
Missing X-reflexis-csrf-token-X header400E112X-reflexis-csrf-token-X header is mandatory
Invalid or expired token401E204Invalid or expired token
Kernel org-structure fetch failed / empty500E357Unable to fetch user org structure

Error Codes Reference

CodeDescription
E112X-reflexis-csrf-token-X header is mandatory
E204Invalid or expired token
E357Unable to fetch user org structure

Tags: MyWorkOrgStructure

Security

  • AuthTokenHeader (apiKey)
    • Session authentication token validated server-side against the user session store.

Responses

200 — Success — Kernel org-structure payload under org_structure

Content type: application/json

400 — Invalid or missing request parameter

Content type: application/json

401 — Invalid or expired X-reflexis-csrf-token-X token (HTTP 401)

Content type: application/json

500 — E357 — unable to fetch user org structure

Content type: application/json

Response models

200 — Success — Kernel org-structure payload under org_structure

Content type: application/json

Schema

PropertyTypeRequiredDescription
statusstringYes
org_structureobjectYesKernel org-structure map (keys converted to snake_case in the response), plus unit_category from the authenticated session (UserSession.unitCategory). Typical fields include home_unit, home_unit_departments, switchable_units, current_unit_departments, dept_ids, profile_ids, unit_category.
{
  "type": "object",
  "required": [
    "status",
    "org_structure"
  ],
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "OK"
      ]
    },
    "org_structure": {
      "type": "object",
      "description": "Kernel org-structure map (keys converted to snake_case in the response),\nplus `unit_category` from the authenticated session (`UserSession.unitCategory`).\nTypical fields include `home_unit`, `home_unit_departments`,\n`switchable_units`, `current_unit_departments`, `dept_ids`, `profile_ids`,\n`unit_category`.\n"
    }
  }
}

Example:

{
  "status": "OK",
  "org_structure": {
    "unit_category": "S",
    "home_unit": {
      "unit_id": "10001",
      "unit_name": "Store 10001",
      "dept_ids": [
        "STORE",
        "Ph"
      ],
      "profile_ids": [
        "MGR"
      ]
    },
    "home_unit_departments": [
      {
        "dept_id": "STORE,Ph",
        "dept_name": "All My Departments",
        "child_departments": null
      },
      {
        "dept_id": "STORE",
        "dept_name": "Store",
        "child_departments": [
          {
            "dept_id": "Ph",
            "dept_name": "Pharmacy",
            "child_departments": []
          }
        ]
      }
    ],
    "switchable_units": []
  }
}

400 — Invalid or missing request parameter

Content type: application/json

Schema

PropertyTypeRequiredDescription
statusstringYesAlways "ER" for error responses
errorCodestringYesApplication-level error code (e.g. E204, E112, E302)
responsestringYesHuman-readable error message
{
  "type": "object",
  "example": {
    "status": "ER",
    "errorCode": "E204",
    "response": "Invalid or expired token"
  },
  "required": [
    "status",
    "errorCode",
    "response"
  ],
  "properties": {
    "status": {
      "type": "string",
      "description": "Always \"ER\" for error responses",
      "enum": [
        "ER"
      ]
    },
    "errorCode": {
      "type": "string",
      "description": "Application-level error code (e.g. E204, E112, E302)"
    },
    "response": {
      "type": "string",
      "description": "Human-readable error message"
    }
  }
}

401 — Invalid or expired X-reflexis-csrf-token-X token (HTTP 401)

Content type: application/json

Schema

PropertyTypeRequiredDescription
statusstringYesAlways "ER" for error responses
errorCodestringYesApplication-level error code (e.g. E204, E112, E302)
responsestringYesHuman-readable error message
{
  "type": "object",
  "example": {
    "status": "ER",
    "errorCode": "E204",
    "response": "Invalid or expired token"
  },
  "required": [
    "status",
    "errorCode",
    "response"
  ],
  "properties": {
    "status": {
      "type": "string",
      "description": "Always \"ER\" for error responses",
      "enum": [
        "ER"
      ]
    },
    "errorCode": {
      "type": "string",
      "description": "Application-level error code (e.g. E204, E112, E302)"
    },
    "response": {
      "type": "string",
      "description": "Human-readable error message"
    }
  }
}

Example:

{
  "status": "ER",
  "errorCode": "E204",
  "response": "Invalid or expired token"
}

500 — E357 — unable to fetch user org structure

Content type: application/json

Schema

PropertyTypeRequiredDescription
statusstringYesAlways "ER" for error responses
errorCodestringYesApplication-level error code (e.g. E204, E112, E302)
responsestringYesHuman-readable error message
{
  "type": "object",
  "example": {
    "status": "ER",
    "errorCode": "E204",
    "response": "Invalid or expired token"
  },
  "required": [
    "status",
    "errorCode",
    "response"
  ],
  "properties": {
    "status": {
      "type": "string",
      "description": "Always \"ER\" for error responses",
      "enum": [
        "ER"
      ]
    },
    "errorCode": {
      "type": "string",
      "description": "Application-level error code (e.g. E204, E112, E302)"
    },
    "response": {
      "type": "string",
      "description": "Human-readable error message"
    }
  }
}

Example:

{
  "status": "ER",
  "errorCode": "E357",
  "response": "Unable to fetch user org structure"
}