This folder contains example scripts that can be used to make calls to the Smartsheet API.
To start out with, you'll need to create an access token as mentioned in the Getting Started guide.
After that, you will need to ensure that the SMARTSHEET_ACCESS_TOKEN env variable is properly set.
On Mac/Linux, this would be like:
❯❯ export SMARTSHEET_ACCESS_TOKEN='MY-TOKEN'
On Windows, that would instead take the following form:
❯❯ $env:SMARTSHEET_ACCESS_TOKEN = 'MY-TOKEN'
Once that is done, you should be able to use any of the examples to make sample calls to the Smartsheet API.
Install my crate cargo-rx, which abstracts away cargo run --example
.
This provides a single rx
command.
❯❯ cargo install cargo-rx
Now start out by cloning the GitHub project:
❯❯ git clone https://github.com/rnag/smartsheet-rs.git
Then, simply cd
into the project folder:
❯❯ cd smartsheet-rs
From here, you can use rx
to build and run
any of the examples individually.
If you run the command without any arguments, you can select from the list of available examples:
❯❯ rx
In particular, here's a simple example of retrieving a list of all sheets in the account:
❯❯ rx sheets
To get the ID of a sheet, you can either examine the output from the above result, or you can find it under the Sheet Settings page in the Smartsheet web UI.
Once you have the sheet ID, you can - for example - retrieve a list of all columns in the sheet:
Note: to pass arguments to a script, you can include them after the
--
.
❯❯ rx columns -- <sheet-id>