Upload a data file to the collection of tables

post/servers/{serverName}/caslibs/{caslibName}/tables
Internal-Use Only

Uploads a data file to the table collections using a multipart form-data post. Supported data files are csv, xls, xlsx/xlsm, sas7bdat and sashdat.

Request Samples

1

Response Samples

1{
2 "version": 3,
3 "name": "CUSTOMERS",
4 "tableReference": {
5 "tableUri": "/dataTables/dataSources/cas~fs~cas-shared-default~fs~CASUSER/tables/CUSTOMERS",
6 "sessionId": "ad0b5228-cc89-874c-8893-c1c420f6e0cb",
7 "sourceCaslibName": "CASUSER",
8 "sourceTableName": "CUSTOMERS.sashdat"
9 },
10 "serverName": "cas-shared-default",
11 "caslibName": "CASUSER",
12 "scope": "global",
13 "state": "loaded",
14 "repeated": false,
15 "created": "2017-04-11T17:17:15.373000Z",
16 "lastModified": "2017-04-11T18:50:42.106000Z",
17 "createdBy": "userid",
18 "lastModifiedBy": "userid",
19 "lastAccessed": "2017-04-11T19:12:13.102000Z",
20 "sourceLastModified": "2017-03-12T03:43:22.101000Z",
21 "label": "My table label",
22 "rowCount": 160,
23 "columnCount": 9,
24 "characterSet": "UTF8",
25 "encoding": "utf-8",
26 "disconnected": false,
27 "attributes": {
28 "owner": "someuser",
29 "size": 115704,
30 "encryption": "NONE",
31 "time": "18Nov2016:15:27:28",
32 "group": "users"
33 },
34 "links": [
35 {
36 "method": "GET",
37 "rel": "up",
38 "href": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables",
39 "uri": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables",
40 "type": "application/vnd.sas.collection",
41 "itemType": "application/vnd.sas.cas.table"
42 },
43 {
44 "method": "GET",
45 "rel": "self",
46 "href": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables/CUSTOMERS",
47 "uri": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables/CUSTOMERS",
48 "type": "application/vnd.sas.cas.table"
49 },
50 {
51 "method": "DELETE",
52 "rel": "delete",
53 "href": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables/CUSTOMERS",
54 "uri": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables/CUSTOMERS"
55 },
56 {
57 "method": "PUT",
58 "rel": "updateState",
59 "href": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables/CUSTOMERS/state",
60 "uri": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables/CUSTOMERS/state"
61 },
62 {
63 "method": "PUT",
64 "rel": "updateScope",
65 "href": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables/CUSTOMERS/scope",
66 "uri": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables/CUSTOMERS/scope",
67 "responseType": "application/json;text/plain"
68 },
69 {
70 "method": "GET",
71 "rel": "summaryStatistics",
72 "href": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables/CUSTOMERS/summaryStatistics",
73 "uri": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables/CUSTOMERS/summaryStatistics",
74 "type": "application/vnd.sas.collection",
75 "itemType": "application/vnd.sas.cas.column"
76 },
77 {
78 "method": "GET",
79 "rel": "distinctCount",
80 "href": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables/CUSTOMERS/distinctCount",
81 "uri": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables/CUSTOMERS/distinctCount",
82 "type": "application/vnd.sas.collection",
83 "itemType": "application/vnd.sas.cas.column"
84 },
85 {
86 "method": "GET",
87 "rel": "columns",
88 "href": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables/CUSTOMERS/columns",
89 "uri": "/casManagement/servers/cas-shared-default/caslibs/CASUSER/tables/CUSTOMERS/columns",
90 "type": "application/vnd.sas.collection",
91 "itemType": "application/vnd.sas.cas.column"
92 },
93 {
94 "method": "GET",
95 "rel": "dataTable",
96 "href": "/dataTables/dataSources/cas~fs~cas-shared-default~fs~CASUSER/tables/CUSTOMERS",
97 "uri": "/dataTables/dataSources/cas~fs~cas-shared-default~fs~CASUSER/tables/CUSTOMERS",
98 "type": "application/vnd.sas.data.table"
99 }
100 ]
101}

