Creating a DataSet, importing data, and creating a Personalized Data Permission (PDP) policy within the DataSet is straightforward and only requires four steps
After creating a DataSet, you can continue to import data if needed or create multiple PDP policies to filter specific data within a DataSet for various sets of users.
NOTE: In order to utilize this Quickstart you will need to obtain an access token or you can leverage any of Domo’s SDKs which will also handle authentication.
DataSets represent the data extracted from a data source; the extracted data is used as the foundation to create visualizations within Domo. Within Domo you can leverage data further by using Domo's data pipeline to transform, process, and aggregate for richer content and insight.
This code creates a DataSet via the DataSet API:
POST https://api.domo.com/v1/datasets
Content-Type: application/json
Accept: application/json
Authorization: bearer <your-valid-oauth-access-token>
{
"name" : "Leonhard Euler Party",
"description" : "Mathematician Guest List",
"rows" : 0,
"schema" : {
"columns" : [ {
"type" : "STRING",
"name" : "Friend"
}, {
"type" : "STRING",
"name" : "Attending"
} ]
}
}
Domo returns a new DataSet
object with all the relevant details:
HTTP/1.1 201 Created
Content-Type: application/json
{
"id" : "4405ff58-1957-45f0-82bd-914d989a3ea3",
"name" : "Leonhard Euler Party",
"description" : "Mathematician Guest List",
"rows" : 0,
"columns" : 0,
"schema" : {
"columns" : [ {
"type" : "STRING",
"name" : "Friend"
}, {
"type" : "STRING",
"name" : "Attending"
} ]
},
"owner" : {
"id" : 27,
"name" : "DomoSupport"
},
"createdAt" : "2016-06-21T17:20:36Z",
"updatedAt" : "2016-06-21T17:20:36Z"
}
Once you create the DataSet, store the dataset_id
value to DataSet name in your own database to utilize when importing additional data or applying data permissions.
With a new dataset_id
, import data into the DataSet via a CSV:
PUT https://api.domo.com/v1/datasets/4405ff58-1957-45f0-82bd-914d989a3ea3/data
Content-Type: text/csv
Authorization: bearer <your-valid-oauth-access-token>
Pythagoras,FALSE
Alan Turing,TRUE
George Boole,TRUE
Pythagoras,FALSE
Alan Turing,TRUE
George Boole,TRUE
Domo will return a response of success or error for the outcome of data being imported into DataSet.
HTTP/1.1 204 No Content
Once you've created a DataSet that has data, you can now create a Personalized Data Permission (PDP) policy to restrict access to rows of data within the DataSet. Users and groups must exist before creating PDP policy.
POST https://api.domo.com/v1/datasets/4405ff58-1957-45f0-82bd-914d989a3ea3/policies
Content-Type: application/json
Accept: application/json
Authorization: bearer <your-valid-oauth-access-token>
{
"name" : "Only Show Attendees",
"filters" : [ {
"column" : "Attending",
"values" : [ "TRUE" ],
"operator" : "EQUALS"
} ],
"users" : [ 27 ]
}
Domo returns a subset of the DataSet object specific to the data permission policy.
HTTP/1.1 201 Created
Content-Type: application/json
{
"id" : 8,
"type": "user",
"name": "Only Show Attendees",
"filters": [ {
"column": "Attending",
"values": [ "TRUE" ],
"operator": "EQUALS",
"not": false
} ],
"users": [ 27 ],
"groups": [ ]
}
Congrats! You now have a DataSet with data you’ve uploaded from a DataSet API.
You may want to learn how to manage DataSets in more detail or explore these other topics:
No problem, we'd love to help. Explore our documentation, answers to frequently asked questions, or join other developers in Domo's Developer Forum. For further help, feel free to email us or contact our sales team.