This endpoint is in preview and may be modified or removed at any time.
To use this endpoint, add preview=true
to the request query parameters.
Adds a schema on an existing dataset using a PUT request.
Third-party applications using this endpoint via OAuth2 must request the following operation scope: api:datasets-write
.
object
string
The name of a Branch.
string
The Resource Identifier (RID) of the end Transaction.
object
The schema that will be added.
object
string
The name of a Branch.
string
The Resource Identifier (RID) of a Transaction.
object
The schema for a Foundry dataset. Files uploaded to this dataset must match this schema.
string
The version identifier of a dataset schema.
1
2
3
4
5
curl -X PUT \
-H "Content-type: application/json" \
-H "Authorization: Bearer $TOKEN" \
"https://$HOSTNAME/api/v2/datasets/ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da/putSchema?preview=true" \
-d '{"endTransactionRid":"ri.foundry.main.transaction.0a0207cb-26b7-415b-bc80-66a3aa3933f4","schema":{"fieldSchemaList":[{"name":"id","type":"long","nullable":false,"customMetadata":{"description":"Primary key"}},{"name":"event_time","type":"timestamp","nullable":false},{"name":"price","type":"decimal","precision":10,"scale":2,"nullable":true},{"name":"tags","type":"array","nullable":true,"arraySubtype":{"type":"string","nullable":false}},{"name":"metrics","type":"struct","nullable":true,"subSchemas":[{"name":"temperature","type":"double","nullable":true},{"name":"humidity","type":"double","nullable":true}]}]},"branchName":"master"}'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
"endTransactionRid": "ri.foundry.main.transaction.0a0207cb-26b7-415b-bc80-66a3aa3933f4",
"schema": {
"fieldSchemaList": [
{
"name": "id",
"type": "long",
"nullable": false,
"customMetadata": {
"description": "Primary key"
}
},
{
"name": "event_time",
"type": "timestamp",
"nullable": false
},
{
"name": "price",
"type": "decimal",
"precision": 10,
"scale": 2,
"nullable": true
},
{
"name": "tags",
"type": "array",
"nullable": true,
"arraySubtype": {
"type": "string",
"nullable": false
}
},
{
"name": "metrics",
"type": "struct",
"nullable": true,
"subSchemas": [
{
"name": "temperature",
"type": "double",
"nullable": true
},
{
"name": "humidity",
"type": "double",
"nullable": true
}
]
}
]
},
"versionId": "0000000d-2acf-537c-a228-3a9fe3cdc523",
"branchName": "master"
}
Error Name | ||
---|---|---|
Branch | Error Code | NOT_FOUND |
Status Code | 404 | |
Description | The requested branch could not be found, or the client token does not have access to it. | |
Parameters | datasetRid, branchName | |
Dataset | Error Code | NOT_FOUND |
Status Code | 404 | |
Description | The requested dataset could not be found, or the client token does not have access to it. | |
Parameters | datasetRid | |
Invalid | Error Code | INVALID_ARGUMENT |
Status Code | 400 | |
Description | The schema failed validations | |
Parameters | errorType, message | |
Dataset | Error Code | NOT_FOUND |
Status Code | 404 | |
Description | The requested dataset view could not be found. A dataset view represents the effective file contents of a dataset for a branch at a point in time, calculated from transactions (SNAPSHOT, APPEND, UPDATE, DELETE). The view may not exist if the dataset has no transactions, contains no files, the branch is not valid, or the client token does not have access to it. | |
Parameters | datasetRid, branch | |
Put | Error Code | PERMISSION_DENIED |
Status Code | 403 | |
Description | Could not putSchema the Dataset. | |
Parameters | datasetRid |
See Errors for a general overview of errors in the platform.