Search documentation
karat

+

K

User Documentation ↗
Version 2.0

Create View

POST/api/v2/datasets/views
Warning

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.

Create a new View.

Third-party applications using this endpoint via OAuth2 must request the following operation scope: api:datasets-write.

Query parameters

preview
boolean
optional

Enables the use of preview functionality.

Request body

CreateViewRequest
object
Hide child attributes

Hide child attributes

parentFolderRid
string

The unique resource identifier (RID) of a Folder.

viewName
string
backingDatasets
list<ViewBackingDataset>
optional
Show child attributes

Show child attributes

branch
string
optional

The branch name of the View. If not specified, defaults to master for most enrollments.

primaryKey
object
optional

The primary key of the dataset. Primary keys are treated as guarantees provided by the creator of the dataset.

Show child attributes

Show child attributes

Response body

View
object

The created View

Hide child attributes

Hide child attributes

viewName
string
datasetRid
string

The rid of the View.

parentFolderRid
string

The unique resource identifier (RID) of a Folder.

branch
string
optional

The branch name of the View. If not specified, defaults to master for most enrollments.

backingDatasets
list<ViewBackingDataset>
optional
Show child attributes

Show child attributes

primaryKey
object
optional

The primary key of the dataset. Primary keys are treated as guarantees provided by the creator of the dataset.

Show child attributes

Show child attributes

Examples

Request

Copied!
1 2 3 4 5 curl -X POST \ -H "Content-type: application/json" \ -H "Authorization: Bearer $TOKEN" \ "https://$HOSTNAME/api/v2/datasets/views?preview=true" \ -d '{"parentFolderRid":"ri.compass.main.folder.c410f510-2937-420e-8ea3-8c9bcb3c1791","viewName":"My Dataset","backingDatasets":[{"datasetRid":"ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da","branch":"master"}],"branch":"master","primaryKey":{"columns":["order_id"]}}'

Response

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 { "datasetRid": "ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da", "parentFolderRid": "ri.compass.main.folder.c410f510-2937-420e-8ea3-8c9bcb3c1791", "viewName": "My Dataset", "backingDatasets": [ { "datasetRid": "ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da", "branch": "master" } ], "branch": "master", "primaryKey": { "columns": [ "order_id" ] } }

Error responses

Error Name
CreateDatasetPermissionDeniedError CodePERMISSION_DENIED
Status Code403
DescriptionThe provided token does not have permission to create a dataset in this folder.
ParametersparentFolderRid, name
ViewNotFoundError CodeNOT_FOUND
Status Code404
DescriptionThe requested View could not be found. Either the view does not exist, the branch is not valid or the client token does not have access to it.
ParametersviewDatasetRid, branch
InvalidViewBackingDatasetError CodeINVALID_ARGUMENT
Status Code400
DescriptionEither you do not have access to one or more of the backing datasets or it does not exist.
Parameters
ViewPrimaryKeyMustContainAtLeastOneColumnError CodeINVALID_ARGUMENT
Status Code400
DescriptionNo columns were provided as part of the primary key
Parameters
ViewPrimaryKeyRequiresBackingDatasetsError CodeINVALID_ARGUMENT
Status Code400
DescriptionCannot add a primary key to a View that does not have any backing datasets.
Parameters
ViewDatasetCleanupFailedError CodeINTERNAL
Status Code500
DescriptionFailed to delete dataset following View creation failure.
ParametersviewDatasetRid
ResourceNameAlreadyExistsError CodeCONFLICT
Status Code409
DescriptionThe provided resource name is already in use by another resource in the same folder.
ParametersparentFolderRid, displayName
InputBackingDatasetNotInOutputViewProjectError CodeINVALID_ARGUMENT
Status Code400
DescriptionOne or more backing datasets do not live in the same project as the view. Either move the input datasets to the same project as the view or add them as project references.
Parameters
CreateViewPermissionDeniedError CodePERMISSION_DENIED
Status Code403
DescriptionCould not create the View.
Parameters
FolderNotFoundError CodeNOT_FOUND
Status Code404
DescriptionThe given Folder could not be found.
ParametersfolderRid