Request new session

post/contexts/{contextId}/sessions
Internal-Use Only

Creates a new session that is based on the Compute context definition that corresponds to the contextId path variable. If a reusable SAS Compute Server is available to handle this session, a new session is created on that SAS Compute Server. Otherwise, a new SAS Compute Server is created and the new session is created on that SAS Compute Server. The new session is associated with the identity of the requester. URLs that define how to access the session are returned. The contextId matches the ID member of a known context entry. The Location header contains the URI of the created session resource.

Request Samples

1

Response Samples

1{
2 "listingStatistics": {
3 "lineCount": 5,
4 "modifiedTimeStamp": "2017-02-20T19:17:33Z"
5 },
6 "logStatistics": {
7 "lineCount": 45,
8 "modifiedTimeStamp": "2017-02-20T19:17:33Z"
9 },
10 "serviceAPIVersion": 4,
11 "sessionConditionCode": 0,
12 "stateElapsedTime": 21,
13 "attributes": {
14 "sessionInactiveTimeout": 60
15 },
16 "state": "idle",
17 "owner": "myUserID",
18 "environment": {
19 "options": [
20 "memsize=4g",
21 "fullstimer"
22 ]
23 },
24 "creationTimeStamp": "2016-09-28T14:26:14Z",
25 "serverId": "c1a108bb-6019-4876-807f-eeac467b9c08",
26 "description": "This is my test session.",
27 "id": "c1a108bb-6019-4876-807f-eeac467b9c08-ses0000",
28 "links": [
29 {
30 "method": "GET",
31 "rel": "self",
32 "href": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000",
33 "uri": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000",
34 "type": "application/vnd.sas.compute.session"
35 },
36 {
37 "method": "GET",
38 "rel": "alternate",
39 "href": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000",
40 "uri": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000",
41 "type": "application/vnd.sas.compute.session.summary"
42 },
43 {
44 "method": "GET",
45 "rel": "state",
46 "href": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/state",
47 "uri": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/state",
48 "type": "text/plain"
49 },
50 {
51 "method": "PUT",
52 "rel": "cancel",
53 "href": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/state?state=canceled",
54 "uri": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/state?state=canceled"
55 },
56 {
57 "method": "DELETE",
58 "rel": "delete",
59 "href": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000",
60 "uri": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000"
61 },
62 {
63 "method": "POST",
64 "rel": "execute",
65 "href": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/jobs",
66 "uri": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/jobs",
67 "type": "application/vnd.sas.compute.job.request",
68 "responseType": "application/vnd.sas.compute.job"
69 },
70 {
71 "method": "GET",
72 "rel": "jobs",
73 "href": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/jobs",
74 "uri": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/jobs",
75 "type": "application/vnd.sas.collection",
76 "itemType": "application/vnd.sas.compute.job"
77 },
78 {
79 "method": "GET",
80 "rel": "files",
81 "href": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/filerefs",
82 "uri": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/filerefs",
83 "type": "application/vnd.sas.collection",
84 "itemType": "application/vnd.sas.compute.fileref.summary"
85 },
86 {
87 "method": "POST",
88 "rel": "assignFileref",
89 "href": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/filerefs",
90 "uri": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/filerefs",
91 "type": "application/vnd.sas.compute.fileref.request",
92 "responseType": "application/vnd.sas.compute.fileref"
93 },
94 {
95 "method": "GET",
96 "rel": "librefs",
97 "href": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/data",
98 "uri": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/data",
99 "type": "application/vnd.sas.collection",
100 "itemType": "application/vnd.sas.compute.library.summary"
101 },
102 {
103 "method": "GET",
104 "rel": "log",
105 "href": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/log",
106 "uri": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/log",
107 "type": "application/vnd.sas.collection",
108 "itemType": "application/vnd.sas.compute.log.line"
109 },
110 {
111 "method": "GET",
112 "rel": "listing",
113 "href": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/listing",
114 "uri": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/listing",
115 "type": "application/vnd.sas.collection",
116 "itemType": "application/vnd.sas.compute.log.line"
117 },
118 {
119 "method": "GET",
120 "rel": "results",
121 "href": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/results",
122 "uri": "/compute/sessions/c1a108bb-6019-4876-807f-eeac467b9c08-ses0000/results",
123 "type": "application/vnd.sas.collection",
124 "itemType": "application/vnd.sas.compute.result"
125 }
126 ],
127 "version": 2,
128 "name": "MySession"
129}

Path Parameters

NameTypeRequiredDescription
contextId
string
true

Specifies the context definition ID.

Request Body

Provides an object that you use to request a new Compute session.

Example:
{"version":1,"name":"MySession","description":"This is my session for doing some simple work.","attributes":{"sessionInactiveTimeout":60},"environment":{"options":["memsize=4g","fullstimer"]},"resources":[{"name":"file1","uri":"/files/files/ea0d3ee1-894f-4936-bc2b-f611a878a0dd","type":"application/vnd.sas.file","scope":"SESSION","options":{"LRECL":1024}}]}
NameTypeRequiredDescription
version
integer<int32>
false

Specifies the version number of this representation schema. This is version 2.

name
string
false

Specifies an optional name that is associated with this session. The value of name is limited to 100 characters. The name is used for informational purposes only.

description
string
false

Specifies an optional description for this session. The value of description is limited to 1000 characters.

attributes
object
false

Specifies service-specific attributes that control the behavior of this session. See the example for details.

environment
SAS Environment
false

Provides the SAS options and initialization code that is used by the Compute service and its sessions.

resources
array [External Resource]
false

Specifies the resources that are requested for this session.

Responses

StatusMeaningDescription
201CreatedA session and data were created.HeadersSchema
400Bad RequestThe request was invalid.Schema
404Not FoundNo context definition exists at the requested path.Schema