Skip to content

An Apex class library that interacts with the Smartsheet API, including an Apex object model and convenience methods for calling the API.

Notifications You must be signed in to change notification settings

smartsheet-platform/Smartsheet-Apex-Toolkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Smartsheet Apex Toolkit

Overview

The Smartsheet Apex Toolkit provides an Apex class library that interacts with the Smartsheet API, including an Apex object model and convenience methods for calling the API.

The Smartsheet API provides a REST interface to Smartsheet features and data. The API enables Smartsheet customers to programmatically access and manage their data, and empowers application developers to build solutions on top of Smartsheet.

For more information about the Smartsheet API, please visit http://www.smartsheet.com/developers for full API Documentation and sample applications.

####Revision History 1.0 - November 12, 2013 - Basic authentication and sheet actions coverage.

Usage

You can create a Sheet with a couple of columns as follows:

Smartsheet.Sheet sheet = new Smartsheet.Sheet();
sheet.name = 'My Sheet Name';

List<Smartsheet.Column> columns = new List<Smartsheet.Column>();
Integer numberOfColumns = 2;

for (Integer i = 0; i < numberOfColumns; i++) {
	Smartsheet.Column column = new Smartsheet.Column();
	
    if (i == 0) {
		column.primary = true;
   	}			
    column.type = 'TEXT_NUMBER';
    column.title = 'Column ' + i;
    columns.add(column);
}
sheet.columns = columns;

Current API Coverage

####Authentication

  • getAccessToken()
  • refreshAccessToken()
  • saveAccessToken()
  • getRequestAuthCodeUrl()

####Sheet Actions

  • getSheet()
  • getSheets()
  • createSheet()
  • insertRows()

Connecting to Smartsheet

To enable your Salesforce application access to the Smartsheet API you'll need to create register a third-party app with Smartsheet or generate an API Access token in Smartsheet.

Registering Smartsheet Third-Party App

See the Smartsheet API documentation section on creating third-party applications.

Generate API Access Token

See the Smartsheet API documentation section on how to generate a Smartsheet Access Token.

Installation

To start using the Smartsheet Apex Toolkit in your Salesforce Org install the unmanaged package of the library with the following URL:

https://login.salesforce.com/packaging/installPackage.apexp?p0=04ti00000004HZH

Click Continue -> Next -> Next -> Install

Setup

Create a List custom setting for organizational defaults in the Setup->Develop->Custom Settings->Smartsheet Config->Manage. On the Smartsheet Config Custom Setting page click the New button, and use the configuration values below:

Add Remote Site

Interacting with the Smartsheet API requires a new remote site setting.

  • Add a remote site for Smartsheet API site in the Administration Setup->Security Controls->Remote Site Setting->New Remote Site.
  • Create new remote site and set https://api.smartsheet.com in the Remote Site URL.

##Force.com IDE Setup The cleanest way to include the toolkit in a Force.com IDE project is to have the IDE download the package when creating a new project.

The Force.com IDE can be found here:

http://wiki.developerforce.com/page/Force.com_IDE

To download the toolkit into a new project open the IDE and go to File -> New… -> Force.com project.

Connect the project to your Salesforce account with your Salesforce username, password and Salesforce security token. Then, click Next.

In the Choose Initial Project Contents window there will be an option to Choose metadata components to download. Under that option select Contents of Package, and then choose Smartsheet Apex Toolkit from the dropdown.

The package contents will then be loaded into Force.com IDE project.

Toolkit Demo VF page

Included in the Toolkit is a VisualForce page, SmartsheetDemoPage, which implements a simple Smartsheet API demo. To use it and test the toolkit, go to https://<your-salesforce-server>/apex/SmartsheetDemoPage:

  • First, select one of the two available authorization types in the Authorization Type dropdown.
  • When User Generated Token is selected, please type the user-generated-token in to Generated Token input field. Then click Login to Smartsheet button.
  • When OAuth 2.0 is selected, then just click the Login to Smartsheet button and follow the OAuth 2 flow.
  • Once you have been authorized, you will see your your access token displayed in the Access Token field, and a dropdown with sample API methods you can try.

Contact

If you have any questions or suggestions about this document, the toolkit, or about the Smartsheet API in general please contact us at [email protected]. Development questions can also be posted to Stackoverflow with the tag smartsheet-api.

##Contributions We encourage community development on this library, and welcome any high quality contributions. Please submit a pull request if you develop enhancements or new methods for additional API coverage.

The Smartsheet Platform team

githalytics.com alpha

About

An Apex class library that interacts with the Smartsheet API, including an Apex object model and convenience methods for calling the API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages