Search code examples
node.jssmartsheet-api

How to pass query string parameters to Smartsheet API with node.js?


I need to get a list of all columns in one request and manual states that I should pass query string parameter:

Most index endpoints default to a page size of 100 results. If you need all results at once, you should specify the includeAll=true query string parameter.

Here is that I tried:

var options = {
    sheetId: 2252168947361668,
    includeAll: true
};

smartsheet.sheets.getColumns(options)
    .then(function (data) {
        console.log(data);
    })
    .catch(function (error) {
        console.log(error);
    });

But it returns me only first 100 columns. How should I pass query string parameters to smartsheet-api from node.js?


Solution

  • The includeAll parameter is a query string parameter so it must be included in the queryParameters object. The following should work for you:

    var options = {
        sheetId: 2252168947361668,
        queryParameters: {
          includeAll: true
        }
    };
    
    smartsheet.sheets.getColumns(options)
        .then(function (data) {
            console.log(data);
        })
        .catch(function (error) {
            console.log(error);
        });