.dataset().schema()

.dataset(...).schema(): Promise<ISchema>

Get information about the structure of a data set, its data points and any linked data sets.

Parameters

  • N/A

Returns

This method returns a Promise which resolves to an object that describes the data points, computed values and links in the data set.

If the schema is requested for a data set which does not exist, the JSON return will contain just an error property with an error message.

{
    "computed": [                  // Array of computed values owned by this data set
        {
            "id": string,          // c-{number} - id of the computed value
            "name": string         // Name of the computed value
        }
    ],
    "datapoints": [                // Array of data points owned by this data set
        {
            "id": string,          // dp-{number} - id of the data point
            "name": string         // Data point name
        }
    ],
    "description": string,         // Data set description
	"error": string,               // If no error, then undefined
    "links": [{                    // Array of links from this data set
        "id": string,              // l-{number} - id of the link
        "name": string,            // Link name
        "target": {
            "id": string           // Linked data set's id (UUID)
        },
        "computed": [],            // Array of computed values - as above
        "datapoints": [],          // Array of data points - as above
        "links": []                // Array of linked values - as above
    }],
    "name": string,                // Data set name
    "table": [                     // Column information about the table to be displayed
        {
            "data": string,        // Location of the data for the data to be displayed in dotted object notation
            "id": string,          // Data point name to show in this column
            "link": null | string, // Link id if the data belongs to a linked data set. Comma delimited
            "name": string         // Name of the column
        }
    ]
}

Example

The following example shows an API return for a CloudTables application that has two data sets available, one which contains information about Airports and another about Flights:

const api = new CloudTablesApi('sub-domain', ':apiKey');

let result = await api.dataset(':id').schema();

Which returns the following JSON:

{
	"computed": [],
	"datapoints": [{
		"id": "dp-11",
		"name": "Flight number"
	}],
	"description": "",
	"links": [{
		"id": "l-5",
		"name": "From",
		"target": {
			"id": "f8b948bc-d409-11eb-b875-1b15216b0d99"
		},
		"computed": [],
		"datapoints": [{
			"id": "dp-8",
			"name": "Name"
		}],
		"links": []
	}, {
		"id": "l-6",
		"name": "Destination",
		"target": {
			"id": "f8b948bc-d409-11eb-b875-1b15216b0d99"
		},
		"computed": [],
		"datapoints": [{
			"id": "dp-8",
			"name": "Name"
		}],
		"links": []
	}],
	"name": "Flights",
	"table": [{
		"data": "dp-11",
		"id": "dp-11",
		"link": null,
		"name": "Flight number"
	}, {
		"data": "l-5[].dp-8",
		"id": "dp-8",
		"link": "l-5",
		"name": "Departure Airport"
	}, {
		"data": "l-6[].dp-8",
		"id": "dp-8",
		"link": "l-6",
		"name": "Arrival Airport"
	}]
}