2

I'm trying to get a list of my datasets from the API. In version 1 of the API, a 'viz' call would return vizualizations (marked as "derived") and the underlying data (marked as type "table"), but it appears the API 1.0 isn't supported anymore, and version 2 doesn't return it.

I had hoped that the map call would returned a reference to the underlying data set(s), but that doesn't seem to be.

Any suggestions on how to programmatically get a list of an account's datasets?

1

You can do a select to the function CDB_UserTables to retrieve a list of user tables. This function does not belong to the public API: the behaviour is not guaranteed, but it could work for you -- Notice that for private requests ('private' or 'all'), your SQL API request needs to be authenticated. CartoDB does not currently have any public API for listing the datasets in an account.

With respect to:

I had hoped that the map call would returned a reference to the underlying data set(s), but that doesn't seem to be.

You can try to guess table names from the viz.json file of a map. This is an example of the "options" object that it contains for my layer:

options: {
sql: "select * from ne_50m_urban_areas",
layer_name: "ne_50m_urban_areas",
cartocss: "/** simple visualization */ #ne_50m_urban_areas{ polygon-fill: #FF6600; polygon-opacity: 0.7; line-color: #FFF; line-width: 0.5; line-opacity: 1; }",
cartocss_version: "2.1.1",
interactivity: "cartodb_id",
table_name: """."
}

This information will only appear if the data underneath is public. If it's private, the information is hidden.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.