Creating an Interactive Session
Function
This API is used to create an interactive session. This API is synchronous and is used for interactive tools such as Notebook to connect to a Ray cluster. In federation user authentication scenarios, the secret name corresponding to the federation user identity is returned.
Calling Method
For details, see Calling APIs.
URI
POST /v2/workspaces/{workspace_id}/ray-sessions
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| workspace_id | Yes | String | Definition: Workspace ID. For details about how to obtain the workspace ID, see Obtaining a Workspace ID. Constraints: N/A Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | No | String | Definition: User token. It is obtained by calling the Obtaining an IAM User Token API. Constraints: N/A Range: Up to 65,534 characters. Default Value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Definition: Session name. Constraints: N/A Range: 1 to 47 characters. Only letters, digits, hyphens (-), periods (.), and spaces are allowed. Default Value: N/A |
| description | No | String | Definition: Description. Constraints: N/A Range: 0 to 1,024 characters. Default Value: N/A |
| endpoint_name | Yes | String | Definition: Endpoint name. Constraints: Complies with RFC 1035. Must start with a letter and end with a letter or digit. Range: 1 to 63 characters. A combination of lowercase letters, digits, and hyphens (-). Default Value: N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| session_id | String | Definition: Session ID. Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed. |
| secret_name | String | Definition: pod-agency secret name, used for mounting federation identity credentials. An empty string is returned if the scenario does not involve AI Hub federation authentication. Range: Up to 256 characters. Returns an empty string if left empty. |
| ray_grpc_server_port | String | Definition: Ray cluster gRPC connection port. Range: Up to 5 characters. Returns an empty string if left empty. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution description. Range: 0 to 4,096 characters. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution description. Range: 0 to 4,096 characters. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution description. Range: 0 to 4,096 characters. |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution description. Range: 0 to 4,096 characters. |
Status code: 408
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution description. Range: 0 to 4,096 characters. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution description. Range: 0 to 4,096 characters. |
Example Requests
Create an interactive session.
POST https://{endpoint}/v2/workspaces/{workspace_id}/ray-sessions
{
"name" : "my-session",
"description" : "Interactive session example",
"endpoint_name" : "ray"
} Example Responses
Status code: 200
{
"session_id" : "ac8111bf-3601-4905-8ddd-b41d3e636a4e",
"secret_name" : "pod_agency_myAgency_001234_20260717120000",
"ray_grpc_server_port" : "10001"
} Status code: 400
{
"error_code" : "common.01000001",
"error_msg" : "failed to read http request, please check your input, code: 400, reason: Type mismatch., cause: TypeMismatchException",
"solution_msg" : "Check whether the request parameters comply with the API definition and try again."
} Status code: 401
{
"error_code" : "APIG.1002",
"error_msg" : "Incorrect token or token resolution failed",
"solution_msg" : "Please check if auth token is included in the request header."
} Status code: 403
{
"error_code" : "APIG.1003",
"error_msg" : "X-Auth-Token is invalid in the request",
"solution_msg" : "Check whether the token in the request is valid and try again."
} Status code: 404
{
"error_code" : "common.01000001",
"error_msg" : "response status exception, code: 404",
"solution_msg" : "Please try to use correct info."
} Status code: 408
{
"error_code" : "common.00000408",
"error_msg" : "timeout exception occurred",
"solution_msg" : "The backend request timed out — check service health and network connectivity, then retry."
} Status code: 500
{
"error_code" : "common.00000500",
"error_msg" : "internal error",
"solution_msg" : "Contact operations for analysis."
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Response body for creating an interactive session. |
| 400 | Invalid request. |
| 401 | Unauthorized. |
| 403 | Request denied. |
| 404 | The requested resource could not be found. |
| 408 | Request timeout. |
| 500 | Internal server error. |
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot