Create a data source template
POST/v2/themes/{themeId}/data-source-templates
const url = 'https://api.ligr.live/rest/v2/themes/1/data-source-templates';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"alias":"example","sourceType":"csv","shape":"cell","config":"example","sample":"example","sampleBase64":"example","schema":"example","description":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.ligr.live/rest/v2/themes/1/data-source-templates \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "alias": "example", "sourceType": "csv", "shape": "cell", "config": "example", "sample": "example", "sampleBase64": "example", "schema": "example", "description": "example" }'Beta. This operation can change between minor versions. See Beta status.
Creates a data source template. The server parses the sample, infers the JSON schema and
stores the first rows as the preview sample. Send sample text for CSV, or sampleBase64
bytes for XLSX.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The theme identifier
Request Bodyrequired
Section titled “Request Bodyrequired”Body of POST /v2/themes/{themeId}/data-source-templates.
Send the sample as sample text for CSV, or as sampleBase64 bytes for XLSX. The server
parses the sample, infers the JSON schema, and stores both.
object
Lowercase letters, digits and underscores. It must start with a letter. Unique in the theme.
Parse options, for example { "headerRow": 1, "dataStartRow": 2 }.
Sample content as text. Use it for CSV.
Sample content as base64 bytes. Use it for XLSX.
JSON schema to store instead of the inferred one. Leave it out in nearly every case.
Responses
Section titled “Responses”Created
One data source template. The alias names the schema a graphic selects, and an operator pushes
rows into it with POST /v2/data-sources/{competitionThemeSettingId}/{alias}.
object
Parse options, for example headerRow and dataStartRow. Null when the defaults apply.
JSON schema of the pushed data. The server infers it from the sample.
First rows of the sample, so the builder can preview the shape.
ISO 8601 timestamp.
Example
{ "sourceType": "csv", "shape": "cell"}Request is invalid
object
object
Examplegenerated
{ "message": "example", "details": { "additionalProperty": "example" }}Missing or invalid api key
object
Examplegenerated
{ "message": "example"}Api key provides insufficient access for the request
object
Examplegenerated
{ "message": "example"}Theme or data source template not found
object
Examplegenerated
{ "message": "example"}Api key has made too many requests
object
Examplegenerated
{ "message": "example"}An unexpected error has occured. If problems persist please contact support
object
Examplegenerated
{ "message": "example"}