Spreadsheet validations

Documentation

getValidations

Get the validations.

GET /api/:guid/validations

setValidations

Set or update validations.

Parameter Description
validations[].index Position of this validation.
validations[].value New validation value.

POST /api/:guid/validations

Examples

Get the validations

const baseUrl = 'http://localhost:8009/api';
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
const token = 'eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i';
const headers = { 'Authorization': `Bearer ${token}` };

// Request the validations
const data = await (await fetch(`${baseUrl}/${guid}/validations`, { headers })).json();

console.log(data);

Set validations

const baseUrl = 'http://localhost:8009/api';
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
const token = 'eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i';
const headers = { 'Authorization': `Bearer ${token}` };

// Change validation at position 0
await fetch(`${baseUrl}/${guid}/validations`, {
    method: 'POST',
    headers,
    body: new URLSearchParams({
        'validations[0][index]': '0',
        'validations[0][value][range]': 'Sheet1!A1:A6',
        'validations[0][value][action]': 'warning',
        'validations[0][value][criteria]': 'between',
        'validations[0][value][type]': 'number',
        'validations[0][value][allowBlank]': 'false',
        'validations[0][value][value][0]': '10',
        'validations[0][value][value][1]': '30',
    }),
});