Help Center/ KooDrive/ API Reference/ API/ Session Management/ Initializing and Creating a Session
Updated on 2025-03-07 GMT+08:00

Initializing and Creating a Session

Function

Initialize and create a session.

URI

POST /koodrive/ose/v1/session/

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Traceid

No

String

Message log trace ID. The value contains 58 bits.

language

No

String

Language code, which complies with the internationalization specifications. For example, en-US indicates English (United States). English (United States) is used by default.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

code

Yes

String

Authorization code.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

code

Integer

Response code.

msg

String

Response information.

data

SessionUserDto object

Authorization code required by the service API.

Table 4 SessionUserDto

Parameter

Type

Description

accessToken

String

Authorization code required by the service API.

sessionId

String

Session ID.

userId

String

User ID.

userInfo

SessionUserInfo object

Enterprise-level user information.

Table 5 SessionUserInfo

Parameter

Type

Description

role

String

Role.

  • 0: common administrator.

  • 1: common user.

  • 2: super administrator.

userName

String

Username.

innerUserId

String

Internal user ID.

userId

String

External user ID.

tenantId

String

Tenant code, that is, enterprise code.

orgId

String

orgId

orgName

String

Name in OrgID.

xHwSchema

String

Database object set allocated to the tenant.

userCount

Integer

Number of users.

deptId

String

Department ID.

Example Requests

Request for initializing a session.

  POST /koodrive/ose/v1/session

{
  "code" : "FrbMohdqi86v6sMZlFSSuG3E0_9RsDpL08BlYfNQPhvibLET266cQhDI_WczEXJOAoIoKGCdqN2shKX1yfqrVci8nSFdMlxljNFhoffVvH93uSzIoyFxK4P7yhY6fDXa",
  "domain" : "kdconsole-***-***.************.cn:8080"
}

Example Responses

Status code: 200

Session response information.

   ​​​{
    "data": {
        "accessToken": "Bearer 6ebb6266dd5cdefa1d7126af2eb6173ce0a054d8ba4295be",
        "sessionId": "c17c8903e9382a0aa1b82e9d42cb82ba12760a18d6cf018d",
        "userId": "1008600000701011122",
        "userInfo": {
            "role": "2",
            "userName": "199******04",
            "innerUserId": "1574641576007768198",
            "userId": "1008600000701011122",
            "tenantId": "28389189a7744593a59940c0d0fcd451",
            "orgId": "9190086000001721760",
            "orgName": "lym09",
            "deptId": "1574641574824974465",
            "userCount": 40,
            "xhwSchema": "tenants1_liantiao"
        }
    },
    "code": 0,
    "msg": "Successful"
}

Status Codes

Status Code

Description

200

Session response information.