Path Parameters

NameTypeRequiredDescription
caslibName
string
true

The Caslib name for which tables are being requested.

serverName
string
true

Server name for which tables are being requested.

Request Body

NameTypeRequiredDescription
sessionId
string
false

Session ID (used when session-specific tables are also desired in results).

tableName
string
true

The name of the table to be created.

variables
string
false

The optional list of variables and their attributes, in JSON format. The value is a single string containing a JSON array of variable objects, each describing a variable and one or more of its attributes. When not specified, the best guess for column attributes will be made. When uploading csv data, containsHeaderRow should be set to true and a header row provided to ensure column names are properly set. This option then further sets attributes of those columns. Each variable in the array may have one or more of the following properties.

indexVars
array [string]
false

An optional list of variables in the uploaded data. The corresponding variables in the resulting table are marked as indexed. The parameter is valid for csv, xls, and xlsx files only.

format
string
true

Format of the data file. The supported formats are \csv, \xls, \xlsx, \sas7bdat\ and \sashdat.

label
string
false

Label placed on the new table.

scope
string
false

The scope to which to load the table. Valid values include global and session. Defaults to global.

replace
boolean
false

If true, any pre-existing table with the same name will be replaced. Defaults to false.

encoding
string
false

Encoding of the file contents. The parameter is valid for CSV files only. Defaults to utf-8.

allowTruncation
boolean
false

Allow truncation of character data that is too long for a given field. The parameter is valid for CSV files only. Defaults to true.

allowEmbeddedNewLines
boolean
false

Preserves new lines that are embedded in text fields. The parameter is valid for CSV files only. Defaults to false.

delimiter
string
false

Delimiter character. The parameter is valid for CSV files only. Defaults to ','.

varchars
boolean
false

Use variable character lengths. The parameter is valid for CSV files only. Defaults to true.

scanRows
integer<int64>
false

Number of rows to scan when determining column types. The parameter is valid for CSV files only. Default is 20. Set to zero to scan all rows in the file.

threadCount
integer<int64>
false

Number of threads to use on each CAS node to process the CSV data. The parameter is valid for CSV files only. Default is one thread per licensed CPU. Set to 0 to use the default.

stripBlanks
boolean
false

If true, remove leading and trailing blanks from character variables. The parameter is valid for CSV files only. Defaults to false.

containsHeaderRow
boolean
false

If true, first row is used for column names. The parameter is valid for csv, xls and xlsx files only. Defaults to false.

sheetName
string
false

Specifies the name of worksheet to import from a Microsoft Excel file. The parameter is valid for xls and xlsx files only. If no sheet name is specified, the first sheet is used.

password
string
false

Password used to read a protected SAS data set. The parameter is valid for sas7bdat files only.

decryptionKey
string
false

Key used to decrypt the data file. The parameter is valid for sas7bdat and sashdat files only.

stringLengthMultiplier
integer<double>
false

Specifies to increase the width of fixed-byte-width character columns. The number of bytes needed for multi-byte characters depends on the particular characters in the string. The parameter is valid for sas7bdat files only.

varcharConversionThreshold
integer<double>
false

Sets a threshold in bytes so that columns of type 'char' whose length meets or exceeds the threshold are converted to type 'varchar'. For example, if varcharConversionThreshold=20, a 'char' column of length 20 is converted to 'varchar' but a 'char' column of length 19 is not converted. The parameter is valid for sas7bdat files only.

varcharConversion
integer<double>
false

Acts as an alias for varcharConversionThreshold. If both varcharConversion and varcharConversionThreshold are provided, the value of varcharConversionThreshold will be used. The parameter is valid for sas7bdat files only.

file
string
true

Data file in one of the supported formats. This MUST be the last parameter.

Responses

StatusMeaningDescription
201CreatedThe list of newly uploaded tables was returned.Schema
400Bad RequestThe request was invalid.Schema
404Not FoundThe requested CAS server or Caslib does not exist.
409ConflictThe request could not be completed due to a conflict with the current state of the resource. Details are included in the response body.