From 61df3713f88ad59b78a83d517fca70f771935fcb Mon Sep 17 00:00:00 2001 From: denislavstanchev Date: Mon, 17 Nov 2025 12:12:52 +0200 Subject: [PATCH 1/7] Add wiremock tests for the user endpoints module --- test/mock-api/users/common_test_constants.js | 69 +++++- .../users/test_add_alternate_email.js | 97 ++++++++ test/mock-api/users/test_add_profile_image.js | 123 ++++++++++ test/mock-api/users/test_add_user.js | 217 ++++++++++++++++++ .../users/test_deactivate_reactivate_user.js | 148 ++++++++++++ .../users/test_delete_alternate_email.js | 87 +++++++ .../users/test_get_alternate_email.js | 88 +++++++ test/mock-api/users/test_get_current_user.js | 202 ++++++++++++++++ test/mock-api/users/test_get_user.js | 201 ++++++++++++++++ .../users/test_list_alternate_emails.js | 94 ++++++++ test/mock-api/users/test_list_user_plans.js | 23 +- test/mock-api/users/test_list_users.js | 51 ++-- .../test_make_alternate_email_primary.js | 94 ++++++++ test/mock-api/users/test_remove_user.js | 131 +++++++++++ .../users/test_remove_user_from_plan.js | 23 +- test/mock-api/users/test_update_user.js | 152 ++++++++++++ .../users/test_user_upgrade_downgrade.js | 39 ++-- 17 files changed, 1792 insertions(+), 47 deletions(-) create mode 100644 test/mock-api/users/test_add_alternate_email.js create mode 100644 test/mock-api/users/test_add_profile_image.js create mode 100644 test/mock-api/users/test_add_user.js create mode 100644 test/mock-api/users/test_deactivate_reactivate_user.js create mode 100644 test/mock-api/users/test_delete_alternate_email.js create mode 100644 test/mock-api/users/test_get_alternate_email.js create mode 100644 test/mock-api/users/test_get_current_user.js create mode 100644 test/mock-api/users/test_get_user.js create mode 100644 test/mock-api/users/test_list_alternate_emails.js create mode 100644 test/mock-api/users/test_make_alternate_email_primary.js create mode 100644 test/mock-api/users/test_remove_user.js create mode 100644 test/mock-api/users/test_update_user.js diff --git a/test/mock-api/users/common_test_constants.js b/test/mock-api/users/common_test_constants.js index 56375d6..b796093 100644 --- a/test/mock-api/users/common_test_constants.js +++ b/test/mock-api/users/common_test_constants.js @@ -1,11 +1,78 @@ +// Common User IDs const TEST_USER_ID = 12345678; const TEST_PLAN_ID = 1234567890123456; +const TEST_ACCOUNT_ID = 9876543210987654; + +// Common Alternate Email ID +const TEST_ALTERNATE_EMAIL_ID = 9876543210987654; + +// Common User Contact Information +const TEST_MOBILE_PHONE = '+1234567890'; +const TEST_EMAIL = 'test.user@smartsheet.com'; +const TEST_ALTERNATE_EMAIL = 'alternate.email@smartsheet.com'; + +// Common User Names +const TEST_FIRST_NAME = 'Test'; +const TEST_LAST_NAME = 'User'; +const TEST_NAME = 'Test User'; + +// Common User Timestamps +const TEST_CUSTOM_WELCOME_SCREEN_VIEWED = '2020-08-25T12:15:47Z'; +const TEST_LAST_LOGIN = '2020-10-04T18:32:47Z'; +const TEST_PROVISIONAL_EXPIRATION_DATE = '2026-12-13T12:17:52.525696Z'; +const TEST_SEAT_TYPE_LAST_CHANGED_AT = '2025-01-01T00:00:00.123456789Z'; + +// Common Pagination Properties +const TEST_PAGE_NUMBER = 1; +const TEST_PAGE_SIZE = 100; +const TEST_TOTAL_PAGES = 1; +const TEST_TOTAL_COUNT = 1; + +// Common User Properties +const TEST_SHEET_COUNT = 1; + +// Common Profile Image Properties +const TEST_PROFILE_IMAGE_ID = 'u!1!nAtdn5RJB_o!k6_e_3h2R3w!wmYXPek-yVD'; +const TEST_PROFILE_IMAGE_HEIGHT = 1050; +const TEST_PROFILE_IMAGE_WIDTH = 1050; + +// Common Success Response Values const TEST_SUCCESS_MESSAGE = 'SUCCESS'; const TEST_SUCCESS_RESULT_CODE = 0; +// Common Error Status Codes +const ERROR_500_STATUS_CODE = 500; +const ERROR_500_MESSAGE = 'Internal Server Error'; +const ERROR_400_STATUS_CODE = 400; +const ERROR_400_MESSAGE = 'Malformed Request'; + module.exports = { TEST_USER_ID, TEST_PLAN_ID, + TEST_ACCOUNT_ID, + TEST_ALTERNATE_EMAIL_ID, + TEST_MOBILE_PHONE, + TEST_EMAIL, + TEST_ALTERNATE_EMAIL, + TEST_FIRST_NAME, + TEST_LAST_NAME, + TEST_NAME, + TEST_CUSTOM_WELCOME_SCREEN_VIEWED, + TEST_LAST_LOGIN, + TEST_PROVISIONAL_EXPIRATION_DATE, + TEST_SEAT_TYPE_LAST_CHANGED_AT, + TEST_PAGE_NUMBER, + TEST_PAGE_SIZE, + TEST_TOTAL_PAGES, + TEST_TOTAL_COUNT, + TEST_SHEET_COUNT, + TEST_PROFILE_IMAGE_ID, + TEST_PROFILE_IMAGE_HEIGHT, + TEST_PROFILE_IMAGE_WIDTH, TEST_SUCCESS_MESSAGE, - TEST_SUCCESS_RESULT_CODE + TEST_SUCCESS_RESULT_CODE, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE }; diff --git a/test/mock-api/users/test_add_alternate_email.js b/test/mock-api/users/test_add_alternate_email.js new file mode 100644 index 0000000..defd477 --- /dev/null +++ b/test/mock-api/users/test_add_alternate_email.js @@ -0,0 +1,97 @@ +const assert = require('assert'); +const crypto = require('crypto'); +const { createClient, findWireMockRequest } = require('../utils/utils.js'); +const { + TEST_USER_ID, + TEST_ALTERNATE_EMAIL_ID, + TEST_SUCCESS_MESSAGE, + TEST_SUCCESS_RESULT_CODE, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE +} = require('./common_test_constants.js'); + +describe('Users - addAlternateEmail endpoint tests', function () { + let client = createClient(); + const TEST_EMAIL = 'alternate.email@smartsheet.com'; + const TEST_CONFIRMED = false; + const TEST_BODY = [{ email: TEST_EMAIL }]; + + it('addAlternateEmail generated url is correct', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + body: TEST_BODY, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/alternate-emails/add-alternate-email/all-response-body-properties' + } + }; + await client.users.addAlternateEmail(options); + const matchedRequest = await findWireMockRequest(requestId); + + assert.ok(matchedRequest.url.includes(`/users/${TEST_USER_ID}/alternateemails`)); + let body = JSON.parse(matchedRequest.body); + assert.deepStrictEqual(body, TEST_BODY); + }); + + it('addAlternateEmail all response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + body: TEST_BODY, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/alternate-emails/add-alternate-email/all-response-body-properties' + } + }; + const response = await client.users.addAlternateEmail(options); + assert.ok(response); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); + assert.ok(Array.isArray(response.data)); + assert.strictEqual(response.data.length, 1); + assert.strictEqual(response.data[0].id, TEST_ALTERNATE_EMAIL_ID); + assert.strictEqual(response.data[0].confirmed, TEST_CONFIRMED); + assert.strictEqual(response.data[0].email, TEST_EMAIL); + }); + + it('addAlternateEmail error 500 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + body: TEST_BODY, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/500-response' + } + }; + try { + await client.users.addAlternateEmail(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); + } + }); + + it('addAlternateEmail error 400 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + body: TEST_BODY, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/400-response' + } + }; + try { + await client.users.addAlternateEmail(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); + } + }); +}); diff --git a/test/mock-api/users/test_add_profile_image.js b/test/mock-api/users/test_add_profile_image.js new file mode 100644 index 0000000..8813b9e --- /dev/null +++ b/test/mock-api/users/test_add_profile_image.js @@ -0,0 +1,123 @@ +const assert = require('assert'); +const crypto = require('crypto'); +const { createClient, findWireMockRequest } = require('../utils/utils.js'); +const { + TEST_USER_ID, + TEST_EMAIL, + TEST_FIRST_NAME, + TEST_LAST_NAME, + TEST_NAME, + TEST_PROFILE_IMAGE_ID, + TEST_PROFILE_IMAGE_HEIGHT, + TEST_PROFILE_IMAGE_WIDTH, + TEST_SUCCESS_MESSAGE, + TEST_SUCCESS_RESULT_CODE, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE +} = require('./common_test_constants.js'); + +describe('Users - addProfileImage endpoint tests', function () { + let client = createClient(); + const imageId = TEST_PROFILE_IMAGE_ID; + const height = TEST_PROFILE_IMAGE_HEIGHT; + const width = TEST_PROFILE_IMAGE_WIDTH; + const email = TEST_EMAIL; + const name = TEST_NAME; + const firstName = TEST_FIRST_NAME; + const lastName = TEST_LAST_NAME; + + it('addProfileImage generated url is correct', async function () { + const requestId = crypto.randomUUID(); + const mockImageBuffer = Buffer.from('fake-image-data'); + const options = { + userId: TEST_USER_ID, + body: { + file: mockImageBuffer + }, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/add-profile-image/all-response-body-properties' + } + }; + await client.users.addProfileImage(options); + const matchedRequest = await findWireMockRequest(requestId); + + assert.ok(matchedRequest.url.includes(`/users/${TEST_USER_ID}/profileimage`)); + }); + + it('addProfileImage all response body properties', async function () { + const requestId = crypto.randomUUID(); + const mockImageBuffer = Buffer.from('fake-image-data'); + const options = { + userId: TEST_USER_ID, + body: { + file: mockImageBuffer + }, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/add-profile-image/all-response-body-properties' + } + }; + const response = await client.users.addProfileImage(options); + assert.ok(response); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); + assert.ok(response.data); + assert.strictEqual(response.data.length, 1); + assert.strictEqual(response.data[0].id, TEST_USER_ID); + assert.strictEqual(response.data[0].email, email); + assert.strictEqual(response.data[0].name, name); + assert.strictEqual(response.data[0].firstName, firstName); + assert.strictEqual(response.data[0].lastName, lastName); + assert.ok(response.data[0].profileImage); + assert.strictEqual(response.data[0].profileImage.imageId, imageId); + assert.strictEqual(response.data[0].profileImage.height, height); + assert.strictEqual(response.data[0].profileImage.width, width); + }); + + it('addProfileImage error 500 response', async function () { + const requestId = crypto.randomUUID(); + const mockImageBuffer = Buffer.from('fake-image-data'); + const options = { + userId: TEST_USER_ID, + body: { + file: mockImageBuffer + }, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/500-response' + } + }; + try { + await client.users.addProfileImage(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); + } + }); + + it('addProfileImage error 400 response', async function () { + const requestId = crypto.randomUUID(); + const mockImageBuffer = Buffer.from('fake-image-data'); + const options = { + userId: TEST_USER_ID, + body: { + file: mockImageBuffer + }, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/400-response' + } + }; + try { + await client.users.addProfileImage(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); + } + }); +}); diff --git a/test/mock-api/users/test_add_user.js b/test/mock-api/users/test_add_user.js new file mode 100644 index 0000000..dcb7cca --- /dev/null +++ b/test/mock-api/users/test_add_user.js @@ -0,0 +1,217 @@ +const assert = require('assert'); +const crypto = require('crypto'); +const { createClient, findWireMockRequest } = require('../utils/utils.js'); +const { + TEST_EMAIL, + TEST_FIRST_NAME, + TEST_LAST_NAME, + TEST_NAME, + TEST_CUSTOM_WELCOME_SCREEN_VIEWED, + TEST_LAST_LOGIN, + TEST_PROVISIONAL_EXPIRATION_DATE, + TEST_SEAT_TYPE_LAST_CHANGED_AT, + TEST_SHEET_COUNT, + TEST_PROFILE_IMAGE_ID, + TEST_PROFILE_IMAGE_HEIGHT, + TEST_PROFILE_IMAGE_WIDTH, + TEST_SUCCESS_MESSAGE, + TEST_SUCCESS_RESULT_CODE, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE, + TEST_USER_ID +} = require('./common_test_constants.js'); + +describe('Users - addUser endpoint tests', function () { + let client = createClient(); + const newUserId = TEST_USER_ID; + const email = TEST_EMAIL; + const firstName = TEST_FIRST_NAME; + const lastName = TEST_LAST_NAME; + const name = TEST_NAME; + const admin = false; + const licensedSheetCreator = true; + const groupAdmin = false; + const resourceViewer = false; + const status = 'ACTIVE'; + const customWelcomeScreenViewed = TEST_CUSTOM_WELCOME_SCREEN_VIEWED; + const lastLogin = TEST_LAST_LOGIN; + const isInternal = true; + const profileImageId = TEST_PROFILE_IMAGE_ID; + const profileImageHeight = TEST_PROFILE_IMAGE_HEIGHT; + const profileImageWidth = TEST_PROFILE_IMAGE_WIDTH; + const provisionalExpirationDate = TEST_PROVISIONAL_EXPIRATION_DATE; + const seatType = 'MEMBER'; + const seatTypeLastChangedAt = TEST_SEAT_TYPE_LAST_CHANGED_AT; + const sheetCount = TEST_SHEET_COUNT; + + const testUserBody = { + email: email, + firstName: firstName, + lastName: lastName, + admin: admin, + licensedSheetCreator: licensedSheetCreator, + groupAdmin: groupAdmin, + resourceViewer: resourceViewer, + status: status + }; + + it('addUser generated url is correct', async function () { + const requestId = crypto.randomUUID(); + const options = { + body: testUserBody, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/add-user/all-response-body-properties' + } + }; + await client.users.addUser(options); + const matchedRequest = await findWireMockRequest(requestId); + + assert.ok(matchedRequest.url.includes('/2.0/users')); + let body = JSON.parse(matchedRequest.body); + assert.strictEqual(body.email, email); + assert.strictEqual(body.firstName, firstName); + assert.strictEqual(body.lastName, lastName); + assert.strictEqual(body.admin, admin); + assert.strictEqual(body.licensedSheetCreator, licensedSheetCreator); + assert.strictEqual(body.groupAdmin, groupAdmin); + assert.strictEqual(body.resourceViewer, resourceViewer); + assert.strictEqual(body.status, status); + }); + it('addUserAndSendEmail generated url is correct', async function () { + const requestId = crypto.randomUUID(); + const options = { + body: testUserBody, + queryParameters: { + sendEmail: true + }, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/add-user/all-response-body-properties' + } + }; + await client.users.addUserAndSendEmail(options); + const matchedRequest = await findWireMockRequest(requestId); + + assert.ok(matchedRequest.url.includes('/2.0/users')); + const queryParams = matchedRequest.queryParams; + const sendEmailActual = queryParams.sendEmail.values[0]; + assert.strictEqual(sendEmailActual, 'true'); + let body = JSON.parse(matchedRequest.body); + assert.strictEqual(body.email, email); + assert.strictEqual(body.firstName, firstName); + assert.strictEqual(body.lastName, lastName); + assert.strictEqual(body.admin, admin); + assert.strictEqual(body.licensedSheetCreator, licensedSheetCreator); + assert.strictEqual(body.groupAdmin, groupAdmin); + assert.strictEqual(body.resourceViewer, resourceViewer); + assert.strictEqual(body.status, status); + }); + + + it('addUser all response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + body: testUserBody, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/add-user/all-response-body-properties' + } + }; + const response = await client.users.addUser(options); + assert.ok(response); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); + assert.strictEqual(response.result.id, newUserId); + assert.strictEqual(response.result.admin, admin); + assert.strictEqual(response.result.customWelcomeScreenViewed, customWelcomeScreenViewed); + assert.strictEqual(response.result.email, email); + assert.strictEqual(response.result.firstName, firstName); + assert.strictEqual(response.result.groupAdmin, groupAdmin); + assert.strictEqual(response.result.isInternal, isInternal); + assert.strictEqual(response.result.lastLogin, lastLogin); + assert.strictEqual(response.result.lastName, lastName); + assert.strictEqual(response.result.licensedSheetCreator, licensedSheetCreator); + assert.strictEqual(response.result.name, name); + assert.strictEqual(response.result.profileImage.imageId, profileImageId); + assert.strictEqual(response.result.profileImage.height, profileImageHeight); + assert.strictEqual(response.result.profileImage.width, profileImageWidth); + assert.strictEqual(response.result.provisionalExpirationDate, provisionalExpirationDate); + assert.strictEqual(response.result.resourceViewer, resourceViewer); + assert.strictEqual(response.result.seatType, seatType); + assert.strictEqual(response.result.seatTypeLastChangedAt, seatTypeLastChangedAt); + assert.strictEqual(response.result.sheetCount, sheetCount); + assert.strictEqual(response.result.status, status); + }); + + it('addUser required response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + body: testUserBody, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/add-user/required-response-body-properties' + } + }; + const response = await client.users.addUser(options); + assert.ok(response); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); + assert.strictEqual(response.result.id, newUserId); + assert.strictEqual(response.result.admin, undefined); + assert.strictEqual(response.result.customWelcomeScreenViewed, undefined); + assert.strictEqual(response.result.email, email); + assert.strictEqual(response.result.firstName, firstName); + assert.strictEqual(response.result.groupAdmin, undefined); + assert.strictEqual(response.result.isInternal, undefined); + assert.strictEqual(response.result.lastLogin, undefined); + assert.strictEqual(response.result.lastName, lastName); + assert.strictEqual(response.result.licensedSheetCreator, undefined); + assert.strictEqual(response.result.name, name); + assert.strictEqual(response.result.profileImage, undefined); + assert.strictEqual(response.result.provisionalExpirationDate, undefined); + assert.strictEqual(response.result.resourceViewer, undefined); + assert.strictEqual(response.result.seatType, undefined); + assert.strictEqual(response.result.seatTypeLastChangedAt, undefined); + assert.strictEqual(response.result.sheetCount, undefined); + assert.strictEqual(response.result.status, status); + }); + + it('addUser error 500 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + body: testUserBody, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/500-response' + } + }; + try { + await client.users.addUser(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); + } + }); + + it('addUser error 400 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + body: testUserBody, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/400-response' + } + }; + try { + await client.users.addUser(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); + } + }); +}); diff --git a/test/mock-api/users/test_deactivate_reactivate_user.js b/test/mock-api/users/test_deactivate_reactivate_user.js new file mode 100644 index 0000000..1cbc5ea --- /dev/null +++ b/test/mock-api/users/test_deactivate_reactivate_user.js @@ -0,0 +1,148 @@ +const assert = require('assert'); +const crypto = require('crypto'); +const { createClient, findWireMockRequest } = require('../utils/utils.js'); +const { + TEST_USER_ID, + TEST_SUCCESS_MESSAGE, + TEST_SUCCESS_RESULT_CODE, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE +} = require('./common_test_constants.js'); + +describe('Users - deactivateUser & reactivateUser endpoint tests', function () { + let client = createClient(); + + it('deactivateUser generated url is correct', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/deactivate-user/all-response-body-properties' + } + }; + await client.users.deactivateUser(options); + const matchedRequest = await findWireMockRequest(requestId); + + assert.ok(matchedRequest.url.includes(`/users/${TEST_USER_ID}/deactivate`)); + }); + + it('deactivateUser all response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/deactivate-user/all-response-body-properties' + } + }; + const response = await client.users.deactivateUser(options); + assert.ok(response); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); + }); + + it('deactivateUser error 500 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/500-response' + } + }; + try { + await client.users.deactivateUser(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); + } + }); + + it('deactivateUser error 400 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/400-response' + } + }; + try { + await client.users.deactivateUser(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); + } + }); + + it('reactivateUser generated url is correct', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/reactivate-user/all-response-body-properties' + } + }; + await client.users.reactivateUser(options); + const matchedRequest = await findWireMockRequest(requestId); + + assert.ok(matchedRequest.url.includes(`/users/${TEST_USER_ID}/reactivate`)); + }); + + it('reactivateUser all response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/reactivate-user/all-response-body-properties' + } + }; + const response = await client.users.reactivateUser(options); + assert.ok(response); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); + }); + + it('reactivateUser error 500 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/500-response' + } + }; + try { + await client.users.reactivateUser(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); + } + }); + + it('reactivateUser error 400 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/400-response' + } + }; + try { + await client.users.reactivateUser(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); + } + }); +}); diff --git a/test/mock-api/users/test_delete_alternate_email.js b/test/mock-api/users/test_delete_alternate_email.js new file mode 100644 index 0000000..69ce9b8 --- /dev/null +++ b/test/mock-api/users/test_delete_alternate_email.js @@ -0,0 +1,87 @@ +const assert = require('assert'); +const crypto = require('crypto'); +const { createClient, findWireMockRequest } = require('../utils/utils.js'); +const { + TEST_USER_ID, + TEST_ALTERNATE_EMAIL_ID, + TEST_SUCCESS_MESSAGE, + TEST_SUCCESS_RESULT_CODE, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE +} = require('./common_test_constants.js'); + +describe('Users - deleteAlternateEmail endpoint tests', function () { + let client = createClient(); + + it('deleteAlternateEmail generated url is correct', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + alternateEmailId: TEST_ALTERNATE_EMAIL_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/alternate-emails/delete-alternate-email/all-response-body-properties' + } + }; + await client.users.deleteAlternateEmail(options); + const matchedRequest = await findWireMockRequest(requestId); + + assert.ok(matchedRequest.url.includes(`/users/${TEST_USER_ID}/alternateemails/${TEST_ALTERNATE_EMAIL_ID}`)); + }); + + it('deleteAlternateEmail all response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + alternateEmailId: TEST_ALTERNATE_EMAIL_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/alternate-emails/delete-alternate-email/all-response-body-properties' + } + }; + const response = await client.users.deleteAlternateEmail(options); + assert.ok(response); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); + }); + + it('deleteAlternateEmail error 500 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + alternateEmailId: TEST_ALTERNATE_EMAIL_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/500-response' + } + }; + try { + await client.users.deleteAlternateEmail(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); + } + }); + + it('deleteAlternateEmail error 400 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + alternateEmailId: TEST_ALTERNATE_EMAIL_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/400-response' + } + }; + try { + await client.users.deleteAlternateEmail(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); + } + }); +}); diff --git a/test/mock-api/users/test_get_alternate_email.js b/test/mock-api/users/test_get_alternate_email.js new file mode 100644 index 0000000..03e0d40 --- /dev/null +++ b/test/mock-api/users/test_get_alternate_email.js @@ -0,0 +1,88 @@ +const assert = require('assert'); +const crypto = require('crypto'); +const { createClient, findWireMockRequest } = require('../utils/utils.js'); +const { + TEST_USER_ID, + TEST_ALTERNATE_EMAIL_ID, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE +} = require('./common_test_constants.js'); + +describe('Users - getAlternateEmail endpoint tests', function () { + let client = createClient(); + const TEST_EMAIL = 'alternate.email@smartsheet.com'; + const TEST_CONFIRMED = true; + + it('getAlternateEmail generated url is correct', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + alternateEmailId: TEST_ALTERNATE_EMAIL_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/alternate-emails/get-alternate-email/all-response-body-properties' + } + }; + await client.users.getAlternateEmail(options); + const matchedRequest = await findWireMockRequest(requestId); + + assert.ok(matchedRequest.url.includes(`/users/${TEST_USER_ID}/alternateemails/${TEST_ALTERNATE_EMAIL_ID}`)); + }); + + it('getAlternateEmail all response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + alternateEmailId: TEST_ALTERNATE_EMAIL_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/alternate-emails/get-alternate-email/all-response-body-properties' + } + }; + const response = await client.users.getAlternateEmail(options); + assert.ok(response); + assert.strictEqual(response.id, TEST_ALTERNATE_EMAIL_ID); + assert.strictEqual(response.confirmed, TEST_CONFIRMED); + assert.strictEqual(response.email, TEST_EMAIL); + }); + + it('getAlternateEmail error 500 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + alternateEmailId: TEST_ALTERNATE_EMAIL_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/500-response' + } + }; + try { + await client.users.getAlternateEmail(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); + } + }); + + it('getAlternateEmail error 400 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + alternateEmailId: TEST_ALTERNATE_EMAIL_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/400-response' + } + }; + try { + await client.users.getAlternateEmail(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); + } + }); +}); diff --git a/test/mock-api/users/test_get_current_user.js b/test/mock-api/users/test_get_current_user.js new file mode 100644 index 0000000..cb9e6f0 --- /dev/null +++ b/test/mock-api/users/test_get_current_user.js @@ -0,0 +1,202 @@ +const assert = require('assert'); +const crypto = require('crypto'); +const { createClient, findWireMockRequest } = require('../utils/utils.js'); +const { + TEST_USER_ID, + TEST_ACCOUNT_ID, + TEST_ALTERNATE_EMAIL_ID, + TEST_MOBILE_PHONE, + TEST_EMAIL, + TEST_ALTERNATE_EMAIL, + TEST_FIRST_NAME, + TEST_LAST_NAME, + TEST_CUSTOM_WELCOME_SCREEN_VIEWED, + TEST_LAST_LOGIN, + TEST_SHEET_COUNT, + TEST_PROFILE_IMAGE_ID, + TEST_PROFILE_IMAGE_HEIGHT, + TEST_PROFILE_IMAGE_WIDTH, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE +} = require('./common_test_constants.js'); + +describe('Users - getCurrentUser endpoint tests', function () { + let client = createClient(); + const userId = TEST_USER_ID; + const accountId = TEST_ACCOUNT_ID; + const accountName = 'Test Account'; + const admin = true; + const alternateEmailId = TEST_ALTERNATE_EMAIL_ID; + const alternateEmailConfirmed = true; + const alternateEmail = TEST_ALTERNATE_EMAIL; + const company = 'Test Company'; + const customWelcomeScreenViewed = TEST_CUSTOM_WELCOME_SCREEN_VIEWED; + const department = 'Engineering'; + const email = TEST_EMAIL; + const firstName = TEST_FIRST_NAME; + const groupAdmin = true; + const jiraAdmin = false; + const lastLogin = TEST_LAST_LOGIN; + const lastName = TEST_LAST_NAME; + const licensedSheetCreator = true; + const locale = 'en_US'; + const mobilePhone = TEST_MOBILE_PHONE; + const profileImageId = TEST_PROFILE_IMAGE_ID; + const profileImageHeight = TEST_PROFILE_IMAGE_HEIGHT; + const profileImageWidth = TEST_PROFILE_IMAGE_WIDTH; + const resourceViewer = true; + const role = 'System Admin'; + const salesforceAdmin = false; + const salesforceUser = false; + const sheetCount = TEST_SHEET_COUNT; + const timeZone = 'US/Pacific'; + const title = 'Senior Engineer'; + const workPhone = TEST_MOBILE_PHONE; + const groupId = 2222222222222222; + const groupName = 'Engineering Team'; + const groupDescription = 'Engineering department group'; + const groupOwner = 'owner@smartsheet.com'; + const groupOwnerId = 3333333333333333; + const groupCreatedAt = '2020-01-15T10:30:00Z'; + const groupModifiedAt = '2020-06-20T14:45:00Z'; + + it('getCurrentUser generated url is correct', async function () { + const requestId = crypto.randomUUID(); + const options = { + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/get-current-user/all-response-body-properties' + } + }; + await client.users.getCurrentUser(options); + const matchedRequest = await findWireMockRequest(requestId); + + assert.ok(matchedRequest.url.includes('/2.0/users/me')); + }); + + it('getCurrentUser all response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/get-current-user/all-response-body-properties' + } + }; + const response = await client.users.getCurrentUser(options); + assert.ok(response); + assert.strictEqual(response.id, userId); + assert.strictEqual(response.account.id, accountId); + assert.strictEqual(response.account.name, accountName); + assert.strictEqual(response.admin, admin); + assert.strictEqual(response.alternateEmails.length, 1); + assert.strictEqual(response.alternateEmails[0].id, alternateEmailId); + assert.strictEqual(response.alternateEmails[0].confirmed, alternateEmailConfirmed); + assert.strictEqual(response.alternateEmails[0].email, alternateEmail); + assert.strictEqual(response.company, company); + assert.strictEqual(response.customWelcomeScreenViewed, customWelcomeScreenViewed); + assert.strictEqual(response.department, department); + assert.strictEqual(response.email, email); + assert.strictEqual(response.firstName, firstName); + assert.strictEqual(response.groupAdmin, groupAdmin); + assert.strictEqual(response.jiraAdmin, jiraAdmin); + assert.strictEqual(response.lastLogin, lastLogin); + assert.strictEqual(response.lastName, lastName); + assert.strictEqual(response.licensedSheetCreator, licensedSheetCreator); + assert.strictEqual(response.locale, locale); + assert.strictEqual(response.mobilePhone, mobilePhone); + assert.strictEqual(response.profileImage.imageId, profileImageId); + assert.strictEqual(response.profileImage.height, profileImageHeight); + assert.strictEqual(response.profileImage.width, profileImageWidth); + assert.strictEqual(response.resourceViewer, resourceViewer); + assert.strictEqual(response.role, role); + assert.strictEqual(response.salesforceAdmin, salesforceAdmin); + assert.strictEqual(response.salesforceUser, salesforceUser); + assert.strictEqual(response.sheetCount, sheetCount); + assert.strictEqual(response.timeZone, timeZone); + assert.strictEqual(response.title, title); + assert.strictEqual(response.workPhone, workPhone); + assert.strictEqual(response.data.length, 1); + assert.strictEqual(response.data[0].id, groupId); + assert.strictEqual(response.data[0].name, groupName); + assert.strictEqual(response.data[0].description, groupDescription); + assert.strictEqual(response.data[0].owner, groupOwner); + assert.strictEqual(response.data[0].ownerId, groupOwnerId); + assert.strictEqual(response.data[0].createdAt, groupCreatedAt); + assert.strictEqual(response.data[0].modifiedAt, groupModifiedAt); + }); + + it('getCurrentUser required response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/get-current-user/required-response-body-properties' + } + }; + const response = await client.users.getCurrentUser(options); + assert.ok(response); + assert.strictEqual(response.id, userId); + assert.strictEqual(response.account.id, accountId); + assert.strictEqual(response.account.name, accountName); + assert.strictEqual(response.admin, admin); + assert.strictEqual(response.alternateEmails, undefined); + assert.strictEqual(response.company, company); + assert.strictEqual(response.customWelcomeScreenViewed, undefined); + assert.strictEqual(response.department, department); + assert.strictEqual(response.email, email); + assert.strictEqual(response.firstName, firstName); + assert.strictEqual(response.groupAdmin, groupAdmin); + assert.strictEqual(response.jiraAdmin, jiraAdmin); + assert.strictEqual(response.lastLogin, undefined); + assert.strictEqual(response.lastName, lastName); + assert.strictEqual(response.licensedSheetCreator, licensedSheetCreator); + assert.strictEqual(response.locale, locale); + assert.strictEqual(response.mobilePhone, mobilePhone); + assert.strictEqual(response.profileImage, undefined); + assert.strictEqual(response.resourceViewer, resourceViewer); + assert.strictEqual(response.role, role); + assert.strictEqual(response.salesforceAdmin, salesforceAdmin); + assert.strictEqual(response.salesforceUser, salesforceUser); + assert.strictEqual(response.sheetCount, sheetCount); + assert.strictEqual(response.timeZone, timeZone); + assert.strictEqual(response.title, title); + assert.strictEqual(response.workPhone, workPhone); + assert.strictEqual(response.data.length, 0); + }); + + it('getCurrentUser error 500 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/500-response' + } + }; + try { + await client.users.getCurrentUser(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); + } + }); + + it('getCurrentUser error 400 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/400-response' + } + }; + try { + await client.users.getCurrentUser(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); + } + }); +}); diff --git a/test/mock-api/users/test_get_user.js b/test/mock-api/users/test_get_user.js new file mode 100644 index 0000000..4a6db4c --- /dev/null +++ b/test/mock-api/users/test_get_user.js @@ -0,0 +1,201 @@ +const assert = require('assert'); +const crypto = require('crypto'); +const { createClient, findWireMockRequest } = require('../utils/utils.js'); +const { + TEST_USER_ID, + TEST_ACCOUNT_ID, + TEST_ALTERNATE_EMAIL_ID, + TEST_MOBILE_PHONE, + TEST_EMAIL, + TEST_ALTERNATE_EMAIL, + TEST_FIRST_NAME, + TEST_LAST_NAME, + TEST_LAST_LOGIN, + TEST_CUSTOM_WELCOME_SCREEN_VIEWED, + TEST_SHEET_COUNT, + TEST_PROFILE_IMAGE_ID, + TEST_PROFILE_IMAGE_HEIGHT, + TEST_PROFILE_IMAGE_WIDTH, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE +} = require('./common_test_constants.js'); + +describe('Users - getUser endpoint tests', function () { + let client = createClient(); + const accountId = TEST_ACCOUNT_ID; + const accountName = 'Acme Corporation'; + const company = 'Acme Corporation'; + const department = 'Engineering'; + const email = TEST_EMAIL; + const firstName = TEST_FIRST_NAME; + const jiraAdmin = false; + const lastName = TEST_LAST_NAME; + const locale = 'en_US'; + const mobilePhone = TEST_MOBILE_PHONE; + const role = 'Senior Developer'; + const salesforceAdmin = false; + const salesforceUser = false; + const timeZone = 'US/Pacicfic'; + const title = 'Senior Software Engineer'; + const workPhone = TEST_MOBILE_PHONE; + const admin = true; + const alternateEmailId = TEST_ALTERNATE_EMAIL_ID; + const alternateEmailConfirmed = true; + const alternateEmailAddress = TEST_ALTERNATE_EMAIL; + const customWelcomeScreenViewed = TEST_CUSTOM_WELCOME_SCREEN_VIEWED; + const groupAdmin = true; + const lastLogin = TEST_LAST_LOGIN; + const licensedSheetCreator = true; + const profileImageId = TEST_PROFILE_IMAGE_ID; + const profileImageHeight = TEST_PROFILE_IMAGE_HEIGHT; + const profileImageWidth = TEST_PROFILE_IMAGE_WIDTH; + const resourceViewer = false; + const sheetCount = TEST_SHEET_COUNT; + + it('getUser generated url is correct', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/get-user/all-response-body-properties' + } + }; + await client.users.getUser(options); + const matchedRequest = await findWireMockRequest(requestId); + assert.ok(matchedRequest.url.includes(`/2.0/users/${TEST_USER_ID}`)); + }); + + it('getUser all response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/get-user/all-response-body-properties' + } + }; + const response = await client.users.getUser(options); + + // Verify required properties + assert.ok(response); + assert.strictEqual(response.id, TEST_USER_ID); + assert.ok(response.account); + assert.strictEqual(response.account.id, accountId); + assert.strictEqual(response.account.name, accountName); + assert.strictEqual(response.company, company); + assert.strictEqual(response.department, department); + assert.strictEqual(response.email, email); + assert.strictEqual(response.firstName, firstName); + assert.strictEqual(response.jiraAdmin, jiraAdmin); + assert.strictEqual(response.lastName, lastName); + assert.strictEqual(response.locale, locale); + assert.strictEqual(response.mobilePhone, mobilePhone); + assert.strictEqual(response.role, role); + assert.strictEqual(response.salesforceAdmin, salesforceAdmin); + assert.strictEqual(response.salesforceUser, salesforceUser); + assert.strictEqual(response.timeZone, timeZone); + assert.strictEqual(response.title, title); + assert.strictEqual(response.workPhone, workPhone); + + // Verify optional properties + assert.strictEqual(response.admin, admin); + assert.ok(response.alternateEmails); + assert.strictEqual(response.alternateEmails.length, 1); + assert.strictEqual(response.alternateEmails[0].id, alternateEmailId); + assert.strictEqual(response.alternateEmails[0].confirmed, alternateEmailConfirmed); + assert.strictEqual(response.alternateEmails[0].email, alternateEmailAddress); + assert.strictEqual(response.customWelcomeScreenViewed, customWelcomeScreenViewed); + assert.strictEqual(response.groupAdmin, groupAdmin); + assert.strictEqual(response.lastLogin, lastLogin); + assert.strictEqual(response.licensedSheetCreator, licensedSheetCreator); + assert.ok(response.profileImage); + assert.strictEqual(response.profileImage.imageId, profileImageId); + assert.strictEqual(response.profileImage.height, profileImageHeight); + assert.strictEqual(response.profileImage.width, profileImageWidth); + assert.strictEqual(response.resourceViewer, resourceViewer); + assert.strictEqual(response.sheetCount, sheetCount); + }); + + it('getUser required response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/get-user/required-response-body-properties' + } + }; + const response = await client.users.getUser(options); + + // Verify required properties + assert.ok(response); + assert.strictEqual(response.id, TEST_USER_ID); + assert.ok(response.account); + assert.strictEqual(response.account.id, accountId); + assert.strictEqual(response.account.name, accountName); + assert.strictEqual(response.company, company); + assert.strictEqual(response.department, department); + assert.strictEqual(response.email, email); + assert.strictEqual(response.firstName, firstName); + assert.strictEqual(response.jiraAdmin, jiraAdmin); + assert.strictEqual(response.lastName, lastName); + assert.strictEqual(response.locale, locale); + assert.strictEqual(response.mobilePhone, mobilePhone); + assert.strictEqual(response.role, role); + assert.strictEqual(response.salesforceAdmin, salesforceAdmin); + assert.strictEqual(response.salesforceUser, salesforceUser); + assert.strictEqual(response.timeZone, 'US/Pacific'); + assert.strictEqual(response.title, title); + assert.strictEqual(response.workPhone, workPhone); + + // Verify optional properties are undefined + assert.strictEqual(response.admin, undefined); + assert.strictEqual(response.alternateEmails, undefined); + assert.strictEqual(response.customWelcomeScreenViewed, undefined); + assert.strictEqual(response.groupAdmin, undefined); + assert.strictEqual(response.lastLogin, undefined); + assert.strictEqual(response.licensedSheetCreator, undefined); + assert.strictEqual(response.profileImage, undefined); + assert.strictEqual(response.resourceViewer, undefined); + assert.strictEqual(response.sheetCount, undefined); + }); + + it('getUser error 500 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/500-response' + } + }; + try { + await client.users.getUser(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); + } + }); + + it('getUser error 400 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/400-response' + } + }; + try { + await client.users.getUser(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); + } + }); +}); diff --git a/test/mock-api/users/test_list_alternate_emails.js b/test/mock-api/users/test_list_alternate_emails.js new file mode 100644 index 0000000..2a6e7f1 --- /dev/null +++ b/test/mock-api/users/test_list_alternate_emails.js @@ -0,0 +1,94 @@ +const assert = require('assert'); +const crypto = require('crypto'); +const { createClient, findWireMockRequest } = require('../utils/utils.js'); +const { + TEST_USER_ID, + TEST_ALTERNATE_EMAIL_ID, + TEST_ALTERNATE_EMAIL, + TEST_PAGE_NUMBER, + TEST_PAGE_SIZE, + TEST_TOTAL_PAGES, + TEST_TOTAL_COUNT, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE +} = require('./common_test_constants.js'); + +describe('Users - listAlternateEmails endpoint tests', function () { + let client = createClient(); + const TEST_ALTERNATE_EMAIL_ID_1 = TEST_ALTERNATE_EMAIL_ID; + const TEST_EMAIL_1 = TEST_ALTERNATE_EMAIL; + const TEST_CONFIRMED_1 = true; + it('listAlternateEmails generated url is correct', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/alternate-emails/list-alternate-emails/all-response-body-properties' + } + }; + await client.users.listAlternateEmails(options); + const matchedRequest = await findWireMockRequest(requestId); + + assert.ok(matchedRequest.url.includes(`/users/${TEST_USER_ID}/alternateemails`)); + }); + + it('listAlternateEmails all response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/alternate-emails/list-alternate-emails/all-response-body-properties' + } + }; + const response = await client.users.listAlternateEmails(options); + assert.ok(response); + assert.strictEqual(response.pageNumber, TEST_PAGE_NUMBER); + assert.strictEqual(response.pageSize, TEST_PAGE_SIZE); + assert.strictEqual(response.totalPages, TEST_TOTAL_PAGES); + assert.strictEqual(response.totalCount, TEST_TOTAL_COUNT); + assert.strictEqual(response.data.length, 1); + assert.strictEqual(response.data[0].id, TEST_ALTERNATE_EMAIL_ID_1); + assert.strictEqual(response.data[0].confirmed, TEST_CONFIRMED_1); + assert.strictEqual(response.data[0].email, TEST_EMAIL_1); + }); + + it('listAlternateEmails error 500 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/500-response' + } + }; + try { + await client.users.listAlternateEmails(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); + } + }); + + it('listAlternateEmails error 400 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/400-response' + } + }; + try { + await client.users.listAlternateEmails(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); + } + }); +}); diff --git a/test/mock-api/users/test_list_user_plans.js b/test/mock-api/users/test_list_user_plans.js index 77da72b..9c1eeb7 100644 --- a/test/mock-api/users/test_list_user_plans.js +++ b/test/mock-api/users/test_list_user_plans.js @@ -1,15 +1,24 @@ const assert = require('assert'); const crypto = require('crypto'); const { createClient, findWireMockRequest } = require('../utils/utils.js'); -const { TEST_USER_ID, TEST_PLAN_ID } = require('./common_test_constants.js'); +const { + TEST_USER_ID, + TEST_PLAN_ID, + TEST_SEAT_TYPE_LAST_CHANGED_AT, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE, + TEST_PROVISIONAL_EXPIRATION_DATE +} = require('./common_test_constants.js'); describe('Users - listUserPlans endpoint tests', function () { const client = createClient(); const lastKey = '12345678901234569'; const maxItems = 100; const seatType = 'MEMBER'; - const seatTypeLastChangedAt = '2025-01-01T00:00:00.123456789Z'; - const provisionalExpirationDate = '2026-12-13T12:17:52.525696Z'; + const seatTypeLastChangedAt = TEST_SEAT_TYPE_LAST_CHANGED_AT; + const provisionalExpirationDate = TEST_PROVISIONAL_EXPIRATION_DATE; const isInternalTrue = false; it('listUserPlans generated url is correct', async function () { @@ -92,8 +101,8 @@ describe('Users - listUserPlans endpoint tests', function () { await client.users.listUserPlans(options); assert.fail('Expected an error to be thrown'); } catch (error) { - assert.strictEqual(error.statusCode, 500); - assert.strictEqual(error.message, 'Internal Server Error'); + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); } }); @@ -110,8 +119,8 @@ describe('Users - listUserPlans endpoint tests', function () { await client.users.listUserPlans(options); assert.fail('Expected an error to be thrown'); } catch (error) { - assert.strictEqual(error.statusCode, 400); - assert.strictEqual(error.message, 'Malformed Request'); + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); } }); }); diff --git a/test/mock-api/users/test_list_users.js b/test/mock-api/users/test_list_users.js index 95d4895..dc4cac4 100644 --- a/test/mock-api/users/test_list_users.js +++ b/test/mock-api/users/test_list_users.js @@ -1,30 +1,47 @@ const assert = require('assert'); const crypto = require('crypto'); const { createClient, findWireMockRequest } = require('../utils/utils.js'); -const { TEST_PLAN_ID } = require('./common_test_constants.js'); +const { + TEST_PLAN_ID, + TEST_EMAIL, + TEST_FIRST_NAME, + TEST_LAST_NAME, + TEST_NAME, + TEST_CUSTOM_WELCOME_SCREEN_VIEWED, + TEST_LAST_LOGIN, + TEST_SEAT_TYPE_LAST_CHANGED_AT, + TEST_PAGE_NUMBER, + TEST_PAGE_SIZE, + TEST_SHEET_COUNT, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE, + TEST_PROVISIONAL_EXPIRATION_DATE +} = require('./common_test_constants.js'); describe('Users - listAllUsers endpoint tests', function () { let client = createClient(); - const emails = 'test.user@smartsheet.com'; + const emails = TEST_EMAIL; const seatType = 'MEMBER'; - const page = 1; - const pageSize = 100; + const page = TEST_PAGE_NUMBER; + const pageSize = TEST_PAGE_SIZE; const includeAll = false; - const seatTypeLastChangedAt = '2025-06-14T09:55:30Z'; - const provisionalExpirationDate = '2026-12-13T12:17:52.525696Z'; + const seatTypeLastChangedAt = TEST_SEAT_TYPE_LAST_CHANGED_AT; + const provisionalExpirationDate = TEST_PROVISIONAL_EXPIRATION_DATE; const isInternal = true; - const firstName = 'Test'; - const lastName = 'User'; - const name = 'Test User'; - const email = 'test.user@smartsheet.com'; + const firstName = TEST_FIRST_NAME; + const lastName = TEST_LAST_NAME; + const name = TEST_NAME; + const email = TEST_EMAIL; const admin = true; const licensedSheetCreator = true; const resourceViewer = true; const groupAdmin = true; const status = 'ACTIVE'; - const sheetCount = -1; - const lastLogin = '2020-10-04T18:32:47Z'; - const customWelcomeScreenViewed = '2020-08-25T12:15:47Z'; + const sheetCount = TEST_SHEET_COUNT; + const lastLogin = TEST_LAST_LOGIN; + const customWelcomeScreenViewed = TEST_CUSTOM_WELCOME_SCREEN_VIEWED; it('listUsers generated url is correct', async function () { const requestId = crypto.randomUUID(); @@ -139,8 +156,8 @@ describe('Users - listAllUsers endpoint tests', function () { await client.users.listAllUsers(options); assert.fail('Expected an error to be thrown'); } catch (error) { - assert.strictEqual(error.statusCode, 500); - assert.strictEqual(error.message, 'Internal Server Error'); + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); } }); @@ -159,8 +176,8 @@ describe('Users - listAllUsers endpoint tests', function () { await client.users.listAllUsers(options); assert.fail('Expected an error to be thrown'); } catch (error) { - assert.strictEqual(error.statusCode, 400); - assert.strictEqual(error.message, 'Malformed Request'); + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); } }); }); diff --git a/test/mock-api/users/test_make_alternate_email_primary.js b/test/mock-api/users/test_make_alternate_email_primary.js new file mode 100644 index 0000000..e69554a --- /dev/null +++ b/test/mock-api/users/test_make_alternate_email_primary.js @@ -0,0 +1,94 @@ +const assert = require('assert'); +const crypto = require('crypto'); +const { createClient, findWireMockRequest } = require('../utils/utils.js'); +const { + TEST_USER_ID, + TEST_ALTERNATE_EMAIL_ID, + TEST_SUCCESS_MESSAGE, + TEST_SUCCESS_RESULT_CODE, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE +} = require('./common_test_constants.js'); + +describe('Users - makeAlternateEmailPrimary endpoint tests', function () { + let client = createClient(); + const TEST_EMAIL = 'alternate.email@smartsheet.com'; + const TEST_CONFIRMED = true; + + it('makeAlternateEmailPrimary generated url is correct', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + alternateEmailId: TEST_ALTERNATE_EMAIL_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/alternate-emails/make-alternate-email-primary/all-response-body-properties' + } + }; + await client.users.makeAlternateEmailPrimary(options); + const matchedRequest = await findWireMockRequest(requestId); + + assert.ok(matchedRequest.url.includes(`/users/${TEST_USER_ID}/alternateemails/${TEST_ALTERNATE_EMAIL_ID}/makeprimary`)); + }); + + it('makeAlternateEmailPrimary all response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + alternateEmailId: TEST_ALTERNATE_EMAIL_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/alternate-emails/make-alternate-email-primary/all-response-body-properties' + } + }; + const response = await client.users.makeAlternateEmailPrimary(options); + assert.ok(response); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); + assert.ok(Array.isArray(response.data)); + assert.strictEqual(response.data.length, 1); + assert.strictEqual(response.data[0].id, TEST_ALTERNATE_EMAIL_ID); + assert.strictEqual(response.data[0].confirmed, TEST_CONFIRMED); + assert.strictEqual(response.data[0].email, TEST_EMAIL); + }); + + it('makeAlternateEmailPrimary error 500 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + alternateEmailId: TEST_ALTERNATE_EMAIL_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/500-response' + } + }; + try { + await client.users.makeAlternateEmailPrimary(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); + } + }); + + it('makeAlternateEmailPrimary error 400 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + alternateEmailId: TEST_ALTERNATE_EMAIL_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/400-response' + } + }; + try { + await client.users.makeAlternateEmailPrimary(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); + } + }); +}); diff --git a/test/mock-api/users/test_remove_user.js b/test/mock-api/users/test_remove_user.js new file mode 100644 index 0000000..cd1a36a --- /dev/null +++ b/test/mock-api/users/test_remove_user.js @@ -0,0 +1,131 @@ +const assert = require('assert'); +const crypto = require('crypto'); +const { createClient, findWireMockRequest } = require('../utils/utils.js'); +const { + TEST_USER_ID, + TEST_SUCCESS_MESSAGE, + TEST_SUCCESS_RESULT_CODE, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE +} = require('./common_test_constants.js'); + +describe('Users - removeUser endpoint tests', function () { + let client = createClient(); + const transferToUserId = 9876543210987654; + const transferSheets = true; + const removeFromSharing = true; + + it('removeUser generated url is correct', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/remove-user/all-response-body-properties' + } + }; + await client.users.removeUser(options); + const matchedRequest = await findWireMockRequest(requestId); + + assert.ok(matchedRequest.url.includes(`/2.0/users/${TEST_USER_ID}`)); + }); + + it('removeUser with query parameters generated url is correct', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + queryParameters: { + transferTo: transferToUserId, + transferSheets: transferSheets, + removeFromSharing: removeFromSharing + }, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/remove-user/all-response-body-properties' + } + }; + await client.users.removeUser(options); + const matchedRequest = await findWireMockRequest(requestId); + + assert.ok(matchedRequest.url.includes(`/2.0/users/${TEST_USER_ID}`)); + const queryParams = matchedRequest.queryParams; + const transferToActual = parseInt(queryParams.transferTo.values[0]); + const transferSheetsActual = queryParams.transferSheets.values[0]; + const removeFromSharingActual = queryParams.removeFromSharing.values[0]; + assert.strictEqual(transferToActual, transferToUserId); + assert.strictEqual(transferSheetsActual, transferSheets.toString()); + assert.strictEqual(removeFromSharingActual, removeFromSharing.toString()); + }); + + it('removeUser all response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/remove-user/all-response-body-properties' + } + }; + const response = await client.users.removeUser(options); + assert.ok(response); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); + }); + + it('removeUser with transferTo all response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + queryParameters: { + transferTo: transferToUserId, + transferSheets: transferSheets + }, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/remove-user/all-response-body-properties' + } + }; + const response = await client.users.removeUser(options); + assert.ok(response); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); + }); + + it('removeUser error 500 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/500-response' + } + }; + try { + await client.users.removeUser(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); + } + }); + + it('removeUser error 400 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/400-response' + } + }; + try { + await client.users.removeUser(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); + } + }); +}); diff --git a/test/mock-api/users/test_remove_user_from_plan.js b/test/mock-api/users/test_remove_user_from_plan.js index ccc1bce..5ed5682 100644 --- a/test/mock-api/users/test_remove_user_from_plan.js +++ b/test/mock-api/users/test_remove_user_from_plan.js @@ -1,7 +1,16 @@ const assert = require('assert'); const crypto = require('crypto'); const { createClient, findWireMockRequest } = require('../utils/utils.js'); -const { TEST_USER_ID, TEST_PLAN_ID } = require('./common_test_constants.js'); +const { + TEST_USER_ID, + TEST_PLAN_ID, + TEST_SUCCESS_MESSAGE, + TEST_SUCCESS_RESULT_CODE, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE +} = require('./common_test_constants.js'); describe('Users - removeUserFromPlan endpoint tests', function () { let client = createClient(); @@ -34,8 +43,8 @@ describe('Users - removeUserFromPlan endpoint tests', function () { }; const response = await client.users.removeUserFromPlan(options); assert.ok(response); - assert.strictEqual(response.message, 'SUCCESS'); - assert.strictEqual(response.resultCode, 0); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); }); it('removeUserFromPlan error 500 response', async function () { @@ -52,8 +61,8 @@ describe('Users - removeUserFromPlan endpoint tests', function () { await client.users.removeUserFromPlan(options); assert.fail('Expected an error to be thrown'); } catch (error) { - assert.strictEqual(error.statusCode, 500); - assert.strictEqual(error.message, 'Internal Server Error'); + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); } }); @@ -71,8 +80,8 @@ describe('Users - removeUserFromPlan endpoint tests', function () { await client.users.removeUserFromPlan(options); assert.fail('Expected an error to be thrown'); } catch (error) { - assert.strictEqual(error.statusCode, 400); - assert.strictEqual(error.message, 'Malformed Request'); + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); } }); }); diff --git a/test/mock-api/users/test_update_user.js b/test/mock-api/users/test_update_user.js new file mode 100644 index 0000000..79ad842 --- /dev/null +++ b/test/mock-api/users/test_update_user.js @@ -0,0 +1,152 @@ +const assert = require('assert'); +const crypto = require('crypto'); +const { createClient, findWireMockRequest } = require('../utils/utils.js'); +const { + TEST_USER_ID, + TEST_EMAIL, + TEST_FIRST_NAME, + TEST_LAST_NAME, + TEST_NAME, + TEST_PROFILE_IMAGE_ID, + TEST_PROFILE_IMAGE_HEIGHT, + TEST_PROFILE_IMAGE_WIDTH, + TEST_SUCCESS_MESSAGE, + TEST_SUCCESS_RESULT_CODE, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE +} = require('./common_test_constants.js'); + +describe('Users - updateUser endpoint tests', function () { + let client = createClient(); + const email = TEST_EMAIL; + const firstName = TEST_FIRST_NAME; + const lastName = TEST_LAST_NAME; + const name = TEST_NAME; + const admin = true; + const licensedSheetCreator = true; + const groupAdmin = false; + const resourceViewer = true; + const profileImageId = TEST_PROFILE_IMAGE_ID; + const profileImageHeight = TEST_PROFILE_IMAGE_HEIGHT; + const profileImageWidth = TEST_PROFILE_IMAGE_WIDTH; + + const testUpdateBody = { + email: email, + firstName: firstName, + lastName: lastName, + admin: admin, + licensedSheetCreator: licensedSheetCreator, + groupAdmin: groupAdmin, + resourceViewer: resourceViewer + }; + + it('updateUser generated url is correct', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + body: testUpdateBody, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/update-user/all-response-body-properties' + } + }; + await client.users.updateUser(options); + const matchedRequest = await findWireMockRequest(requestId); + + assert.ok(matchedRequest.url.includes(`/2.0/users/${TEST_USER_ID}`)); + let body = JSON.parse(matchedRequest.body); + assert.strictEqual(body.email, email); + assert.strictEqual(body.firstName, firstName); + assert.strictEqual(body.lastName, lastName); + assert.strictEqual(body.admin, admin); + assert.strictEqual(body.licensedSheetCreator, licensedSheetCreator); + assert.strictEqual(body.groupAdmin, groupAdmin); + assert.strictEqual(body.resourceViewer, resourceViewer); + }); + + it('updateUser all response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + body: testUpdateBody, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/update-user/all-response-body-properties' + } + }; + const response = await client.users.updateUser(options); + assert.ok(response); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); + assert.strictEqual(response.data[0].id, TEST_USER_ID); + assert.strictEqual(response.data[0].email, email); + assert.strictEqual(response.data[0].firstName, firstName); + assert.strictEqual(response.data[0].lastName, lastName); + assert.strictEqual(response.data[0].name, name); + assert.strictEqual(response.data[0].profileImage.imageId, profileImageId); + assert.strictEqual(response.data[0].profileImage.height, profileImageHeight); + assert.strictEqual(response.data[0].profileImage.width, profileImageWidth); + }); + + it('updateUser required response body properties', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + body: testUpdateBody, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/users/update-user/required-response-body-properties' + } + }; + const response = await client.users.updateUser(options); + assert.ok(response); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); + assert.strictEqual(response.data[0].id, TEST_USER_ID); + assert.strictEqual(response.data[0].email, email); + assert.strictEqual(response.data[0].firstName, firstName); + assert.strictEqual(response.data[0].lastName, lastName); + assert.strictEqual(response.data[0].name, name); + assert.strictEqual(response.data[0].profileImage, undefined); + }); + + it('updateUser error 500 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + body: testUpdateBody, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/500-response' + } + }; + try { + await client.users.updateUser(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); + } + }); + + it('updateUser error 400 response', async function () { + const requestId = crypto.randomUUID(); + const options = { + userId: TEST_USER_ID, + body: testUpdateBody, + customProperties: { + 'x-request-id': requestId, + 'x-test-name': '/errors/400-response' + } + }; + try { + await client.users.updateUser(options); + assert.fail('Expected an error to be thrown'); + } catch (error) { + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); + } + }); +}); diff --git a/test/mock-api/users/test_user_upgrade_downgrade.js b/test/mock-api/users/test_user_upgrade_downgrade.js index 6d2e364..a47d487 100644 --- a/test/mock-api/users/test_user_upgrade_downgrade.js +++ b/test/mock-api/users/test_user_upgrade_downgrade.js @@ -1,7 +1,16 @@ const assert = require('assert'); const crypto = require('crypto'); const { createClient, findWireMockRequest } = require('../utils/utils.js'); -const { TEST_USER_ID, TEST_PLAN_ID } = require('./common_test_constants.js'); +const { + TEST_USER_ID, + TEST_PLAN_ID, + TEST_SUCCESS_MESSAGE, + TEST_SUCCESS_RESULT_CODE, + ERROR_500_STATUS_CODE, + ERROR_500_MESSAGE, + ERROR_400_STATUS_CODE, + ERROR_400_MESSAGE +} = require('./common_test_constants.js'); describe('Users - upgradeUser & downgradeUser endpoint tests', function () { let client = createClient(); @@ -42,8 +51,8 @@ describe('Users - upgradeUser & downgradeUser endpoint tests', function () { }; const response = await client.users.upgradeUser(options); assert.ok(response); - assert.strictEqual(response.message, 'SUCCESS'); - assert.strictEqual(response.resultCode, 0); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); }); it('upgradeUser no seat type passed', async function () { @@ -58,8 +67,8 @@ describe('Users - upgradeUser & downgradeUser endpoint tests', function () { }; const response = await client.users.upgradeUser(options); assert.ok(response); - assert.strictEqual(response.message, 'SUCCESS'); - assert.strictEqual(response.resultCode, 0); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); }); it('upgradeUser error 500 response', async function () { @@ -77,8 +86,8 @@ describe('Users - upgradeUser & downgradeUser endpoint tests', function () { await client.users.upgradeUser(options); assert.fail('Expected an error to be thrown'); } catch (error) { - assert.strictEqual(error.statusCode, 500); - assert.strictEqual(error.message, 'Internal Server Error'); + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); } }); @@ -97,8 +106,8 @@ describe('Users - upgradeUser & downgradeUser endpoint tests', function () { await client.users.upgradeUser(options); assert.fail('Expected an error to be thrown'); } catch (error) { - assert.strictEqual(error.statusCode, 400); - assert.strictEqual(error.message, 'Malformed Request'); + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); } }); @@ -133,8 +142,8 @@ describe('Users - upgradeUser & downgradeUser endpoint tests', function () { }; const response = await client.users.downgradeUser(options); assert.ok(response); - assert.strictEqual(response.message, 'SUCCESS'); - assert.strictEqual(response.resultCode, 0); + assert.strictEqual(response.message, TEST_SUCCESS_MESSAGE); + assert.strictEqual(response.resultCode, TEST_SUCCESS_RESULT_CODE); }); it('downgradeUser error 500 response', async function () { @@ -152,8 +161,8 @@ describe('Users - upgradeUser & downgradeUser endpoint tests', function () { await client.users.downgradeUser(options); assert.fail('Expected an error to be thrown'); } catch (error) { - assert.strictEqual(error.statusCode, 500); - assert.strictEqual(error.message, 'Internal Server Error'); + assert.strictEqual(error.statusCode, ERROR_500_STATUS_CODE); + assert.strictEqual(error.message, ERROR_500_MESSAGE); } }); @@ -172,8 +181,8 @@ describe('Users - upgradeUser & downgradeUser endpoint tests', function () { await client.users.downgradeUser(options); assert.fail('Expected an error to be thrown'); } catch (error) { - assert.strictEqual(error.statusCode, 400); - assert.strictEqual(error.message, 'Malformed Request'); + assert.strictEqual(error.statusCode, ERROR_400_STATUS_CODE); + assert.strictEqual(error.message, ERROR_400_MESSAGE); } }); }); From 0ce66efeb89c54c6058e913e9d03d249299d58ec Mon Sep 17 00:00:00 2001 From: denislavstanchev Date: Mon, 17 Nov 2025 12:14:02 +0200 Subject: [PATCH 2/7] Add wiremock tests for the user module --- openapi.yaml | 39466 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 39466 insertions(+) create mode 100644 openapi.yaml diff --git a/openapi.yaml b/openapi.yaml new file mode 100644 index 0000000..1400fff --- /dev/null +++ b/openapi.yaml @@ -0,0 +1,39466 @@ +openapi: 3.0.3 +servers: + - url: https://api.smartsheet.com/2.0 + - url: https://api.smartsheet.eu/2.0 + - url: https://api.smartsheet.au/2.0 +info: + title: Smartsheet OpenAPI Reference + version: 2.0.0 + contact: + name: Support + url: https://help.smartsheet.com/contact + description: > + Welcome to the OpenAPI reference documentation for the Smartsheet API! + + + > **Important:** + + > * The Smartsheet API is restricted to users on Business and Enterprise + plans + + > * The Developer Agreement governs + the use of the Smartsheet API and Smartsheet software development kits + (SDKs) + + + **QUICKLINKS** + + + - **Base URL:** + + ``` + https://api.smartsheet.com/2.0/ + ``` + + - **Getting started:** Generate an API access token + and [make a request](/api/smartsheet/guides/getting-started). + + + - **Changelog:** See the latest [API updates](/api/smartsheet/changelog). + + + - **Schemas:** View the [object schemas](/api/smartsheet/openapi/schemas) + not explicitly listed in the resource sections. + + + - **Error codes:** Look up common API [error + codes](/api/smartsheet/error-codes). + + + - **Guides:** Learn various ways of using the API with the help of our + [Guides](/api/smartsheet/introduction). + + + Browse the Smartsheet API operations by resource on the left and start + building with the Smartsheet API! +tags: + - name: alternateEmailAddress + x-displayName: Alternate Email addresses + description: > + A User in Smartsheet must have a primary email address associated with + their user account (User.email) and may optionally have one or more + alternate email addresses associated with their account + (User.alternateEmails). The following operations must be performed using + an user's primary email address: + + + * Add Group Members + + * Add User + + * Create Update Request + + * Share Report + + * Share Sheet + + * Share Workspace + + + Attempting to specify a user's alternate email address for any of the + above operations results in an error. + - name: attachments + x-displayName: Attachments + description: > + Attachments can exist on a [comment](/api/smartsheet/openapi/comments) + (that is, + + within a discussion), on a [row](/api/smartsheet/openapi/rows), or on a + + [sheet](/api/smartsheet/openapi/sheets). + + +

Post an Attachment

+ + + Like the Smartsheet app, the Smartsheet API allows uploading files to + + sheets, rows, and comments. + + + You can upload a file by performing either a simple upload or a multipart + + upload. + + + + A simple upload allows you + + to add a single file attachment to the specified object. + + + For example, you can perform a simple upload to attach a file to a + + sheet, [attach a + + file to a + row](/api/smartsheet/openapi/attachments/row-attachments-attachfile), or + + [attach a file to a + + comment](/api/smartsheet/openapi/attachments/attachments-attachtocomment). + + + + A multipart upload + + allows you to add a single file attachment to the specified object (that + + is, attach a file to a sheet, row, or comment), or to create an object and + + attach a file using a single request. + + + For example, you can perform a multipart upload to [add a new + + comment](/api/smartsheet/openapi/comments/comments-create) that contains a + single + + file attachment or to [add a new discussion to a + + sheet](/api/smartsheet/openapi/discussions/discussions-create) that + contains a + + single file attachment. + + + + The max file size for uploads through the API is limited to 30mb. + + + + NOTE: This is a resource-intensive operation. If you encounter an error, + + see [Rate + Limiting](/api/smartsheet/guides/advanced-topics/scalability-options). + + + +

Multipart Uploads

+ + + + A multipart upload request must include the following HTTP headers: + + + + | Header | Description | + + | -----|-----| + + | **Content-Length** | The length of the request payload. | + + | **Content-Type** | Must be set to **multipart/form-data**, and include + the + + boundary string that separates the parts in the request payload. | + + + + The request body of a multipart upload request contains one or more parts, + + each part containing either JSON or a file to upload. + + + The request body must contain at least one part. + + + Each part must start with the boundary string specified in the + + **Content-Type** request header, and must contain the following part + + headers: + + + + | Header | Description | + + | -----|-----| + + | **Content-Disposition** | Contains the following semicolon-delimited + items:NOTE: Values specified in the + Content-Disposition header must be URL-encoded. | + + | **Content-Type** | The content type of the part: **application/json** + for JSON objects, or the applicable MIME type for file parts | + + + + The last part in the request must be followed by the boundary string, + + followed by two hyphens. + + + + The documentation for each operation that supports multipart uploads + + specifies the number and names of parts that are expected for the + + operation. + + + File parts must have the part name "file", and documentation for + + operations which allow for JSON object parts specify the required part + + name for the JSON part. + + + + The following example shows a multipart upload request that creates a + + comment containing the specified text and file attachment: + + + + `POST + + https://api.smartsheet.com/2.0/sheets/4509093797881732/discussions/2889925487028100/comments` + + + `Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789` + + + `Content-Length: 29008` + + + `Content-Type: multipart/form-data; boundary=----gU8h01zAAp3LagBr` + + + + `------gU8h01zAAp3LagBr` + + + `Content-Disposition: form-data; name="comment"` + + + `Content-Type: application/json` + + + + `{ "text": "Please review the attached image." }` + + + `------gU8h01zAAp3LagBr` + + + `Content-Disposition: form-data; name="file"; filename="picture.jpg"` + + + `Content-Type: image/jpeg` + + + + *< Binary content for file >* + + + `------gU8h01zAAp3LagBr--` + + + + NOTE: Most programming languages have libraries that can be used to + + assemble multipart requests. + + + +

Simple Uploads

+ + + + To perform this kind of upload, you must set specific headers to tell + + Smartsheet about the file. The following three headers are required: + + + + Header | Description | + + -----|-----| + + **Content-Disposition** | **attachment** to tell the API that a file is in + the body of the `POST` request, followed by a semicolon, followed by + **filename=** and the URL-encoded filename in quotes + + **Content-Length** | Must be set to the size of the file, in bytes. For + example to determine file size using in UNIX:

`$ ls -l + ProgressReport.docx`
`5463 ProgressReport.docx`

+ + **Content-Type** | Can be left blank if it is not known (but must be + present); Smartsheet makes its best guess based on the extension of the + file. + + + + The following example request shows a simple upload that adds a file + + attachment to a sheet: + + + + `POST https://api.smartsheet.com/2.0/sheets/4509093797881732/attachments` + + + `Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789` + + + `Content-Disposition: attachment; filename="ProgressReport.docx"` + + + `Content-Type: application/msword` + + + `Content-Length: 5463` + + + + *< Binary content for file >* + + + + As shown in this example, the contents of the file is included in the body + + of the `POST` request. In most programming languages, this is done by + + reading the file from an input stream and writing it out to the output + + stream of the HTTP request. + - name: automationRules + x-displayName: Automation Rules + description: > + Automation is a catch-all term for approvals, notifications, and update + + requests. You can delete, update, or retrieve various automation settings + + through the API. You cannot create new automation rules programmatically. + + +

Disabled Reasons for Automation Rules

+ + + Reason | Description | + + -----|-----| + + **APPROVAL_COLUMN_MISSING** | This rule's approval status column has been + deleted. + + **APPROVAL_COLUMN_WRONG_TYPE** | The approval column must be a dropdown + column. + + **AUTOMATION_NOT_ENABLED_FOR_ORG** | To create or edit automated actions, + you need to upgrade your organization account to a Business or Enterprise + plan. + + **COLUMN_MISSING** | A column referenced by this rule has been deleted. + + **COLUMN_TYPE_INCOMPATIBLE** | A column referenced by this rule has been + changed to an incompatible column type. + + **NO_POTENTIAL_RECIPIENTS** | This rule has no recipients that will be + able to receive notifications based on this sheet's permission settings or + this account's approved domain sharing list. + + **NO_VALID_SELECTED_COLUMNS** | All selected columns for this rule have + been deleted. + - name: cellImages + x-displayName: Cell Images + description: | + A cell image is an image that has been uploaded to a cell within a sheet. + - name: cells + x-displayName: Cells + description: "A collection of cells comprises each row in a sheet.\n\n

Cell Links

\n\nCreating or updating cell links via the **cell.linkInFromCell** attribute is a special operation.\nA given row or cell update operation may contain only link updates, or no link updates.\nAttempting to mix row/cell updates with cell link updates results in error code 1115.\nAdditionally, a [CellLink object](/api/smartsheet/openapi/schemas/celllink) can only be added to an existing cell, so the **cell.linkInFromCell** attribute is not allowed when POSTing a new row to a sheet.\n\nWhen creating a cell link, **cell.value** must be null (the data is pulled from the linked cell).\n\nA cell may not contain both a hyperlink and a cell link, so **hyperlink** and **linkInFromCell** may never both be non-null at the same time.\n\n

Cell Reference

\n\n

Cell Value Representation

\n\n[Cell objects](/api/smartsheet/openapi/cells/cell) retrieved through the Smartsheet APIs have two main attributes representing cell values: **Cell.value**, and\n**Cell.displayValue**. A third attribute, **Cell.objectValue** is currently used only for adding and updating predecessors, or for multi-contact or multi-picklist details, such as email addresses or values in a multi-picklist. An empty cell returns no value.\n\n**Cell.displayValue** is always a string and is only returned for certain column types (see below). It represents the formatted value as it should\nbe displayed to an end-user. For example, if a TEXT_NUMBER column is formatted as a US Dollar currency, its **value** may be a number\nlike 1234.5678, but its **displayValue** is \"$1,234.57\".\n\n**Cell.value** represents a cell's raw value and can be one of the following primitive JSON types: string, number, or Boolean,\ndepending on the column type. An empty cell returns no value. Complex types are represented as strings, formatted as described below:\n\nHelp with Project Columns\n\nColumn Type | Possible Types for Cell.value | Returns Cell.displayValue?\n------------|-------------------------------|---------------------------\nABSTRACT_DATETIME | string: a project date and time in ISO-8601 format, or a free-form text value.
number: see [Dates and Times](/api/smartsheet/guides/basics/dates-and-times) for how to request dates to be returned as numbers. | No.\nCHECKBOX | Boolean: **true** if the checkbox is checked, **false** if unchecked, no value if the cell hasn't been touched yet.
string: a free-form text value. | No.\nCONTACT_LIST | string: an email address representing a contact, or a free-form text value. | Yes: same as **value** for free-form strings; for contacts, the contact's name if any, else their email address.\nDATE | string: a date in ISO-8601 format, or a free-form text value.
number: see [Dates and Times](/api/smartsheet/guides/basics/dates-and-times) for how to request dates to be returned as numbers. | No.\nDURATION | string: a duration value such as \"4d 6h 30m\" in the user's locale, or a free-form text value.
See the Help Center for more information on durations. | Yes: same as **value**\nMULTI_CONTACT_LIST | string: only visible when using a query parameter of **level** and the value appropriate to the dashboard, report, or sheet that you are querying, otherwise the column type is TEXT_NUMBER. | Yes: same as **value**; to see actual email addresses, see below.\nMULTI_PICKLIST | string: only visible when using a query parameter of **level** and the value appropriate to the dashboard, report, or sheet that you are querying, otherwise the column type is TEXT_NUMBER. | Yes: same as **value**; to see objectValue, see below.\nPICKLIST | string: one of the picklist's column options, or a free-form text value.
number: numeric values | Yes: same as **value** for strings; for number values, the number with formatting applied.\nPREDECESSOR\t| string: a comma-delimited predecessor list such as \"12FS +3d 4h, 14SS\", or a free-form text value.
See the Help Center for more information on predecessors. | Yes: same as **value**\nTEXT_NUMBER\t| string: free-form text values
number: numeric values | Yes: same as **value** for strings; for number values, the number with formatting applied.\n\n**Cell.objectValue** is an object representation of a cell's value and is currently used for adding or updating predecessor cell values, or for multi-contact details, such as email addresses.\n\n* For predecessors, it provides a more \"programmer friendly\" format for assembling predecessors. To update a cell's predecessors, set **objectValue** to a\n[PredecessorList object](/api/smartsheet/openapi/schemas/predecessorlist) containing [Predecessor objects](/api/smartsheet/openapi/schemas/predecessor).\n* For multi-contact or multi-picklist details, use both a level query parameter *and* an **include=objectValue** query to see email addresses rather than display names or to see multi-picklist values.\n\n

Cell Value Parsing

\n\nThe flexibility in cell value data types is a powerful feature in the Smartsheet application; however, it poses a challenge\nfor an API in terms of parsing. Being too flexible might result in unexpected behavior. For instance, if you write code\nto post a Date value to a Smartsheet and the API operation succeeds, you might assume that the date value you sent was interpreted\nas date. What happens if you posted your date in the wrong format? Do you really want Smartsheet to keep the malformed date\nas a string value? Probably not.\n\nTo address this problem, the Smartsheet API employs a simple scheme to indicate whether you want a more predictable and strict\ninterface or a more flexible one. By default, a cell value is expected to conform to \"strict\" rules for the type of the cell's column.\nIf an input value doesn't conform, the API returns [error code 1042](/api/smartsheet/error-codes).\n\nIf, however, you want the same flexibility as the Smartsheet Web app, you can disable the strict rules, and we'll do our best to make\nsense of it. To enable lenient parsing simply include **\"strict\": false** in the [Cell object](/api/smartsheet/openapi/cells/cell) in your request body.\n\nNOTE: How does strict cell value parsing compare to cell validation settings? Strict cell value parsing determines how string values are parsed. It is set on a per-call basis. In contrast, cell validation is part of the column definition. The overrideValidation property is restricted to sheet admins and does not override strict parsing.\n\nThe parsing rules for the various column types are as follows:\n\n**ABSTRACT_DATETIME**\n\nValue | Description |\n-----|-----|\n**lenient** | Smartsheet attempts to convert the string value to date using ISO 8601 date format, as well as several locale-specific date formats. If the value is a parsable date format, Smartsheet recognizes the date and stores it as such. All other values are simply text values.\n**strict** | The value must be a string value and a valid ISO 8601 date (YYYY-MM-DD). Alternatively, if Unix time (also known as epoch time) is used, you can use the query parameter of **numericDates** set to **true** to have Smartsheet convert epoch time to human readable dates. See [Dates and Times](/api/smartsheet/guides/basics/dates-and-times) for more information.\n\n**CHECKBOX**\n\nValue | Description |\n-----|-----|\n**lenient** | Boolean values and string values of **true** and **false** are handled the same as **strict**. All other values are saved as text values.\n**strict** | Only Boolean values (true or false) are valid.\n\n**CONTACT_LIST**\n\nValue | Description |\n-----|-----|\n**lenient** | If the value is a valid email address, Smartsheet handles it the same as **strict**. If not, Smartsheet saves the value as a text value.\n**strict** | The value must be a valid email address. If **displayValue** is set, Smartsheet uses that as the name; otherwise, if Smartsheet finds a match among the the access token owner's contacts, Smartsheet associates this cell with that existing contact.\n\nNOTE: See the [Contact List Columns](/api/smartsheet/openapi/cells) section for more information.\n\n**DATE**\n\nValue | Description |\n-----|-----|\n**lenient** | Smartsheet attempts to convert the string value to date using ISO 8601 date format, as well as several locale-specific date formats. If the value is a parsable date format, Smartsheet recognizes the date and stores it as such. All other values are simply text values.\n**strict** | The value must be a string value and a valid ISO 8601 date (YYYY-MM-DD). Alternatively, if Unix time (also known as epoch time) is used, you can use the query parameter of **numericDates** set to **true** to have Smartsheet convert epoch time to human readable dates. See [Dates and Times](/api/smartsheet/guides/basics/dates-and-times) for more information.\n\n**DURATION**\n\nValue | Description |\n-----|-----|\n**lenient** | Numeric values are treated as duration values in days. String values which are valid duration strings in the user's locale are treated as durations, and any other values are treated as free-form text values.\n**strict** | Only valid duration strings in the user's locale are valid. Information on duration strings can be found in the Help Center.\n\nNOTE: You may use the query string parameter projectParseLocale with a [supported locale string](/api/smartsheet/openapi/serverinfo) to force parsing in the specified locale (for example, using en_US lets you send in English values regardless of the user's locale).\n\n**MULTI_CONTACT_LIST**\n\nValue | Description |\n-----|-----|\nN/A | Set using the **objectValue** attribute for the Cell object, which is inherently strict. See [Cell Reference](/api/smartsheet/openapi/cells).\n\n**MULTI_PICKLIST**\n\nValue | Description |\n-----|-----|\nN/A | Set using the **objectValue** attribute for the Cell object, which is inherently strict. See [Cell Reference](/api/smartsheet/openapi/cells).\n\n**PICKLIST**\n\nValue | Description |\n-----|-----|\n**lenient** | All numeric and text values are valid. Formatted numbers are parsed like TEXT_NUMBER formatted numbers.\n**strict** | The value must be a string and must be one of the options for the picklist.\n\n**PREDECESSOR**\n\nValue | Description |\n-----|-----|\nN/A | Set using the **objectValue** attribute for the Cell object, which is inherently strict. See [Cell Reference](/api/smartsheet/openapi/cells).\n\n**TEXT_NUMBER**\n\nValue | Description |\n-----|-----|\n**lenient** | All numeric and text values are valid. Formatted numbers passed as text values, such as currencies (\"$5,000\"), percentages (\"50%\"), or decimals (\"100.5\") are parsed to their numeric equivalents, based on the locale of the access token owner, with the proper formatting enabled for the cell.\n**strict** | All numeric and text values are valid and are interpreted literally.\n\nNOTE: The Smartsheet application only supports numeric values in the range -9007199254740992 to 9007199254740992. If using strict parsing, any numeric value outside that range results in [error code 1148](/api/smartsheet/error-codes). If using lenient parsing, the value is silently converted to text.\n\n

Contact List Columns

\n\nWith columns of type **CONTACT_LIST**, the cell attributes **value** and **displayValue** are treated independently.\nThe contact's email address is represented by **value**, while the contact's name (and the value displayed in the cell in the Smartsheet app) is represented by **displayValue**.\n\nWhen creating or updating cells for a contact list column, the **displayValue** attribute works as follows:\n\n* If **displayValue** is non-null and non-empty, the Smartsheet cell displays the value provided.\n* If **displayValue** is an empty string, the Smartsheet cell displays the email address.\n* If **displayValue** is null or absent, Smartsheet makes a best guess effort at filling it in with a contact's name based on the email address.\n\n

Hyperlinks

\n\nYou can create and modify [hyperlinks](/api/smartsheet/openapi/schemas/hyperlink) by using any API operation that creates or updates cell data.\nWhen creating or updating a hyperlink, **cell.value** may be set to a string value or null.\nIf null, the cell's value is derived from the hyperlink:\n\n* If the hyperlink is a URL link, the cell's value is set to the URL itself.\n* If the hyperlink is a dashboard, report, or sheet link, the cell's value is set to the dashboard, report, or sheet name.\n\n

Images in Cells

\n\nFor details about working with images in cells, see [Cell Images](/api/smartsheet/openapi/cellimages).\n" + - name: columns + x-displayName: Columns + description: "A column is a component of a sheet or report.\n\n

Column Types

\n\nSmartsheet supports the following standard column types, which are represented in a [Column object](/api/smartsheet/openapi/columns/column) with a **type** attribute set to one of the following:\n\nColumn Type | Column.type Value | Notes |\n---|---|---|\nCheckbox \t\t| **CHECKBOX**\t\t| Checkbox, star, and flag types |\nContact List\t| **CONTACT_LIST**\t| List containing contacts or roles for a project. **Note:** You can use the [contactOptions](/api/smartsheet/openapi/schemas/contactoption) property to specify a pre-defined list of values for the column, which can also become lanes in card view. |\nContact List | **MULTI_CONTACT_LIST** | List where single cells can contain more than one contact. Only visible when using a query parameter of **level** and the value appropriate to the dashboard, report, or sheet that you are querying. To see email addresses behind the display names, combine an **include=objectValue** query parameter with a **level** query parameter. |\nDate\t\t\t| **DATE** | |\nDate/Time \t\t| **ABSTRACT_DATETIME** | Represents a project sheet's start and end dates.
**Only for dependency-enabled project sheets**
The API does not support setting a column to this type. (This can only be done through the Smartsheet Web app when configuring a project sheet.) Additionally, the API does not support updating data in the \"End Date\" column under any circumstance, and does not support updating data in the \"Start Date\" column if \"Predecessor\" is set for that row. |\nDate/Time\t\t| **DATETIME**\t| Used only by the following system-generated columns: |\nDropdown List\t| **PICKLIST**\t| Custom, RYG, Harvey ball, priority types, etc. |\nDropdown List\t| **MULTI_PICKLIST**\t| List where single cells can contain more than one dropdown item. Only visible when using a query parameter of **level** and the value appropriate to the dashboard, report, or sheet that you are querying. To see multi-picklist values behind the display names, combine an **include=objectValue** query parameter with a **level** query parameter. |\nDuration\t\t| **DURATION**\t\t| **Only for dependency-enabled project sheets**
The API does not support setting a column to this type. (This can only be done through the Smartsheet Web app when configuring a project sheet.) |\nPredecessor\t\t| **PREDECESSOR**\t| Defines what must happen first in a project flow. For more information, see the [Predecessor object](/api/smartsheet/openapi/schemas/predecessorlist). **Only for dependency-enabled project sheets** |\nText/Number\t\t| **TEXT_NUMBER**\t| |\n\nNOTE: See the [Cell Reference](/api/smartsheet/openapi/cells) section for information on getting and setting cell values for the different column types.\n\n

Symbol Columns

\n\nIn addition to the basic column types above, the Smartsheet app also supports columns that display symbols. These are specialized columns of type **CHECKBOX** or **PICKLIST**,\nwhose **symbol** attribute is set to one of the values below:\n\n**Symbols for CHECKBOX columns:**\n\n![A flag symbol](./images/img_pl_flagc.png)\n\nValue | Example |\n-----|-----|\n**FLAG** | \"A |\n**STAR** | \"A |\n\n**Symbols for PICKLIST columns:**\n\nValue | Example |\n-----|-----|\n**ARROWS_3_WAY** | \"An |\n**ARROWS_4_WAY** | \"An |\n**ARROWS_5_WAY** | \"An |\n**DECISION_SHAPES** | \"A |\n**DECISION_SYMBOLS** | \"A |\n**DIRECTIONS_3_WAY** | \"A |\n**DIRECTIONS_4_WAY** | \"A |\n**EFFORT** | \"An |\n**HARVEY_BALLS** | \"A |\n**HEARTS** | \"A |\n**MONEY** | \"A |\n**PAIN** | \"A |\n**PRIORITY** | \"A |\n**PRIORITY_HML** | \"A |\n**PROGRESS** | \"A |\n**RYG** | \"An |\n**RYGB** | \"An |\n**RYGG** | \"An |\n**SIGNAL** | \"A |\n**SKI** | \"A |\n**STAR_RATING** | \"A\n**VCR** | \"A |\n**WEATHER** | \"A |\n\nNOTE: The Smartsheet grid user interface presents several row attributes and features visually as columns, for example, attachments, discussions, row action indicator, or row number. The API does not consider these to be columns, and does not return or otherwise expose them as columns. The only columns returned by the API are user data columns.\n\n

System Columns

\n\nIn addition to the standard column types and symbols, Smartsheet has a number of system columns, which represent data that is\nfilled in by Smartsheet and whose values cannot be changed by the user. These columns are represented with standard\n[column types](/api/smartsheet/openapi/columns), with the [**Column.systemColumnType**](/api/smartsheet/openapi/columns/column) attribute set to one of the following:\n\nColumn.systemColumnType Value | Column Type | Notes\n-----|-----|-----|\n**AUTO_NUMBER** | TEXT_NUMBER | Columns of this system column type include an [AutoNumberFormat object](/api/smartsheet/openapi/schemas/autonumberformat) that describes the mask used to generate the value.\n**CREATED_BY** | CONTACT_LIST\n**CREATED_DATE** | DATETIME\n**MODIFIED_BY** | CONTACT_LIST\n**MODIFIED_DATE** | DATETIME\n" + - name: comments + x-displayName: Comments + description: > + A discussion is a container for a number of individual comments in a + + threaded conversation. For more details, see the + + [Discussion](/api/smartsheet/openapi/discussions) section. + + + + This section describes operations on an *individual* comment within a + + discussion thread. + + + + * To retrieve all discussions and comments for an entire sheet, use [List + + Discussions](/api/smartsheet/openapi/discussions/discussions-list) with + the query + + parameter **include=comments**. + + + * To retrieve all discussions and comments associated with a row, use + + [List Row + Discussions](/api/smartsheet/openapi/discussions/row-discussions-list) + + with the query parameter **include=comments**. + + + A comment can contain one or more attachments. + + + +

Comment Attachments

+ + + + For details about working with a comment's attachments, see + + [Attachments](/api/smartsheet/openapi/attachments). + - name: contacts + x-displayName: Contacts + description: > + A contact is a user's personal contact in Smartsheet (as described in the + Help Center article, Managing Contacts. + - name: crossSheetReferences + x-displayName: Cross-sheet References + description: > + To create a formula that references data in another sheet, you must first + create a cross-sheet + + reference between the detail sheet and the source sheet. That reference + must also define the cell range. + + Once you have created the cross-sheet reference, you can use the reference + name in any formula on the detail sheet. + + To create the formula, use Add Rows or Update Rows. Cross-sheet references + that are not used by any formula are + + automatically deleted after two hours. + - name: dashboards + x-displayName: Dashboards + description: > + Smartsheet dashboards are a collection of widgets that can contain data + from a variety of different data sources (for example, sheets, reports, or + custom data). Dashboards were once called Sights(TM) and this name is + still present in object names, endpoint paths, and other places. + - name: discussions + x-displayName: Discussions + description: > + A discussion is a container for a collection of individual + [comments](/api/smartsheet/openapi/comments) within a single thread. A + discussion can exist on a [row](/api/smartsheet/openapi/rows) or a + [sheet](/api/smartsheet/openapi/sheets). + + + In the UI, Smartsheet creates a discussion to contain each top-level + comment and subsequent replies into a single thread. + + + Using the API, you can only add a comment to a discussion. If the + discussion doesn't already exist, you must create it first. + + A discussion is a collection of one or more comments, each of which may + contain attachments. + + +

Discussion Attachments

+ + + For details about working with the attachments within a discussion, see + [Attachments](/api/smartsheet/openapi/attachments). + +

Discussion Comments

+ + + For details about working with a discussion's comments, see + [Comments](/api/smartsheet/openapi/comments). + - name: events + x-displayName: Events + description: > + Smartsheet uses event objects to capture actions such as creating, + updating, loading, deleting, and more for items such as sheets, reports, + dashboards, attachments, and users. With **Event Reporting**, you can use + the operations described here to programmatically retrieve these events. + + + > **Note:** Event Reporting is a premium add-on available for Enterprise + and Advanced Work Management plans only. For details on the add-on, please + contact our Sales Team. + + +

Event types

+ + + All events derive from the [Event](/api/smartsheet/openapi/events/event) + schema. Each event type overrides Event's `objectType` and `action` + properties with its specific object type and a typical action performed on + that object. Furthermore, each event type's `additionalDetails` object has + properties specific to the event type. + + + See [Event types](/api/smartsheet/event-types.md) for the complete event + listing, details, and example objects. + + +

System users

+ + + System components perform some actions in Smartsheet. Therefore, + + the `userId` property in some response payloads refers to a system + user--not to a regular user. For example, the Smartsheet Events API shows + + 5629504736520068 as the `userId` when an anonymous user accesses a sheet + + that is published for anyone. + + + The system users are listed below. New system `userIds` may be + + incorporated to this list as new features and subsystems are incorporated + + to Smartsheet: + + + System user | Description | + + -----|-----| + + 1688855062570884 | Data accessed/modified by Skype action (only possible + if Smartsheet account is connected to Skype) | + + 2814754969413508 | Data accessed/modified by Trello import action (only + possible if Smartsheet account is connected to Trello) | + + 3377704922834820 | Data accessed/modified due to Smartsheet cell-link | + + 3940654876256132 | Data accessed/modified by the Smartsheet Automation + system | + + 5066554783098756 | Access to object published to any user in the + Smartsheet organization account | + + 5629504736520068 | Access to Smartsheet object published to anyone | + + 6192454689941380 | Data accessed/modified by the Smartsheet Notification + system | + + 7881304550205316 | Data accessed/modified by Smartsheet Form submission | + - name: favorites + x-displayName: Favorites + description: > + Smartsheet allows users to "star" dashboards, folders, reports, sheets, + workspaces, and other objects on their Home tab to mark them as favorites. + + These API operations allow you to access the user's favorite API-supported + objects, as well as create and delete favorites. + + NOTE: For documentation purposes, "favoriteType" is a placeholder ENUM for + the various types of UI elements you can flag as a favorite. In sample + code, when you see "{favoriteType}", just replace it with one of the + following values: + + * dashboard or dashboards (aka Sight or Sights) + + * folder or folders + + * report or reports + + * sheet or sheets + + * template or templates + + * workspace or workspaces + - name: folders + x-displayName: Folders + description: > + A folder can exist in a user's **Sheets** folder + [Home](/api/smartsheet/openapi/home), in a + [folder](/api/smartsheet/openapi/folders), or in a + [workspace](/api/smartsheet/openapi/workspaces). + - name: groupMembers + x-displayName: Group Members + description: > + A group member is a user that belongs to a + [group](/api/smartsheet/openapi/groups). + - name: groups + x-displayName: Groups + description: > + A group is a collection of [group + members](/api/smartsheet/openapi/groupmembers). + - name: home + x-displayName: Home + description: > + In the Smartsheet UI, the "Home" tab shows all objects a user has access + to, including dashboards (also called Sights in the API), folders, + reports, sheets, templates, and workspaces. + + > **Note:** The GET /home endpoint is deprecated. Use GET + /folders/personal to get shared items and GET /workspaces/ to get + workspaces. + +

Home Folders

+ + + For details about working with folders in the user's **Sheets** folder + (that is, at the Home level), see + [Folders](/api/smartsheet/openapi/folders). + + +

Home Sheets

+ + + For details about working with sheets in the user's **Sheets** folder + (that is, at the Home level), see + [Sheets](/api/smartsheet/openapi/sheets). + - name: imports + x-displayName: Imports + description: | + Import CSV or XLSX data into a new sheet. + - name: proofs + x-displayName: Proofs + description: > + A proof is a container that holds attachments and comments. Limited to one + proof and its versions per row. + + A sheet can have multiple proofs. + - name: reports + x-displayName: Reports + description: > + A report is a filtered view of the data from one or more sheets. Like a + sheet, a report is comprised of columns, rows, and cells, and may + optionally contain attachments and discussions. + + A report is comprised of columns, rows, and cells, and may optionally + contain attachments and discussions. + + +

Report Attachments

+ + + For details about working with a report's attachments, see + [Attachments](/api/smartsheet/openapi/attachments). + + +

Report Cells

+ + + For details about working with a report's cells, see + [Cells](/api/smartsheet/openapi/cells). + + +

Report Columns

+ + + For details about working with a report's columns, see + [Columns](/api/smartsheet/openapi/columns). + + +

Report Discussions

+ + + For details about working with a report's discussions, see + [Discussions](/api/smartsheet/openapi/discussions). + + +

Report Rows

+ + + For details about working with a report's rows, see + [Rows](/api/smartsheet/openapi/rows). + - name: rows + x-displayName: Rows + description: "A row is a component of a sheet or report. Each row is composed of a\ncollection of cells, and may optionally contain discussions or\nattachments.\n\nA row is comprised of a collection of cells, and may optionally contain attachments and discussions.\n\n

Row Attachments

\n\nFor details about working with a row's attachments, see [Attachments](/api/smartsheet/openapi/attachments).\n\n

Row Cells

\n\nFor details about working with a row's cells, see [Cells](/api/smartsheet/openapi/cells).\n\nFor details about working with images in cells, see [Cell Images](/api/smartsheet/openapi/cellimages).\n\n

Row Discussions

\n\nFor details about working with a row's discussions, see [Discussions](/api/smartsheet/openapi/discussions).\n\n

Row Include Flags

\n\nEndpoints which return rows (for example, [Get Sheet](/api/smartsheet/openapi/sheets/getsheet), [Get Row](/api/smartsheet/openapi/rows/row-get)) support the optional **include** query string parameter. If specified, the value of the **include** parameter is\na comma-delimited list of flags that indicate additional attributes to be included in each [Row object](/api/smartsheet/openapi/rows/row) within the response.\n\nInclude Flag | Description |\n-------------|-------|\n**attachments**\t| Includes row **attachments** array.
To include discussion attachments, both **attachments** and **discussions** must be present in the include list.\n**columnType**\t| Includes **columnType** attribute in the row's [cells](/api/smartsheet/openapi/cells/cell) indicating the type of the column the cell resides in.\n**discussions**\t| Includes row **discussions** array.
To include discussion attachments, both **attachments** and **discussions** must be present in the include list.\n**filters**\t\t| Includes **filteredOut** attribute indicating if the row should be displayed or hidden according to the sheet's filters.\n**format**\t\t| Includes **format** attribute on the row, its cells, or summary fields. See [Cell formatting](/api/smartsheet/guides/advanced-topics/cell-formatting).\n**objectValue** | Includes **objectValue** attribute on cells containing values. For more information see [Cell Reference](/api/smartsheet/openapi/cells).\n**rowPermalink** | Includes **permalink** attribute that represents a direct link to the [row](/api/smartsheet/openapi/rows/row) in the Smartsheet application.\n**rowWriterInfo** | **DEPRECATED** Includes **createdBy** and **modifiedBy** attributes on the row, indicating the row's creator, and last modifier.\n**writerInfo** | Includes **createdBy** and **modifiedBy** attributes on the row or summary fields, indicating the row or summary field's creator, and last modifier.\n\n

Specify Row Location

\n\nWhen you [add a row](/api/smartsheet/openapi/rows/rows-addtosheet), the default behavior is for Smartsheet to put the new row at the bottom of the sheet. And when you [update a row](/api/smartsheet/openapi/rows/update-rows), the default behavior is to keep the row where it is. It is not necessary to use a location-specifier attribute if you want the default behavior.\n\nTo specify a location for new or updated rows other than the defaults, use the table below for reference. The table details possible row locations and provides JSON examples to help you construct one or more [Row objects](/api/smartsheet/openapi/rows/row) with location-specifier attributes.\n\nNote the following restrictions:\n\n* Use only one location-specifier attribute per request, unless you use **parentId** and **toBottom** or **siblingId** and **above**.\n* If you specify multiple rows in the request, all rows must have the same location-specifier attributes.\n* If you specify the **parentId** attribute, you cannot also specify the **siblingId** attribute.\n* If you specify the **siblingId** attribute, you cannot also specify the **parentId**, **toTop**, or **toBottom** attributes.\n* If you want to indent or outdent multiple rows, use the **parentId** attribute.\n\nDestination | Row Attributes | Examples |\n-------|--------|--------|\nTop of a sheet | **toTop** | ```(\"toTop\": true}```\nBottom of a sheet | **toBottom** | ```(\"toBottom\": true}```\nTop of an indented section a.k.a., first child row | **parentId** | ```(\"parentId\": 8896508249565060}```\nBottom of an indented section a.k.a., last child row | **parentId** +
**toBottom** | ```{\"parentId\": 8896508249565060, \"toBottom\": true}```\nBelow a specific row, at the same indent level | **siblingId** | ```{\"siblingId\": 8896508249565060}```\nAbove a specific row, at the same indent level | **siblingId** +
**above** | ```{\"siblingId\": 8896508249565060, \"above\": true}```\nIndent one existing row, must have a value of \"1\" | **indent** | ```{\"indent\": 1}```\nOutdent one existing row, must have a value of \"1\" | **outdent** | ```{\"outdent\": 1}```\n" + - name: search + x-displayName: Search + description: > + Search a specific sheet or search across all sheets that a user can + access. If you have not used the public API in a while, we will need to + provision your data. This could take up to 24 hours so please check back + later! + - name: sendViaEmail + x-displayName: Send via Email + description: > + The methods for sending via email rely on the type of object you want to + send. + + +

Send Report

+ + + For details about sending a report via email, see [Send Report via + Email](/api/smartsheet/openapi/reports/sendreportviaemail). + + +

Send Rows

+ + + For details about sending rows via email, see [Send Rows via + Email](/api/smartsheet/openapi/rows/rows-send). + + +

Send Sheet

+ + + For details about sending a sheet via email, see [Send Sheet via + Email](/api/smartsheet/openapi/sheets/sheet-send). + + +

Send Update Request

+ + + For details about sending an update request via email, see [Create an + Update + Request](/api/smartsheet/openapi/updaterequests/updaterequests-create). + - name: serverInfo + x-displayName: Server Info + description: > + For developer convenience, the Smartsheet API provides access to + application constants. + - name: sharing + x-displayName: Sharing + description: > + Use the *Sharing* operations to control sharing of dashboards, reports, + sheets, and workspaces. + - name: sheetSummary + x-displayName: Sheet Summary + description: > + A sheet summary allows users to define, organize, and report on custom + project and business metadata. Sheet summary is only available to + customers with business or enterprise plans. + - name: sheets + x-displayName: Sheets + description: > + A sheet can exist in a user's **Sheets** folder + + ([Home](/api/smartsheet/openapi/home)), in a + [folder](/api/smartsheet/openapi/folders), or + + in a [workspace](/api/smartsheet/openapi/workspaces). It is comprised of + columns, + + rows, and cells, and may optionally contain attachments and discussions. + + + A sheet is comprised of columns, rows, and cells, and may optionally + + contain attachments and discussions. + + + +

Sheet Attachments

+ + + + For details about working with a sheet's attachments, see + + [Attachments](/api/smartsheet/openapi/attachments). + + + +

Sheet Cells

+ + + + For details about working with a sheet's cells, see + + [Cells](/api/smartsheet/openapi/cells). + + + + For details about working with images in cells, see [Cell + + Images](/api/smartsheet/openapi/cellimages). + + + +

Sheet Columns

+ + + + For details about working with a sheet's columns, see + + [Columns](/api/smartsheet/openapi/columns). + + + +

Sheet Discussions

+ + + + There are two ways to get discussion-related information for a sheet: + + + + Operation | Returns + + ----------|----------| + + [Get Sheet](/api/smartsheet/openapi/sheets/getsheet)
(with **include** + parameter value **discussions**) | Response does not contain the comments + + that comprise each discussion. + + [List + Discussions](/api/smartsheet/openapi/discussions/discussions-list)
(with + **include** parameter value **comments**) | Response contains the + comments that comprise each discussion. + + + + For more information about working with a sheet's discussions, see + + [Discussions](/api/smartsheet/openapi/discussions). + + + +

Sheet Rows

+ + + + For details about working with a sheet's rows, see + + [Rows](/api/smartsheet/openapi/rows). + - name: templates + x-displayName: Templates + description: > + A template can be used to create a sheet, as described for the [Create + sheet in folder](/api/smartsheet/openapi/sheets/create-sheet-in-folder) + endpoint and the [Create sheet in + workspace](/api/smartsheet/openapi/sheets/create-sheet-in-workspace) + endpoint. + - name: tokens + x-displayName: Tokens + description: > + The Smartsheet API utilizes OAuth 2.0 for authentication and + authorization. An Authorization HTTP header containing an access token is + required to authenticate all API requests except for the requests to GET + Access Token or Refresh Access Token. For more information, see + Authentication. + - name: updateRequests + x-displayName: Update Requests + description: > + Send update requests to get updated by any collaborator on key rows, + regardless of whether they have a Smartsheet account or are shared to the + sheet. + - name: users + x-displayName: Users + description: > + The users API supports user CRUD operations, seat type operations, and + activation/deactivation operations. + + + > **Note:** Users are typically defined by the organization account, and + then role + + within the organization, for example admin. + + +

Users guides

+ + + To learn more about user-related resources and how to manage them, see the + [Users guide articles](/api/smartsheet/guides/users), including the + [Automate user seat type + management](/api/smartsheet/guides/users/automate-user-seat-type-management.md) + guide. + - name: webhooks + x-displayName: Webhooks + description: > + Smartsheet webhooks are powerful tools for building custom integrations + and automating processes. Instead of constantly polling for changes, with + webhooks you can configure your applications to receive real-time + notifications when specific Smartsheet events occur. + + +

Webhooks guides

+ + + To learn more about Smartsheet webhooks in general, start with these + [Webhooks guide](/api/smartsheet/guides/webhooks) articles: + + + - [Webhooks overview](/api/smartsheet/guides/webhooks.md) + + - [Create an event-handling + endpoint](/api/smartsheet/guides/webhooks/create-an-event-handling-endpoint.md) + + - [Launch a webhook](/api/smartsheet/guides/webhooks/launch-a-webhook.md) + + - [Webhook + callbacks](/api/smartsheet/guides/webhooks/webhook-callbacks.md) + + - [Webhook + verification](/api/smartsheet/guides/webhooks/webhook-verification.md) + + - [Webhook access](/api/smartsheet/guides/webhooks/webhook-access.md) + + +

Resource-specific guides

+ + + To dive into webhooks on a specific resource, check out these guides: + + + - [Sheet webhooks](/api/smartsheet/guides/webhooks.md) + + - [User / plan-level + webhooks](/api/smartsheet/guides/users/automate-user-seat-type-management.md) + + + Continue on to dive into webhook object schemas and operations. + - name: workspaces + x-displayName: Workspaces + description: > + Similar to a folder, a workspace is a place where you can store + dashboards, reports, sheets, and templates to keep them organized. A + workspace offers more functionality than a folder because you can set up + sharing permissions and branding (a logo and a color scheme) at the + workspace-level and a workspace can contain folders so that you can keep + things within it organized. As new items are added to the workspace, + they'll automatically inherit the sharing permissions and branding applied + to that workspace. + +

Workspace Folders

+ + + For details about working with folders in a workspace, see + [Folders](/api/smartsheet/openapi/folders). + + +

Workspace Sheets

+ + + For details about working with sheets in a workspace, see + [Sheets](/api/smartsheet/openapi/sheets). +paths: + /contacts: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + operationId: list-contacts + summary: List Contacts + description: Gets a list of the user's Smartsheet contacts. + tags: + - contacts + security: + - APIToken: [] + - OAuth2: + - READ_CONTACTS + parameters: + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/modifiedSince' + - $ref: '#/components/parameters/numericDates' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: IndexResult object containing an array of Contact objects + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: List of Contacts + type: array + items: + $ref: '#/components/schemas/Contact' + '401': + $ref: '#/components/responses/401' + '404': + $ref: '#/components/responses/404' + '500': + $ref: '#/components/responses/500' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PaginatedResult contacts = + smartsheet.ContactResources.ListContacts( + null // PaginationParameters + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/contacts \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PagedResult contacts = + smartsheet.contactResources().listContacts( + null // PaginationParameters + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.contacts.listContacts({}) + .then(function(contactsList) { + console.log(contactsList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + # Sample 1: List all + + response = + smartsheet_client.Contacts.list_contacts(include_all=True) + + contacts = response.data + + + # Sample 2: Paginate the list (100 contacts per page) + + response = smartsheet_client.Contacts.list_contacts( + page_size=100, + page=1) + pages = response.total_pages + + contacts = response.data + /contacts/{contactId}: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/contactId' + get: + summary: Get Contact + description: Gets the specified contact. + operationId: get-contact + tags: + - contacts + security: + - APIToken: [] + - OAuth2: + - READ_CONTACTS + parameters: + - $ref: '#/components/parameters/contactInclude' + responses: + '200': + description: Returns Contact object + content: + application/json: + schema: + $ref: '#/components/schemas/Contact' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Contact contact = smartsheet.ContactResources.GetContact( + "AAAAATYU54QAD7_fNhTnhA" // string contactId + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/contacts/{contactId} \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Contact contact = smartsheet.contactResources().getContact( + "AAAAATYU54QAD7_fNhTnhA" // string contactId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = {id: "AAAAATYU54QAD7_fNhTnhA"}; + + // Get contact + smartsheet.contacts.getContact(options) + .then(function(contact) { + console.log(contact); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + contact = smartsheet_client.Contacts.get_contact( + 'AAAAATYU54QAD7_fNhTnhA') # contact_id + /events: + parameters: + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + operationId: list-events + summary: List events + description: > + Fetches events for System Admin users. This includes actions such as + creating, updating, loading, deleting, and more of items such as sheets, + reports, dashboards, attachments, and users in your Smartsheet + organization account. + + + See [Event types](/api/smartsheet/event-types.md) for the complete event + listing, details, and example objects. + + + > **Who can use this operation?** + + > + + > - **Plans:** Requires the Event Reporting premium add-on available for + Enterprise and Advanced Work Management plans only. + + > - **Permissions:** System Admin + + + > **Note:** You must specify exactly one of the query parameters `since` + or `streamPosition`. Both are optional individually, but one is + required. + tags: + - events + security: + - APIToken: [] + - OAuth2: + - READ_EVENTS + parameters: + - $ref: '#/components/parameters/Accept-Encoding' + - $ref: '#/components/parameters/Authorization' + - name: since + in: query + description: > + The earliest time from which events are included in the response. + Events before this time are excluded. + + + This parameter is required if `streamPosition` is not used. + + + The date-time value is resolved to the nearest hour. The value is + interpreted as ISO-8601 format, unless `numericDates` is specified + (see details about `numericDates` below). + + + **Important:** To keep event responses manageable and prevent + timeouts, also specify the `to` query parameter. + + + **Important:** This parameter is intended for use when backfilling + data at client startup or recovery--don't use it for fine-grained, + date-based queries. + schema: + type: string + format: date-time + required: false + - name: to + in: query + description: > + The latest time up to which events are included in the response. + Events after this time are excluded. + + + This parameter requires using the `since` parameter. + + + The date-time value is resolved to the nearest hour. The value is + interpreted as ISO-8601 format, unless `numericDates` is specified + (see details about `numericDates` below). + + + Logic: + + + - If `to` is a future time, the current time is used. + + - If `to` equals the `since` time, an empty data value is returned. + + - If `to` is before the `since` time, a validation error is + returned. + + + **Important:** This parameter is intended for use when backfilling + data at client startup or recovery--don't use it for fine-grained, + date-based queries. + schema: + type: string + format: date-time + required: false + - name: streamPosition + in: query + description: | + Indicates next set of events to return. Use value of + `nextStreamPosition` returned from the previous call. + + This parameter is required if `since` is not used. + schema: + type: string + example: XyzAb1234cdefghijklmnofpq + required: false + - name: maxCount + in: query + description: |- + Maximum number of events to return as response to this call. + Must be between 1 through 10,000 (inclusive). + Defaults to 1,000 if not specified. + schema: + type: integer + format: int32 + minimum: 1 + maximum: 10000 + default: 1000 + required: false + - name: numericDates + in: query + description: | + If `true`, dates are accepted and returned in Unix epoch time + (milliseconds since midnight on January 1, 1970 in UTC time). + + Default is `false`, which means ISO-8601 format. + schema: + type: boolean + default: false + required: false + - name: managedPlanId + in: query + description: > + The target managed plan for which to list events. Authorized if the + + caller is a system administrator on either the target managed plan + or + + the main plan in EPM hierarchy. + schema: + type: number + required: false + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/StreamResult' + - type: object + properties: + data: + description: List of Events + type: array + items: + anyOf: + - $ref: '#/components/schemas/Accesstoken_Authorize' + - $ref: '#/components/schemas/Accesstoken_Refresh' + - $ref: '#/components/schemas/Accesstoken_Revoke' + - $ref: '#/components/schemas/Account_BulkUpdate' + - $ref: >- + #/components/schemas/Account_DownloadLoginHistory + - $ref: >- + #/components/schemas/Account_DownloadPublishedItemsReport + - $ref: >- + #/components/schemas/Account_DownloadSheetAccessReport + - $ref: '#/components/schemas/Account_DownloadUserList' + - $ref: '#/components/schemas/Account_ImportUsers' + - $ref: '#/components/schemas/Account_ListSheets' + - $ref: '#/components/schemas/Account_Rename' + - $ref: '#/components/schemas/Account_UpdateMainContact' + - $ref: '#/components/schemas/Attachment_Create' + - $ref: '#/components/schemas/Attachment_Delete' + - $ref: '#/components/schemas/Attachment_Load' + - $ref: '#/components/schemas/Attachment_Send' + - $ref: '#/components/schemas/Attachment_Update' + - $ref: '#/components/schemas/Dashboard_AddPublish' + - $ref: '#/components/schemas/Dashboard_AddShare' + - $ref: '#/components/schemas/Dashboard_AddShareMember' + - $ref: '#/components/schemas/Dashboard_AddWorkspaceShare' + - $ref: '#/components/schemas/Dashboard_Create' + - $ref: '#/components/schemas/Dashboard_Delete' + - $ref: '#/components/schemas/Dashboard_Load' + - $ref: '#/components/schemas/Dashboard_Move' + - $ref: '#/components/schemas/Dashboard_Purge' + - $ref: '#/components/schemas/Dashboard_RemovePublish' + - $ref: '#/components/schemas/Dashboard_RemoveShare' + - $ref: '#/components/schemas/Dashboard_RemoveShareMember' + - $ref: >- + #/components/schemas/Dashboard_RemoveWorkspaceShare + - $ref: '#/components/schemas/Dashboard_Rename' + - $ref: '#/components/schemas/Dashboard_Restore' + - $ref: '#/components/schemas/Dashboard_SaveAsNew' + - $ref: '#/components/schemas/Dashboard_TransferOwnership' + - $ref: '#/components/schemas/Dashboard_Update' + - $ref: '#/components/schemas/Discussion_Create' + - $ref: '#/components/schemas/Discussion_Delete' + - $ref: '#/components/schemas/Discussion_Send' + - $ref: '#/components/schemas/Discussion_Sendcomment' + - $ref: '#/components/schemas/Discussion_Update' + - $ref: '#/components/schemas/Folder_Create' + - $ref: '#/components/schemas/Folder_Delete' + - $ref: '#/components/schemas/Folder_Export' + - $ref: '#/components/schemas/Folder_Rename' + - $ref: '#/components/schemas/Folder_RequestBackup' + - $ref: '#/components/schemas/Folder_SaveAsNew' + - $ref: '#/components/schemas/Form_Activate' + - $ref: '#/components/schemas/Form_Create' + - $ref: '#/components/schemas/Form_Deactivate' + - $ref: '#/components/schemas/Form_Delete' + - $ref: '#/components/schemas/Form_Update' + - $ref: '#/components/schemas/Group_AddMember' + - $ref: '#/components/schemas/Group_Create' + - $ref: '#/components/schemas/Group_Delete' + - $ref: >- + #/components/schemas/Group_DownloadSheetAccessReport + - $ref: '#/components/schemas/Group_RemoveMember' + - $ref: '#/components/schemas/Group_Rename' + - $ref: '#/components/schemas/Group_TransferOwnership' + - $ref: '#/components/schemas/Group_Update' + - $ref: '#/components/schemas/Report_AddShare' + - $ref: '#/components/schemas/Report_AddShareMember' + - $ref: '#/components/schemas/Report_AddWorkspaceShare' + - $ref: '#/components/schemas/Report_Create' + - $ref: '#/components/schemas/Report_Delete' + - $ref: '#/components/schemas/Report_Export' + - $ref: '#/components/schemas/Report_Load' + - $ref: '#/components/schemas/Report_Move' + - $ref: '#/components/schemas/Report_Purge' + - $ref: '#/components/schemas/Report_RemoveShare' + - $ref: '#/components/schemas/Report_RemoveShareMember' + - $ref: '#/components/schemas/Report_RemoveWorkspaceShare' + - $ref: '#/components/schemas/Report_Rename' + - $ref: '#/components/schemas/Report_Restore' + - $ref: '#/components/schemas/Report_SaveAsNew' + - $ref: '#/components/schemas/Report_SendAsAttachment' + - $ref: '#/components/schemas/Report_TransferOwnership' + - $ref: '#/components/schemas/Report_Update' + - $ref: '#/components/schemas/Sheet_AddShare' + - $ref: '#/components/schemas/Sheet_AddShareMember' + - $ref: '#/components/schemas/Sheet_AddWorkspaceShare' + - $ref: '#/components/schemas/Sheet_CopyRow' + - $ref: '#/components/schemas/Sheet_Create' + - $ref: '#/components/schemas/Sheet_CreateCellLink' + - $ref: '#/components/schemas/Sheet_Delete' + - $ref: '#/components/schemas/Sheet_Export' + - $ref: '#/components/schemas/Sheet_Load' + - $ref: '#/components/schemas/Sheet_Move' + - $ref: '#/components/schemas/Sheet_MoveRow' + - $ref: '#/components/schemas/Sheet_Purge' + - $ref: '#/components/schemas/Sheet_RemoveShare' + - $ref: '#/components/schemas/Sheet_RemoveShareMember' + - $ref: '#/components/schemas/Sheet_RemoveWorkspaceShare' + - $ref: '#/components/schemas/Sheet_Rename' + - $ref: '#/components/schemas/Sheet_RequestBackup' + - $ref: '#/components/schemas/Sheet_Restore' + - $ref: '#/components/schemas/Sheet_SaveAsNew' + - $ref: '#/components/schemas/Sheet_SaveAsTemplate' + - $ref: '#/components/schemas/Sheet_SendAsAttachment' + - $ref: '#/components/schemas/Sheet_SendRow' + - $ref: '#/components/schemas/Sheet_TransferOwnership' + - $ref: '#/components/schemas/Sheet_Update' + - $ref: '#/components/schemas/UpdateRequest_Create' + - $ref: '#/components/schemas/User_AcceptInvite' + - $ref: '#/components/schemas/User_AddToAccount' + - $ref: '#/components/schemas/User_DeclineInvite' + - $ref: >- + #/components/schemas/User_DownloadSheetAccessReport + - $ref: '#/components/schemas/User_RemoveFromAccount' + - $ref: '#/components/schemas/User_RemoveFromGroups' + - $ref: '#/components/schemas/User_RemoveShares' + - $ref: '#/components/schemas/User_SendInvite' + - $ref: '#/components/schemas/User_SendPasswordReset' + - $ref: '#/components/schemas/User_TransferOwnedGroups' + - $ref: '#/components/schemas/User_TransferOwnedItems' + - $ref: '#/components/schemas/User_UpdateUser' + - $ref: '#/components/schemas/Workspace_AddShare' + - $ref: '#/components/schemas/Workspace_AddShareMember' + - $ref: '#/components/schemas/Workspace_Create' + - $ref: >- + #/components/schemas/Workspace_CreateRecurringBackup + - $ref: '#/components/schemas/Workspace_Delete' + - $ref: >- + #/components/schemas/Workspace_DeleteRecurringBackup + - $ref: '#/components/schemas/Workspace_Export' + - $ref: '#/components/schemas/Workspace_RemoveShare' + - $ref: '#/components/schemas/Workspace_RemoveShareMember' + - $ref: '#/components/schemas/Workspace_Rename' + - $ref: '#/components/schemas/Workspace_RequestBackup' + - $ref: '#/components/schemas/Workspace_SaveAsNew' + - $ref: '#/components/schemas/Workspace_TransferOwnership' + - $ref: >- + #/components/schemas/Workspace_UpdateRecurringBackup + '400': + description: > + A response with this status code can occur in any one of the + following conditions: + + + - The `to` parameter is earlier than the `since` parameter. + + - Invalid request format. + + - Missing required fields. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '401': + $ref: '#/components/responses/401' + '403': + $ref: '#/components/responses/403' + '404': + $ref: '#/components/responses/404' + '405': + $ref: '#/components/responses/405' + '406': + $ref: '#/components/responses/406' + '410': + $ref: '#/components/responses/410' + '415': + $ref: '#/components/responses/415' + '429': + $ref: '#/components/responses/429' + '500': + $ref: '#/components/responses/500' + x-codeSamples: + - lang: curl + label: cURL + source: > + curl -i -X GET \ + + 'https://api.smartsheet.com/2.0/events?since=2025-03-24T15%3A15%3A22Z&to=2025-03-24T16%3A15%3A22Z' + \ + + --header 'Accept-Encoding: deflate' \ + + --header 'Authorization: Bearer ' + - lang: JavaScript SDK + label: JavaScript + source: | + const query = new URLSearchParams({ + since: '2025-03-24T15:15:22Z', + to: '2025-03-24T16:15:22Z' + }).toString(); + + const resp = await fetch( + `https://api.smartsheet.com/2.0/events?${query}`, + { + method: 'GET', + headers: { + 'Accept-Encoding': 'deflate', + Authorization: 'Bearer ' + } + } + ); + + const data = await resp.text(); + console.log(data); + - lang: Node.js + label: Node.js + source: | + import fetch from 'node-fetch'; + + async function run() { + const query = new URLSearchParams({ + since: '2025-03-24T15:15:22Z', + to: '2025-03-24T16:15:22Z' + }).toString(); + + const resp = await fetch( + `https://api.smartsheet.com/2.0/events?${query}`, + { + method: 'GET', + headers: { + 'Accept-Encoding': 'deflate', + Authorization: 'Bearer ' + } + } + ); + + const data = await resp.text(); + console.log(data); + } + + run(); + - lang: Python + label: Python + source: | + import requests + + url = "https://api.smartsheet.com/2.0/events" + + query = { + "since": "2025-03-24T15%3A15%3A22Z", + "to": "2025-03-24T16%3A15%3A22Z" + } + + headers = { + "Accept-Encoding": "deflate", + "Authorization": "Bearer " + } + + response = requests.get(url, headers=headers, params=query) + + data = response.json() + print(data) + - lang: Go + label: Go + source: | + package main + + import ( + "fmt" + "net/http" + "io/ioutil" + ) + + func main() { + reqUrl := "https://api.smartsheet.com/2.0/events" + req, err := http.NewRequest("GET", reqUrl, nil) + + query := req.URL.Query() + query.Add("since", "2025-03-24T15:15:22Z") + query.Add("to", "2025-03-24T16:15:22Z") + req.URL.RawQuery = query.Encode() + + if err != nil { + panic(err) + } + req.Header.Add("Accept-Encoding", "deflate") + req.Header.Add("Authorization", "Bearer ") + res, err := http.DefaultClient.Do(req) + if err != nil { + panic(err) + } + defer res.Body.Close() + body, err := ioutil.ReadAll(res.Body) + if err != nil { + panic(err) + } + + fmt.Println(res) + fmt.Println(string(body)) + } + - lang: Java + label: Java + source: | + import java.net.*; + import java.net.http.*; + import java.util.*; + import java.nio.charset.StandardCharsets; + import java.util.stream.Collectors; + + public class App { + public static void main(String[] args) throws Exception { + var httpClient = HttpClient.newBuilder().build(); + + HashMap params = new HashMap<>(); + params.put("since", "2025-03-24T15:15:22Z"); + params.put("to", "2025-03-24T16:15:22Z"); + + var query = params.keySet().stream() + .map(key -> key + "=" + URLEncoder.encode(params.get(key), StandardCharsets.UTF_8)) + .collect(Collectors.joining("&")); + + var host = "https://api.smartsheet.com"; + var pathname = "/2.0/events"; + var request = HttpRequest.newBuilder() + .GET() + .uri(URI.create(host + pathname + '?' + query)) + .header("Accept-Encoding", "deflate") + .header("Authorization", "Bearer ") + .build(); + + var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); + + System.out.println(response.body()); + } + } + - lang: C# + label: C# + source: | + using System; + using System.Net.Http; + using System.Threading.Tasks; + + public class Program + { + public static async Task Main() + { + System.Net.Http.HttpClient client = new() + { + DefaultRequestHeaders = + { + {"Authorization", "Bearer "}, + } + }; + + using HttpResponseMessage request = await client.GetAsync("https://api.smartsheet.com/2.0/events?since=2025-03-24T15%3A15%3A22Z&to=2025-03-24T16%3A15%3A22Z"); + string response = await request.Content.ReadAsStringAsync(); + + Console.WriteLine(response); + } + } + - lang: PHP + label: PHP + source: | + /** + * Requires libcurl + */ + + $query = array( + "since" => "2025-03-24T15%3A15%3A22Z", + "to" => "2025-03-24T16%3A15%3A22Z", + "streamPosition" => "XyzAb1234cdefghijklmnofpq" + ); + + $curl = curl_init(); + + curl_setopt_array($curl, [ + CURLOPT_HTTPHEADER => [ + "Accept-Encoding: deflate", + "Authorization: Bearer " + ], + CURLOPT_URL => "https://api.smartsheet.com/2.0/events?" . http_build_query($query), + CURLOPT_RETURNTRANSFER => true, + CURLOPT_CUSTOMREQUEST => "GET", + ]); + + $response = curl_exec($curl); + $error = curl_error($curl); + + curl_close($curl); + + if ($error) { + echo "cURL Error #:" . $error; + } else { + echo $response; + } + /favorites: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/ActorId' + get: + summary: Get Favorites + description: Gets a list of all of the user's favorite items. + operationId: get-favorites + tags: + - favorites + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/favoriteInclude' + responses: + '200': + description: IndexResult object containing an array of Favorite objects. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Favorite' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PaginatedResult results = + smartsheet.FavoriteResources.ListFavorites( + null // PaginationParameters + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/favorites \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PagedResult results = + smartsheet.favoriteResources().listFavorites( + null // PaginationParameters + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.favorites.listFavorites() + .then(function(favoritesList) { + console.log(favoritesList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + # Sample 1: List All + + response = + smartsheet_client.Favorites.list_favorites(include_all=True) + + faves = response.data + + + # Sample 2: Paginate the list of favorites + + response = smartsheet_client.Favorites.list_favorites( + page_size=10, + page=1) + pages = response.total_pages + + faves = response.data + post: + summary: Add Favorites + description: > + Adds one or more favorite items for the current user. This operation + supports both single-object and bulk semantics. For more information, + see Optional Bulk Operations. + + If called with a single Favorite object, and that favorite already + exists, error code 1129 is returned. If called with an array of Favorite + objects, any objects specified in the array that are already marked as + favorites are ignored and omitted from the response. + operationId: add-favorite + tags: + - favorites + security: + - APIToken: [] + - OAuth2: + - ADMIN_WORKSPACES + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + description: A list of favorites to be added. + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/Favorite' + - type: array + items: + $ref: '#/components/schemas/Favorite' + responses: + '200': + description: >- + Result object containing either a single Favorite object or an array + of Favorite objects. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + oneOf: + - $ref: '#/components/schemas/Favorite' + - type: array + items: + $ref: '#/components/schemas/Favorite' + default: + description: Generic Error Payload. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify favorites + + IList favoritesSpecification = new Favorite[] + + { + new Favorite + { + Type = ObjectType.SHEET, + ObjectId = 8400677765441412 + } + }; + + + // Add items to favorites + + IList newFavorite = + smartsheet.FavoriteResources.AddFavorites(favoritesSpecification); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/favorites \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" \ + -X POST \ + -d '[{"type": "sheet", "objectId": 8400677765441412}]' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify favorites + + Favorite favoritesSpecification = new Favorite() + .setObjectId(8400677765441412L) + .setType(FavoriteType.SHEET); + + // Add items to favorites + + List newFavorite = + smartsheet.favoriteResources().addFavorites(Arrays.asList(favoritesSpecification)); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify favorites + var favorites = [ + { + "type": "sheet", + "objectId": 8400677765441412 + } + ]; + + // Set options + var options = { + body: favorites + }; + + // Add items to favorites + smartsheet.favorites.addItemsToFavorites(options) + .then(function(newFavorite) { + console.log(newFavorite); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + response = smartsheet_client.Favorites.add_favorites([ + smartsheet.models.Favorite({ + 'type': 'sheet', + 'object_id': 8400677765441412 + }) + ]) + /favorites/{favoriteType}: + parameters: + - $ref: '#/components/parameters/favoriteType' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/ActorId' + delete: + summary: Delete Multiple Favorites + description: Deletes all favorites with the same type for the user. + operationId: delete-favorites-by-type + tags: + - favorites + security: + - APIToken: [] + - OAuth2: + - ADMIN_WORKSPACES + parameters: + - $ref: '#/components/parameters/favoriteIds' + responses: + '200': + description: Returns Result object. + content: + application/json: + schema: + $ref: '#/components/schemas/GenericResult' + default: + description: Generic Error Payload. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.FavoriteResources.RemoveFavorites( + ObjectType.FOLDER, + new long[] { 2252168947361668, 2252168947361669 } // folderIds + ); + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/favorites/{favoriteType}?objectIds=favoriteId1,favoriteId2' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.favoriteResources().removeFavorites( + FavoriteType.FOLDER, + new HashSet(Arrays.asList(2252168947361668L, 2252168947361669L)) // long folderIds + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + queryParameters: { + objectIds: "2252168947361668,2252168947361669" + } + }; + + // Remove favoriteType from list of favorites + smartsheet.favorites.remove{favoriteType}FromFavorites(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Favorites.remove_favorites( + 'folder', + [2252168947361668, 2252168947361669] # folder_ids + ) + /favorites/{favoriteType}/{favoriteId}: + parameters: + - $ref: '#/components/parameters/favoriteType' + - $ref: '#/components/parameters/favoriteId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/ActorId' + delete: + summary: Delete Favorite + description: >- + Deletes a single favorite from the user's list of favorite items by type + and ID. + operationId: delete-favorites-by-type-and-id + tags: + - favorites + security: + - APIToken: [] + - OAuth2: + - ADMIN_WORKSPACES + responses: + '200': + description: Returns Result object. + content: + application/json: + schema: + $ref: '#/components/schemas/GenericResult' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.FavoriteResources.RemoveFavorites( + ObjectType.FOLDER, + new long[] { 2252168947361668 } // folderId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/favorites/{favoriteType}/{folderId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.favoriteResources().removeFavorites( + FavoriteType.FOLDER, + new HashSet(Arrays.asList(2252168947361668L)) // long folderId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + objectId: 2252168947361668 + }; + + // Remove folder from list of favorites + smartsheet.favorites.removeFolderFromFavorites(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Favorites.remove_favorites( + 'folder', + 2252168947361668 # folder_id + ) + get: + summary: Is Favorite + description: >- + Checks whether an item has been tagged as a favorite for the current + user by type and ID. + operationId: is-favorite + tags: + - favorites + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/favoriteInclude' + responses: + '200': + description: Returns Result object. + content: + application/json: + schema: + $ref: '#/components/schemas/Favorite' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: cURL + label: cURL + source: | + curl -i -X GET \ + 'https://api.smartsheet.com/2.0/favorites/{favoriteType}/{favoriteId}?include={directId}' \ + -H 'Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789' \ + -H 'x-smar-sc-actor-id: 100012' + /filteredEvents: + parameters: + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + post: + operationId: list-filtered-events + summary: List filtered events + description: > + Fetches events related to given sheets and workspaces for non-admin + users. + + + See [Event types](/api/smartsheet/event-types.md) for the complete event + listing, details, and example objects. + + + > **Who can use this operation?** + + > + + > - **Plans:** Requires the Event Reporting premium add-on available for + Enterprise and Advanced Work Management plans only. + + > - **Permissions:** Non-admin users who have access to given sheets or + workspaces. + tags: + - events + security: + - APIToken: [] + - OAuth2: + - READ_EVENTS + parameters: + - $ref: '#/components/parameters/Accept-Encoding' + - $ref: '#/components/parameters/Authorization' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FilteredEventsRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/StreamResult' + - type: object + properties: + data: + description: List of Events + type: array + items: + $ref: '#/components/schemas/Event' + unavailableSheetIds: + description: >- + List of sheet Ids specified in the request that the + user does not have access to. + type: array + items: + type: string + unavailableWorkspaceIds: + description: >- + List of workspace Ids specified in the request that + the user does not have access to. + type: array + items: + type: string + '400': + $ref: '#/components/responses/400' + '401': + $ref: '#/components/responses/401' + '403': + $ref: '#/components/responses/403' + '404': + $ref: '#/components/responses/404' + '405': + $ref: '#/components/responses/405' + '406': + $ref: '#/components/responses/406' + '410': + $ref: '#/components/responses/410' + '415': + $ref: '#/components/responses/415' + '429': + $ref: '#/components/responses/429' + '500': + $ref: '#/components/responses/500' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /folders/{folderId}: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/folderId' + get: + summary: Get folder + deprecated: true + description: > + Gets a Folder object. + + + > **Important:** We've set a 60 requests per minute per API token limit + for this operation. + + + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + removed.** See the [Get folder + metadata](/api/smartsheet/openapi/folders/get-folder-metadata) and the + [List folder + children](/api/smartsheet/openapi/folders/get-folder-children) endpoints + for replacement functionality. + tags: + - folders + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + operationId: get-folder + parameters: + - $ref: '#/components/parameters/folderWorkspaceInclude' + responses: + '200': + description: A single Folder object. + content: + application/json: + schema: + $ref: '#/components/schemas/Folder' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Sample 1: Omit 'include' parameter + Folder folder = smartsheet.FolderResources.GetFolder( + 7116448184199044, // long folderId + null // IEnumerable include + ); + + // Sample 2: Specify 'include' parameter with value of "SOURCE" + Folder folder = smartsheet.FolderResources.GetFolder( + 7116448184199044, // long folderId + new FolderInclusion[] { + FolderInclusion.SOURCE } + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/folders/{folderId} \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Sample 1: Omit 'include' parameter + Folder folder = smartsheet.folderResources().getFolder( + 7116448184199044L, // long folderId + null) // EnumSet includes + ); + + // Sample 2: Specify 'include' parameter with value of "SOURCE" + Folder folder = smartsheet.folderResources().getFolder( + 7116448184199044L, // long folderId + EnumSet.of(SourceInclusion.SOURCE)) + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + id: 7116448184199044 // Id of Folder + }; + + // Get folder + smartsheet.folders.getFolder(options) + .then(function(folder) { + console.log(folder); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: Get folder + folder = smartsheet_client.Folders.get_folder( + 7116448184199044) # folder_id + + # Sample 2: Include source + response = smartsheet_client.Folders.get_folder( + 7116448184199044, # folder_id + include=source) + delete: + summary: Delete folder + description: Deletes a folder. + tags: + - folders + security: + - APIToken: [] + - OAuth2: + - ADMIN_WORKSPACES + operationId: delete-folder + responses: + '200': + description: | + Returns Result object + content: + application/json: + schema: + $ref: '#/components/schemas/GenericResult' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.FolderResources.DeleteFolder( + 965780272637828 // long folderId + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/folders/{folderId} \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -X DELETE + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.folderResources().deleteFolder( + 965780272637828L // long folderId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + id: 965780272637828 // Id of Folder + }; + + // Delete folder + smartsheet.folders.deleteFolder(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Folders.delete_folder( + 7960873114331012) # folder_id + put: + summary: Update folder + description: Updates a folder. + operationId: update-folder + tags: + - folders + security: + - APIToken: [] + - OAuth2: + - ADMIN_WORKSPACES + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Folder' + responses: + '200': + description: Result object containing the modified Folder object. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + properties: + result: + $ref: '#/components/schemas/Folder' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Set folder name + + Folder folderSpecification = new Folder + + { + Id = 7960873114331012, + Name = "New name for folder" + }; + + + // Update folder + + Folder updatedFolder = + smartsheet.FolderResources.UpdateFolder(folderSpecification); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/folders/{folderId} \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" \ + -X PUT \ + -d '{"name": "New name for folder"}' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Set folder name and id of the folder to be updated + + Folder folderSpecification = new Folder(7960873114331012L); + + folderSpecification.setName("New name for folder"); + + + // Update folder + + Folder updatedFolder = + smartsheet.folderResources().updateFolder(folderSpecification); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set folder name + var folder = { + "name": "New name for folder" + }; + + // Set options + var options = { + id: 7960873114331012, // Id of Folder + body: folder + }; + + // Update folder + smartsheet.folders.updateFolder(options) + .then(function(updatedFolder) { + console.log(updatedFolder); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + updated_folder = smartsheet_client.Folders.update_folder( + 7960873114331012, # folder_id + 'New name for folder') + /folders/{folderId}/metadata: + parameters: + - $ref: '#/components/parameters/Authorization' + - name: folderId + in: path + required: true + description: The ID of the folder + schema: + type: integer + format: int64 + get: + summary: Get folder metadata + description: Gets the metadata of a folder. + tags: + - folders + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + operationId: get-folder-metadata + parameters: + - $ref: '#/components/parameters/includeSource' + - $ref: '#/components/parameters/numericDates' + responses: + '200': + description: The metadata of a folder. + content: + application/json: + schema: + $ref: '#/components/schemas/FolderMetadata' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + '500': + $ref: '#/components/responses/500' + '503': + $ref: '#/components/responses/503' + /folders/{folderId}/children: + parameters: + - $ref: '#/components/parameters/Authorization' + - name: folderId + in: path + required: true + description: The ID of the folder + schema: + type: integer + format: int64 + get: + summary: List folder children + description: Gets a page of the folder's children of the specified type(s). + tags: + - folders + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + operationId: get-folder-children + parameters: + - $ref: '#/components/parameters/childrenResourceTypes' + - $ref: '#/components/parameters/includeForChildren' + - $ref: '#/components/parameters/numericDates' + - $ref: '#/components/parameters/accessApiLevel' + - $ref: '#/components/parameters/lastKey' + - name: maxItems + in: query + required: false + description: The maximum number of items to return in the response. + schema: + type: integer + default: 100 + minimum: 100 + multipleOf: 100 + maximum: 1000 + responses: + '200': + description: >- + An array of asset references with a pagination token if there are + more results. + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedChildrenResponse' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + '500': + $ref: '#/components/responses/500' + '503': + $ref: '#/components/responses/503' + /folders/{folderId}/copy: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/folderId' + post: + summary: Copy folder + description: Copies a folder. + tags: + - folders + security: + - APIToken: [] + - OAuth2: + - ADMIN_WORKSPACES + operationId: copy-folder + parameters: + - $ref: '#/components/parameters/Content-Type' + - $ref: '#/components/parameters/sheetCopyInclude' + - $ref: '#/components/parameters/sheetCopyExclude' + - $ref: '#/components/parameters/skipRemap' + requestBody: + description: New folder name. + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/ContainerDestinationForCopy' + responses: + '200': + description: >- + Result object containing a Folder object for the new folder + destination. + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerDestinationForCopy' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify destination + + ContainerDestination destination = new ContainerDestination { + DestinationId = 7960873114331012, + DestinationType = DestinationType.FOLDER, + NewName = "newFolderName" + }; + + + // Sample 1: Omit 'include' and 'skipRemap' parameters + + Folder folder = smartsheet.FolderResources.CopyFolder( + 2252168947361668, // long folderId + destination, + null, // IEnumerable include + null // IEnumerable skipRemap + ); + + + // Sample 2: Specify 'include' parameter with value of "DATA", and + 'skipRemap' parameter with value of "CELL_LINKS" + + Folder folder = smartsheet.FolderResources.CopyFolder( + 2252168947361668, // long folderId + destination, + new FolderCopyInclusion[] { + FolderCopyInclusion.DATA }, + new FolderRemapExclusion[] { + FolderRemapExclusion.CELL_LINKS } + ); + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/folders/{folderId}/copy?include=data' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -d '{ + "destinationType": "folder", + "destinationId": 7960873114331012, + "newName": "newFolderName" + }' \ + + -X POST + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify destination + + ContainerDestination destination = new ContainerDestination() + .setDestinationType(DestinationType.FOLDER) + .setDestinationId(7960873114331012L) + .setNewName("newFolderName"); + + // Sample 1: Omit 'include' and 'skipRemap' parameters + + Folder folder = smartsheet.folderResources().copyFolder( + 2252168947361668L, // long folderId + destination, + null, // EnumSet includes + null // EnumSet skipRemap + ); + + // Sample 2: Specify 'include' parameter with value of "DATA", and + 'skipRemap' parameter with value of "CELLLINKS" + + Folder folder = smartsheet.folderResources().copyFolder( + 2252168947361668L, // long folderId + destination, + EnumSet.of(FolderCopyInclusion.DATA), + EnumSet.of(FolderRemapExclusion.CELLLINKS) + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify destination information + var body = { + destinationType: "folder", + destinationId: 7960873114331012, + newName: "Folder Copy" + }; + + // Specify elements to copy + var params = { + include: "data,discussions", + skipRemap: "cellLinks" + }; + + // Set options + var options = { + folderId: 2252168947361668, + body: body, + queryParameters: params + }; + + // Copy folder + smartsheet.folders.copyFolder(options) + .then(function(folder) { + console.log(folder); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: Copy folder + response = smartsheet_client.Folders.copy_folder( + 2252168947361668, # folder_id + smartsheet.models.ContainerDestination({ + 'destination_id': 7960873114331012, + 'destination_type': 'folder', + 'new_name': 'newFolderName' + }) + ) + + # Sample 2: Include filters + response = smartsheet_client.Folders.copy_folder( + 2252168947361668, # folder_id + include=filters, + smartsheet.models.ContainerDestination({ + 'destination_id': 7960873114331012, + 'destination_type': 'folder', + 'new_name': 'newFolderName' + }) + ) + /folders/{folderId}/folders: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/folderId' + get: + summary: List folders + deprecated: true + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + removed.** See the [List folder + children](/api/smartsheet/openapi/folders/get-folder-children) endpoint + for replacement functionality. + + + Gets a list of folders in a given folder. The list contains an + abbreviated + + Folder object for each folder. + tags: + - folders + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + operationId: list-folders + parameters: + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: IndexResult object containing an array of Folder objects. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + result: + type: array + items: + $ref: '#/components/schemas/Folder' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PaginatedResult folders = + smartsheet.FolderResources.ListFolders( + 5107651446105988, // long folderId + null // PaginationParameters + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/folders/{folderId}/folders \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PagedResult folders = + smartsheet.folderResources().listFolders( + 510765144610598L, // long parentFolderId + null // PaginationParameters + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + folderId: 5107651446105988 + }; + + // List folders in another folder + smartsheet.folders.listChildFolders(options) + .then(function(folderList) { + console.log(folderList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List all + response = smartsheet_client.Folders.list_folders( + 5107651446105988, # folder_id + include_all=True) + folders = response.data + + # Sample 2: Paginate the list + response = smartsheet_client.Folders.list_folders( + 5107651446105988, # folder_id + page_size=5, + page=1) + pages = response.total_pages + folders = response.data + post: + summary: Create folder + description: | + Creates a new folder. + operationId: create-folder-folder + tags: + - folders + security: + - APIToken: [] + - OAuth2: + - ADMIN_WORKSPACES + parameters: + - $ref: '#/components/parameters/Content-Type' + - $ref: '#/components/parameters/sheetCopyInclude' + - $ref: '#/components/parameters/sheetCopyExclude' + - $ref: '#/components/parameters/skipRemap' + requestBody: + description: Folder to create. + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/Folder' + responses: + '200': + description: Result object containing a Folder object for newly created folder. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + oneOf: + - $ref: '#/components/schemas/Folder' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set folder name + Folder folderSpecification = new Folder { Name = "New folder" }; + + // Create folder in another folder + Folder newFolder = smartsheet.FolderResources.CreateFolder( + 7960873114331012, // long destinationFolderId + folderSpecification + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/folders/{folderid}/folders \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" \ + -X POST \ + -d '{"name": "New folder"}' + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set folder name + Folder folderSpecification = new Folder(); + folderSpecification.setName("New Folder"); + + // Create folder in another folder + Folder newFolder = smartsheet.folderResources().createFolder( + 7960873114331012L, // long destinationFolderId + folderSpecification + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set folder name + var folder = { + "name": "New folder" + }; + + // Set options + var options = { + folderId: 7960873114331012, + body: folder + }; + + // Create folder in another folder + smartsheet.folders.createChildFolder(options) + .then(function(newFolder) { + console.log(newFolder); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: Create folder + response = smartsheet_client.Folders.create_folder_in_folder( + 7960873114331012, # folder_id + 'New folder') + + # Sample 2: Include filters + response = smartsheet_client.Folders.create_folder_in_folder( + 7960873114331012, # folder_id + include=filters, + 'New folder') + /folders/{folderId}/move: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/folderId' + post: + summary: Move folder + description: Moves a folder. + tags: + - folders + security: + - APIToken: [] + - OAuth2: + - ADMIN_WORKSPACES + operationId: move-folder + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + description: New folder destination. + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/ContainerDestinationForMove' + responses: + '200': + description: >- + Result object containing a Folder object for the new folder + destination. + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerDestinationForMove' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify destination + ContainerDestination destination = new ContainerDestination { + DestinationId = 7960873114331012, // long destinationFolderId + DestinationType = DestinationType.FOLDER, + }; + + // Move folder + Folder folder = smartsheet.FolderResources.MoveFolder( + 4509918431602564, // long folderId + destination + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/folders/{folderId}/move \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" \ + -d '{ + "destinationType": "folder", + "destinationId": 7960873114331012 + }' \ + -X POST + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify destination + ContainerDestination destination = new ContainerDestination() + .setDestinationType(DestinationType.FOLDER) + .setDestinationId(7960873114331012L); + + // Move folder + Folder folder = smartsheet.folderResources().moveFolder( + 4509918431602564L, // long folderId + destination + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set destination information + var body = { + destinationType: "folder", + destinationId: 7960873114331012 + }; + + // Set options + var options = { + folderId: 4509918431602564, + body: body + }; + + // Move folder + smartsheet.folders.moveFolder(options) + .then(function(folder) { + console.log(folder); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + folder = smartsheet_client.Folders.move_folder( + 4509918431602564, # folder_id to be moved + smartsheet.models.ContainerDestination({ + 'destination_id': 7960873114331012, # destination folder_id + 'destination_type': 'folder' + }) + ) + /folders/{folderId}/sheets: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/folderId' + post: + summary: Create Sheet in Folder + description: > + Creates a sheet from scratch or from the specified template in the + specified folder. + operationId: create-sheet-in-folder + tags: + - sheets + security: + - APIToken: [] + - OAuth2: + - CREATE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + - $ref: '#/components/parameters/include' + requestBody: + description: Sheet to create. + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/SheetToCreate' + - $ref: '#/components/schemas/SheetToCreateFromTemplate' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Sample 1: Create sheet in folder + + // Specify properties of the first column + + Column columnA = new Column + + { + Title = "Favorite", + Primary = false, + Type = ColumnType.CHECKBOX, + Symbol = Symbol.STAR + }; + + + // Specify properties of the second column + + Column columnB = new Column + + { + Title = "Primary Column", + Primary = true, + Type = ColumnType.TEXT_NUMBER + }; + + + // Create sheet in folder (specifying the 2 columns to include in + the sheet) + + Sheet newSheet = + smartsheet.FolderResources.SheetResources.CreateSheet( + 3734419270854532, // long folderId + new Sheet + { + Name = "new sheet title", + Columns = new Column[] { columnA, columnB } + } + ); + + + // Sample 2: Create sheet in folder from template + + // Specify name for the sheet and Id of the template + + Sheet sheetSpecification = new Sheet + + { + Name = "new sheet title", + FromId = 7679398137620356 // template Id + }; + + + // Option 1: Omit 'include' parameter + + Sheet newSheet = + smartsheet.FolderResources.SheetResources.CreateSheetFromTemplate( + 3734419270854532, // long folderId + sheetSpecification, + null // IEnumerable include + ); + + + // Option 2: Include ATTACHMENTS, DATA, and DISCUSSIONS + + Sheet newSheet = + smartsheet.FolderResources.SheetResources.CreateSheetFromTemplate( + 3734419270854532, // long folderId + sheetSpecification, + new TemplateInclusion[] { + TemplateInclusion.ATTACHMENTS, + TemplateInclusion.DATA, + TemplateInclusion.DISCUSSIONS } + ); + - lang: cURL + label: cURL + source: > + // Sample 1: Create sheet in folder + + curl https://api.smartsheet.com/2.0/folders/{folderId}/sheets \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d + '{"name":"newsheet","columns":[{"title":"Favorite","type":"CHECKBOX","symbol":"STAR"}, + {"title":"Primary Column", "primary":true,"type":"TEXT_NUMBER"}]}' + + + // Sample 2: Create sheet in folder from template + + curl + 'https://api.smartsheet.com/2.0/folders/{folderId}/sheets?include=data,attachments,discussions' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '{"name":"newsheet", "fromId": 7679398137620356}' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Sample 1: Create sheet in folder + + // Specify properties of the first column + + Column columnA = new Column() + .setTitle("Favorite") + .setType(ColumnType.CHECKBOX) + .setSymbol(Symbol.STAR); + + // Specify properties of the second column + + Column columnB = new Column() + .setTitle("Primary Column") + .setType(ColumnType.TEXT_NUMBER) + .setPrimary(true); + + // Create sheet in folder (specifying the 2 columns to include in + the sheet) + + Sheet newSheet = new Sheet(); + newSheet.setName("new sheet title"); + newSheet.setColumns(Arrays.asList(columnA, columnB)); + + smartsheet.sheetResources().createSheetInFolder( + 3734419270854532L, // long folderId + newSheet + ); + + // Sample 2: Create sheet in folder from template + + // Specify name for the sheet and Id of the template + + Sheet sheet = new Sheet(); + + sheet.setFromId(7679398137620356L); // long templateId + + sheet.setName("newsheet"); + + + // Omit 'include' parameter + + Sheet results = + smartsheet.sheetResources().createSheetInFolderFromTemplate( + 3734419270854532L, // long folderId + sheet, + null // EnumSet includes + ); + + // Include ATTACHMENTS, DATA, and DISCUSSIONS + + Sheet results = + smartsheet.sheetResources().createSheetInFolderFromTemplate( + 3734419270854532L, // long folderId + sheet, + EnumSet.of( + SheetTemplateInclusion.ATTACHMENTS, + SheetTemplateInclusion.DATA, + SheetTemplateInclusion.DISCUSSIONS) + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Sample 1: Create sheet in folder + // Specify sheet properties + var sheet = { + "name": "newsheet", + "columns": [ + { + "title": "Favorite", + "type": "CHECKBOX", + "symbol": "STAR" + }, + { + "title": "Primary Column", + "primary": true, + "type": "TEXT_NUMBER" + } + ] + }; + + // Set options + var options = { + folderId: 3734419270854532, + body: sheet + }; + + // Create sheet in folder + smartsheet.sheets.createSheetInFolder(options) + .then(function(newSheet) { + console.log(newSheet); + }) + .catch(function(error) { + console.log(error); + }); + + // Sample 2: Create sheet in folder from template + // Specify the directive + var sheet = { + "name": "newsheet", + "fromId": 7679398137620356 + }; + + // Set options + var options = { + body: sheet, + folderId: 3734419270854532 + }; + + // Create sheet from template in the specified folder + smartsheet.sheets.createSheetFromExisting(options) + .then(function(data) { + console.log(data); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + # Sample 1: Create sheet in folder + + sheet_spec = smartsheet.models.Sheet({ + 'name': 'newsheet', + 'columns': [{ + 'title': 'Favorite', + 'type': 'CHECKBOX', + 'symbol': 'STAR' + }, { + 'title': 'Primary Column', + 'primary': True, + 'type': 'TEXT_NUMBER' + } + ] + }) + + response = smartsheet_client.Folders.create_sheet_in_folder( + 3734419270854532, # folder_id + sheet_spec) + new_sheet = response.result + + + # Sample 2: Create sheet in folder from template + + response = + smartsheet_client.Folders.create_sheet_in_folder_from_template( + 3734419270854532, # folder_id + smartsheet.models.Sheet({ + 'name': 'newsheet', + 'from_id': 7679398137620356 # template_id + }) + ) + responses: + '200': + description: >- + Result object containing a Sheet object for newly created sheet, + corresponding to what was specified in the request. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + oneOf: + - $ref: '#/components/schemas/SheetCreated' + - $ref: '#/components/schemas/SheetCreatedFromTemplate' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /folders/{folderId}/sheets/import: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/folderId' + post: + summary: Import Sheet into Folder + description: > + Imports CSV or XLSX data into a new sheet in the specified folder. + + + Note the following: + + * Both sheetName and the file name must use ASCII characters. + + * The source data must be basic text. To include rich formula data, + import and create a sheet first, and then use Update Rows. To work with + images, see Cell Images. + + * XLS is not supported. You must use XLSX. + + * Hierarchical relationships between rows in an external file won't + import. + operationId: import-sheet-into-folder + tags: + - imports + security: + - APIToken: [] + - OAuth2: + - CREATE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Disposition' + - $ref: '#/components/parameters/parameters-Content-Type' + - $ref: '#/components/parameters/sheetName' + - $ref: '#/components/parameters/headerRowIndex' + - $ref: '#/components/parameters/primaryColumnIndex' + requestBody: + description: Binary content for the CSV / XLSX file. + content: + application/octet-stream: + schema: + type: string + format: binary + responses: + '200': + description: Result object containing a Sheet object for imported sheet. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/SheetImported' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + Sheet sheet = + smartsheet.FolderResources.SheetResources.ImportXlsSheet( + 8999900887877508, // folderId + "D:/ProgressReport.xlsx", + null, // sheetName defaults to file name unless specified + 0, // headerRowIndex + null // primaryColumnIndex + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/folders/{folderId}/sheets/import?sheetName=MarketingProgressReport&headerRowIndex=0&primaryColumnIndex=0 + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Disposition: attachment" \ + + -H "Content-Type: text/csv" \ + + -X POST \ + + --data-binary @ProgressReport.csv + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Sheet sheet = smartsheet.sheetResources().importXlsxInFolder( + 8999900887877508L, // long folderId + "D:/ProgressReport.xlsx", + "MarketingProgressReport", + 0, // headerRowIndex + 0 // primaryColumnIndex + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Sample 1: Import CSV into folder + // Set options + var options = { + folderId: 8999900887877508, + queryParameters: { + sheetName: 'MarketingProgressReport' + }, + path: "D:/ProgressReport.csv" + }; + + // Import CSV as sheet into folder + smartsheet.sheets.importCsvSheetIntoFolder(options) + .then(function(attachment) { + console.log(attachment); + }) + .catch(function(error) { + console.log(error); + }); + + //Sample 2: Import XLSX into folder + // Set options + var options = { + folderId: 8999900887877508, + queryParameters: { + sheetName: 'MarketingProgressReport' + }, + path: "D:/ProgressReport.xlsx" + }; + + // Import XLSX as sheet into Folder + smartsheet.sheets.importXlsxSheetIntoFolder(options) + .then(function(attachment) { + console.log(attachment); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + imported_sheet = smartsheet_client.Folders.import_xlsx_sheet( + 8999900887877508, # folder_id + 'D:/ProgressReport.xlsx', + 'MarketingProgressReport', # sheet_name + header_row_index=0 + ) + /folders/personal: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Contents + deprecated: true + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-06-23), this endpoint will be + removed.** + + + Gets a nested list of all Home objects shared to the user, including + + dashboards, folders, reports, sheets, and templates, as shown on the + "Home" + + tab. + tags: + - home + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + operationId: list-home-contents + parameters: + - $ref: '#/components/parameters/folderWorkspaceInclude' + responses: + '200': + description: A single Home object. + content: + application/json: + schema: + $ref: '#/components/schemas/Home' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: cURL + label: cURL + source: | + curl 'https://api.smartsheet.com/2.0/folders/personal' \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" + /groups: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + operationId: list-groups + summary: List Org Groups + description: > + Gets a list of all groups in an organization account. To fetch the + members of an individual group, use the [Get + Group](/api/smartsheet/openapi/groups/get-group) operation. + tags: + - groups + security: + - APIToken: [] + - OAuth2: + - READ_USERS + parameters: + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/modifiedSince' + - $ref: '#/components/parameters/numericDates' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: > + IndexResult object containing an array of [Group + objects](/api/smartsheet/openapi/groups/group) + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: List of Groups + type: array + items: + $ref: '#/components/schemas/Group' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PaginatedResult groups = + smartsheet.GroupResources.ListGroups( + null // PaginationParameters + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/groups \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Omit pagination parameters + PagedResult groups = smartsheet.groupResources().listGroups( + null // PaginationParameters + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.groups.listGroups() + .then(function(groupList) { + console.log(groupList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List all + response = smartsheet_client.Groups.list_groups(include_all=True) + groups = response.data + + # Sample 2: Paginate the list + response = smartsheet_client.Groups.list_groups( + page_size=10, + page=1) + pages = response.total_pages + groups = response.data + post: + operationId: add-group + summary: Add Group + description: > + Creates a new group. + + + **_This operation is only available to group administrators and system + administrators._** + tags: + - groups + security: + - APIToken: [] + - OAuth2: + - ADMIN_USERS + requestBody: + description: > + [Group object](/api/smartsheet/openapi/groups/group), limited to the + following attributes: + + * name (required) -- must be unique within the organization account + + * description (optional) + + * members (optional) -- array of [GroupMember + objects](/api/smartsheet/openapi/groupmembers/groupmember), each + limited to the following attribute: + * email + content: + application/json: + schema: + $ref: '#/components/schemas/GroupCreate' + responses: + '200': + description: > + Result object, containing a [Group + object](/api/smartsheet/openapi/groups/group) for the newly created + group + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Group' + '400': + $ref: '#/components/responses/400' + '401': + $ref: '#/components/responses/401' + '500': + $ref: '#/components/responses/500' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Create group member + + GroupMember memberSpecification = new GroupMember { Email = + "john.doe@smartsheet.com" }; + + + // Add member to group + + Group groupSpecification = new Group + + { + Name = "API-created Group", + Description = "Group created via API", + Members = new GroupMember[] { memberSpecification } + }; + + + // Create group + + Group newGroup = + smartsheet.GroupResources.CreateGroup(groupSpecification); + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/groups \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '{ "name": "API-created Group", "description": "Group created via + API", "members": [{ "email": "john.doe@smartsheet.com" }]}' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Create group member + + GroupMember memberSpecification = new GroupMember(); + + memberSpecification.setEmail("john.doe@smartsheet.com"); + + + // Add member to group + + Group groupSpecification = new Group(); + + groupSpecification.setDescription("Group created via API") + .setMembers(Arrays.asList(memberSpecification)) + .setName("API-created Group"); + + // Create group + + Group newGroup = + smartsheet.groupResources().createGroup(groupSpecification); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify group + var group = { + "name": "API-created Group", + "description": "Group created via API", + "members": [ + { + "email": "john.doe@smartsheet.com" + } + ] + }; + + // Set options + var options = { + body: group + }; + + // Create group + smartsheet.groups.createGroup(options) + .then(function(newGroup) { + console.log(newGroup); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + new_group = smartsheet_client.Groups.create_group( + smartsheet.models.Group({ + 'name': 'API-created Group', + 'description': 'Group created via API', + 'members': smartsheet.models.GroupMember({ + 'email': 'john.doe@smartsheet.com' + }) + }) + ) + /groups/{groupId}: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/groupId' + get: + operationId: get-group + summary: Get Group + description: >- + Gets information about an array of [Group + Members](/api/smartsheet/openapi/groupmembers/groupmember) for the group + specified in the URL. + tags: + - groups + security: + - APIToken: [] + - OAuth2: + - READ_USERS + responses: + '200': + description: > + [Group](/api/smartsheet/openapi/groups/group) object that includes + the list of + [GroupMember](/api/smartsheet/openapi/groupmembers/groupmember) + objects + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Group' + - type: object + properties: + members: + description: List of Group Members + type: array + items: + $ref: '#/components/schemas/GroupMember' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Group group = smartsheet.GroupResources.GetGroup( + 6932724448552836 // long groupId + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/groups/{groupId} \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Group group = smartsheet.groupResources().getGroup( + 6932724448552836L // long groupId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + id: 6932724448552836 // Id of Group + }; + + // Get group + smartsheet.groups.getGroup(options) + .then(function(group) { + console.log(group); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + group = smartsheet_client.Groups.get_group( + 6932724448552836) # group_id + # group is an instance of smartsheet.models.Group + put: + operationId: update-group + summary: Update Group + description: > + Updates the Group specified in the URL. + + + **_This operation is only available to group administrators and system + administrators._** + tags: + - groups + security: + - APIToken: [] + - OAuth2: + - ADMIN_USERS + requestBody: + description: > + Group object, limited to the following attributes: + + * description (optional) + + * name (optional) -- must be unique within the organization account + + * ownerId (optional): Id of an admin user to whom the group ownership + is transferred + content: + application/json: + schema: + $ref: '#/components/schemas/GroupUpdate' + responses: + '200': + description: >- + Result object containing the [Group + object](/api/smartsheet/openapi/groups/group) for the updated group + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Group' + '400': + $ref: '#/components/responses/400' + '500': + $ref: '#/components/responses/500' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify the name and description of the group + + Group groupSpecification = new Group + + { + Id = 2331373580117892, + Name = "Renamed Group", + Description = "Some new description" + }; + + + // Update group + + Group updatedGroup = + smartsheet.GroupResources.UpdateGroup(groupSpecification); + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/groups/{groupId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X PUT \ + + -d '{ "name": "Renamed Group", "description": "Some new description" + }' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify the name and description of the group + + Group groupSpecification = new Group(2331373580117892L); + groupSpecification.setDescription("Some new description") + .setName("Renamed Group"); + + // Update group + + Group updatedGroup = + smartsheet.groupResources().updateGroup(groupSpecification); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify the name and description of the group + var group = { + "name": "Renamed Group", + "description": "Some new description" + }; + + // Set options + var options = { + id: 2331373580117892, // Id of Group + body: group + }; + + // Update group + smartsheet.groups.updateGroup(options) + .then(function(updatedGroup) { + console.log(updatedGroup); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + updated_group = smartsheet_client.Groups.update_group( + 2331373580117892, # group_id + smartsheet.models.Group({ + 'name': 'Renamed Group', + 'description': 'Some new description' + }) + ) + delete: + operationId: delete-group + summary: Delete Group + description: > + Deletes the group specified in the URL. + + + **_This operation is only available to group administrators and system + administrators._** + tags: + - groups + security: + - APIToken: [] + - OAuth2: + - ADMIN_USERS + responses: + '200': + description: > + **_This operation is asynchronous,_** _meaning group members may + retain their sharing access for a brief period of time after the + call returns. For small groups with limited sharing, the operation + should complete quickly (within a few seconds). For large groups + with many shares, this operation could possibly take more than a + minute to complete._ + content: + application/json: + schema: + $ref: '#/components/schemas/GenericResult' + '401': + $ref: '#/components/responses/401' + '404': + $ref: '#/components/responses/404' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.GroupResources.DeleteGroup( + 6932724448552836 // long groupId + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/groups/{groupId} \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -X DELETE + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.groupResources().deleteGroup( + 6932724448552836L // long groupId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + id: 6932724448552836 // Id of Group + }; + + // Delete group + smartsheet.groups.deleteGroup(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Groups.delete_group( + 6932724448552836) # group_id + /groups/{groupId}/members: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/groupId' + post: + operationId: add-group-members + summary: Add Group Members + description: > + Adds one or more members to a group. + + + **_This operation supports both single-object and bulk semantics. For + more information, see Optional Bulk Operations._** + + + If called with a single [GroupMember + object](/api/smartsheet/openapi/groupmembers/groupmember), and that + group member already exists, error code **1129** is returned. + + If called with an array of [GroupMember + objects](/api/smartsheet/openapi/groupmembers/groupmember), any users + specified in the array that are already group members are ignored and + omitted from the response. + + + **_This operation is only available to group administrators and system + administrators._** + tags: + - groupMembers + security: + - APIToken: [] + - OAuth2: + - ADMIN_USERS + requestBody: + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/GroupMember' + - type: array + items: + $ref: '#/components/schemas/GroupMember' + responses: + '200': + description: > + Returns a Result object containing the members added to the group -- + either a single + [GroupMember](/api/smartsheet/openapi/groupmembers/groupmember) or + array of + [GroupMember](/api/smartsheet/openapi/groupmembers/groupmember) + objects, corresponding to what was specified in the request. + + + **_This operation is asynchronous,_** _meaning the users may not yet + have sharing access to sheets for a period of time after this + operation returns. For small groups with limited sharing, the + operation should complete quickly (within a few seconds). For large + groups with many shares, this operation could possibly take more + than a minute to complete._ + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + oneOf: + - $ref: '#/components/schemas/GroupMember' + - type: array + items: + $ref: '#/components/schemas/GroupMember' + default: + description: > + If an error occurs because the request specified one or more + alternate email addresses, please retry using the primary email + address. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Create group member + + GroupMember memberSpecification = new GroupMember { Email = + "jane.doe@smartsheet.com" }; + + + // Add members to group + + IList newMembers = + smartsheet.GroupResources.AddGroupMembers( + 7917992160847748, // long groupId + new GroupMember[] { memberSpecification } + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/groups/{groupId}/members \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" \ + -X POST \ + -d "[{ \"email\": \"jane.doe@smartsheet.com\" }]" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Create group member + + GroupMember memberSpecification = new GroupMember(); + memberSpecification.setEmail("jane.doe@smartsheet.com"); + + // Add members to group + + List newMembers = + smartsheet.groupResources().memberResources().addGroupMembers( + 7917992160847748L, // long groupId + Arrays.asList(memberSpecification) + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify group members + var members = [{ "email": "jane.doe@smartsheet.com" }]; + + // Set options + var options = { + groupId: 7917992160847748, + body: members + }; + + // Add members to group + smartsheet.groups.addGroupMembers(options) + .then(function(newMembers) { + console.log(newMembers); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + new_members = smartsheet_client.Groups.add_members( + 7917992160847748, # group_id + [smartsheet.models.GroupMember({'email': 'jane.doe@smartsheet.com'})] + ) + /groups/{groupId}/members/{userId}: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/groupId' + - $ref: '#/components/parameters/userId' + delete: + operationId: delete-group-members + summary: Delete Group Members + description: > + Removes a member from a group. + + + **_This operation is only available to group administrators and system + administrators._** + tags: + - groupMembers + security: + - APIToken: [] + - OAuth2: + - ADMIN_USERS + responses: + '200': + description: > + **_This operation is asynchronous,_** _meaning the users may not yet + have sharing access to sheets for a period of time after this + operation returns. For small groups with limited sharing, the + operation should complete quickly (within a few seconds). For large + groups with many shares, this operation could possibly take more + than a minute to complete._ + content: + application/json: + schema: + $ref: '#/components/schemas/GenericResult' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.GroupResources.RemoveGroupMember( + 7917992160847748, // long groupId + 1539725208119172 // long userId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/groups/{groupId}/members/{userId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.groupResources().memberResources().deleteGroupMember( + 7917992160847748L, // long groupId + 1539725208119172L) // long userId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + groupId: 7917992160847748, + userId: 1539725208119172 + }; + + // Remove member from group + smartsheet.groups.removeGroupMember(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Groups.remove_member( + 7917992160847748, # group_id + 1539725208119172) # group_member_id + /home/folders: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Folders in Home + deprecated: true + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-03-25), this endpoint will be + removed.** To adapt to this change, please see [Migrate from using the + Sheets + folder](/api/smartsheet/guides/updating-code/migrate-from-using-the-sheets-folder). + + + Lists the folders in your **Sheets** folder. The list contains an + abbreviated Folder object for each folder. + tags: + - home + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + operationId: home-list-folders + parameters: + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: IndexResult object containing an array of Folder objects. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + result: + type: array + items: + $ref: '#/components/schemas/Folder' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PaginatedResult folders = + smartsheet.HomeResources.FolderResources.ListFolders( + null // PaginationParameters + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/home/folders \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PagedResult folders = + smartsheet.homeResources().folderResources().listFolders( + null // PaginationParameters + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.home.listFolders() + .then(function(folderList) { + console.log(folderList); + }) + .catch(function(error) { + console.log(error); + }) + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List all + response = smartsheet_client.Home.list_folders(include_all=True) + home_sheets_folders = response.data + + # Sample 2: Paginate the list + response = smartsheet_client.Home.list_folders( + page_size=5, + page=1) + pages = response.total_pages + folders = response.data + post: + summary: Create Folder + deprecated: true + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-03-25), this endpoint will be + removed.** + + + Creates a new folder. + operationId: create-home-folder + tags: + - home + security: + - APIToken: [] + - OAuth2: + - ADMIN_WORKSPACES + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + description: Folder to create. + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/Folder' + responses: + '200': + description: Result object containing a Folder object for newly created folder. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + oneOf: + - $ref: '#/components/schemas/Folder' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Set folder name + + Folder folderSpecification = new Folder { Name = "New folder" }; + + + // Create folder in "Sheets" folder (Home) + + Folder newFolder = + smartsheet.HomeResources.FolderResources.CreateFolder(folderSpecification); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/home/folders \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" \ + -X POST \ + -d '{"name": "New folder"}' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Set folder name + + Folder folderSpecification = new Folder(); + + folderSpecification.setName("New Folder"); + + + // Create folder in "Sheets" folder (Home) + + Folder newFolder = + smartsheet.homeResources().folderResources().createFolder(folderSpecification); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set folder name + var folder = { + "name": "New folder" + }; + + // Set options + var options = { + body: folder + }; + + // Create folder in "Sheets" folder (Home) + smartsheet.home.createFolder(options) + .then(function(newFolder) { + console.log(newFolder); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + new_folder = smartsheet_client.Home.create_folder('New Folder') + /imageurls: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/Content-Type' + post: + operationId: listImageUrls + summary: List Image URLs + description: >- + Posts an array of Image Url objects that can be used to retrieve the + specified cell images. + tags: + - cellImages + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + requestBody: + content: + application/json: + schema: + type: array + items: + allOf: + - $ref: '#/components/schemas/ImageUrl' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/ImageUrlMap' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Build list of image urls + + ImageUrl[] imageUrls = new ImageUrl[] { new ImageUrl { ImageId = + "jpbGklqdfZuL4Jw-kZhdZA" } }; + + + string temporaryUrl = + smartsheet.ImageUrlResources.GetImageUrls(imageUrls).ImageUrls[0].Url; + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/imageurls \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '[{"imageId": "e1znCxhuZo_soEJtUmmX_A","height":40,"width": + 20},{"imageId": "g2jdKdfhQa_abKJmPnhC_B","height":100,"width": 50}]' + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Build list of image urls + ImageUrl imageUrl = new ImageUrl() + .setImageId("jpbGklqdfZuL4Jw-kZhdZA"); + List imageUrls = Arrays.asList(imageUrl); + + String temporaryUrl = smartsheet.imageUrlResources().getImageUrls(imageUrls).getImageUrls().get(0).getUrl(); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + body: [{ + imageId: "jpbGklqdfZuL4Jw-kZhdZA", + width: 256, + height: 256 + }] + }; + + // List image URLs + smartsheet.images.listImageUrls(options) + .then(function(temporaryUrls) { + console.log(temporaryUrls); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + imageUrl = smartsheet.models.ImageUrl( + { + "imageId": 'jpbGklqdfZuL4Jw-kZhdZA', + "height": 256, + "width": 256 + } + ) + + response = smartsheet_client.Images.get_image_urls([imageUrl]) + url = response.image_urls[0].url + /reports: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + operationId: getReports + summary: List Reports + description: List all Reports accessible to the user. + tags: + - reports + security: + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/modifiedSince' + responses: + '200': + description: > + Object containing an array of all accessible reports, referenced by + their ID, name, access level, and summary report flag values. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: >- + List of all accessible reports, referenced by their + ID, name, access level, and summary report flag + values. + type: array + items: + type: object + properties: + id: + type: number + description: The report's unique identifier. + example: 987654321 + name: + type: string + description: The report's name. + example: Q2 Earnings + accessLevel: + $ref: '#/components/schemas/AccessLevel' + permalink: + type: string + description: URL to the report in Smartsheet. + example: >- + https://app.smartsheet.com/reports/c8gJxw87cXpRCvCC5PPw6jFhFRrf5r8PxCrxvW21 + isSummaryReport: + type: boolean + description: >- + It is `true` if the report is a sheet summary; + otherwise it is a row report. + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + PaginatedResult reports = + smartsheet.ReportResources.ListReports( + null, // PaginationParameters + null // Nullable modifiedSince = null + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/reports \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + PagedResult reports = + smartsheet.reportResources().listReports( + null, // PaginationParameters + null // Date modifiedSince + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.reports.listReports() + .then(function(reportList) { + console.log(reportList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + response = smartsheet_client.Reports.list_reports(include_all=True) + reports = response.data + /reports/{reportId}: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/Accept' + - $ref: '#/components/parameters/accessApiLevel' + - $ref: '#/components/parameters/reportId' + get: + summary: Get Report + description: Gets a report based on the specified ID + operationId: getReport + parameters: + - $ref: '#/components/parameters/reportInclude' + - $ref: '#/components/parameters/reportExclude' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/reportLevel' + tags: + - reports + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: The Report that was loaded. + content: + application/json: + schema: + $ref: '#/components/schemas/Report' + application/vnd.ms-excel: + schema: + type: string + format: binary + description: The Report in Excel format + text/csv: + schema: + type: string + format: binary + description: The Report in CSV format + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Sample 1: Omit 'include', 'pageSize', and 'page' parameters + + Report report = smartsheet.ReportResources.GetReport( + 4583173393803140, // long reportId + null, // IEnumerable include + null, // int pageSize + null // int page + ); + + + // Sample 2: Specify 'include' parameter with value of "ATTACHMENTS" + and "DISCUSSIONS", 'pageSize' parameter with value of "500", and + 'page' of value "2" + + Report report = smartsheet.ReportResources.GetReport( + 4583173393803140, // long reportId + new ReportInclusion[] { + ReportInclusion.ATTACHMENTS, + ReportInclusion.DISCUSSIONS + }, + 500, // int pageSize + 2 // int page + ); + + + // Sample 3: Get report as Excel + + smartsheet.ReportResources.GetReportAsExcel( + 3882962191181700, // long reportId + outputStream // BinaryWriter + ); + + + // Sample 4: Get report as CSV + + smartsheet.ReportResources.GetReportAsCSV( + 3882962191181700, // long reportId + outputStream // BinaryWriter + ); + - lang: cURL + label: cURL + source: > + // Sample 1: Get report + + curl + https://api.smartsheet.com/2.0/reports/{reportId}?level=3&include=objectValue + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + + + // Sample 2: Get report as Excel + + curl https://api.smartsheet.com/2.0/reports/{reportId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Accept: application/vnd.ms-excel" \ + + -o output.xlsx + + + // Sample 3: Get report as CSV + + curl https://api.smartsheet.com/2.0/reports/{reportId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Accept: text/csv" \ + + -o output.csv + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Sample 1: Omit 'include', 'pageSize', and 'page' parameters + + Report report = smartsheet.reportResources().getReport( + 4583173393803140L, // long reportId + null, // EnumSet includes + null, // int pageSize + null // int page + ); + + // Sample 2: Specify 'include' parameter with value of "ATTACHMENTS" + and "DISCUSSIONS", 'pageSize' parameter with value of "500", and + 'page' of value "2" + + Report report = smartsheet.reportResources().getReport( + 4583173393803140L, // long reportId + EnumSet.of( + ReportInclusion.ATTACHMENTS, + ReportInclusion.DISCUSSIONS), + 500, // int pageSize + 2 // int page + ); + + // Sample 3: Get report as Excel + + smartsheet.reportResources().getReportAsExcel( + 3882962191181700L, // long reportId + outputStream + ); + + // Sample 4: Get report as CSV + + smartsheet.reportResources().getReportAsCsv( + 3882962191181700L, // long reportId + outputStream + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Sample 1: Get report + // Set options + var options = { + id: 4583173393803140 // Id of Report + }; + + // Get report + smartsheet.reports.getReport(options) + .then(function(report) { + console.log(report); + }) + .catch(function(error) { + console.log(error); + }); + + // Sample 2: Get report as Excel + var fs = require("fs") + + // Set options + var options = { + id: 3882962191181700 // Id of Report + }; + + // Get sheet + smartsheet.reports.getReportAsExcel(options) + .then(function(fileContents) { + // Write report to file + fs.writeFile('output.xlsx', fileContents, 'binary', (err) => { + if (err) throw err; + console.log('The report has been saved!'); + }); + }) + .catch(function(error) { + console.log(error); + }); + + // Sample 3: Get report as CSV + var fs = require("fs") + + // Set options + var options = { + id: 3882962191181700 // Id of Report + }; + + // Get sheet + smartsheet.reports.getReportAsCSV(options) + .then(function(fileContents) { + // Write report to file + fs.writeFile('output.csv', fileContents, (err) => { + if (err) throw err; + console.log('The report has been saved!'); + }); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: Get report + report = smartsheet_client.Reports.get_report( + 4583173393803140) # report_id + + # Sample 2: Get report as Excel + # Download file with filename suggested by API + smartsheet_client.Reports.get_report_as_excel( + 3882962191181700, # report_id + download_folder_path + ) + + # Specify custom filename for the downloaded file + smartsheet_client.Reports.get_report_as_excel( + 3882962191181700, # report_id + download_folder_path, + 'MyFileName.xslx' + ) + + # Sample 3: Get report as CSV + # Download file with filename suggested by API + smartsheet_client.Reports.get_report_as_csv( + 3882962191181700, # report_id + download_folder_path + ) + + # Specify custom filename for the downloaded file + smartsheet_client.Reports.get_report_as_csv( + 3882962191181700, # report_id + download_folder_path, + 'CallMeAl.csv' + ) + /reports/{reportId}/emails: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/reportId' + post: + summary: Send report via email + description: >- + Sends the report as a PDF attachment via email to the designated + recipients + operationId: sendReportViaEmail + tags: + - reports + security: + - APIToken: [] + - OAuth2: + - SHARE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SheetEmail' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify recipients + + Recipient[] recipientSpecification = new Recipient[] { + new Recipient { Email = "john.doe@smartsheet.com" }, + new Recipient { GroupId = 2258118617917316 } + }; + + + // Configure email + + SheetEmail sheetEmail = new SheetEmail { + SendTo = recipientSpecification, + Subject = "Check this report out!", + Message = "Here is the report I mentioned in our meeting", + CcMe = false, + Format = SheetEmailFormat.PDF, + FormatDetails = new FormatDetails { PaperSize = PaperSize.A4 } + }; + + + // Send report via email + + smartsheet.ReportResources.SendReport (8130994621441924, + sheetEmail); // long reportId + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/reports/{reportId}/emails \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '{"sendTo" : [{"email": "john.doe@smartsheet.com"}, {"groupId": + 2258118617917316}], "subject": "Check these rows out!", "message": + "Here are the rows I mentioned in our meeting", "ccMe": false, + "format": "PDF", "formatDetails": {"paperSize": "A4"}}' + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify an individual recipient + RecipientEmail recipientEmail = new RecipientEmail() + .setEmail("john.doe@smartsheet.com"); + + // Specify a group recipient + RecipientGroup recipientGroup = new RecipientGroup() + .setGroupId(2258118617917316L); + + // Set recipients + List recipientList = Arrays.asList( + recipientEmail, + recipientGroup + ); + + // Set format details + FormatDetails formatDetails = new FormatDetails() + .setPaperSize(PaperSize.A0); + + // Configure email + SheetEmail emailSpecification = new SheetEmail(); + emailSpecification.setFormat(SheetEmailFormat.PDF); + emailSpecification.setFormatDetails(formatDetails) + .setSendTo(recipientList) + .setSubject("Check this report out!") + .setMessage("Here is the report I mentioned in our meeting") + .setCcMe(false); + + // Send report via email + smartsheet.reportResources().sendReport( + 8130994621441924L, // long reportId + emailSpecification + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Configure email + var email = { + "sendTo": [ + { + "email": "john.doe@smartsheet.com" + }, + { + "groupId": 2258118617917316 + } + ], + "subject": "Check these rows out!", + "message": "Here are the rows I mentioned in our meeting", + "ccMe": false, + "format": "PDF", + "formatDetails": { + "paperSize": "A4" + } + }; + + // Set options + var options = { + body: email, + reportId: 8130994621441924 + }; + + // Send report via email + smartsheet.reports.sendReportViaEmail(options) + .then(function(data) { + console.log(data); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + response = smartsheet_client.Reports.send_report( + 8130994621441924, # report_id + smartsheet.models.SheetEmail({ + 'send_to': smartsheet.models.Recipient({ + 'email': 'john.doe@smartsheet.com' + }), + 'subject': 'Check this report out!', + 'message': 'Here is the report I mentioned in our meeting.', + 'cc_me': False, + 'format': 'PDF', + 'format_details': smartsheet.models.FormatDetails({ + 'paper_size': 'A4' + }) + }) + ) + responses: + '200': + description: Result Object + content: + application/json: + schema: + $ref: '#/components/schemas/Result' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /reports/{reportId}/publish: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/reportId' + get: + summary: Gets a Report's publish settings + description: Get a Report's publish settings based on the specified ID + operationId: getReportPublish + tags: + - reports + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: The Report's publish settings + content: + application/json: + schema: + $ref: '#/components/schemas/ReportPublish' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.ReportResources.GetPublishStatus( + 3901932860401540 // reportId + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/reports/{reportId}/publish \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.reportResources().getPublishStatus( + 3901932860401540L // reportId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + reportId: 3901932860401540 + }; + + // Get report publish status + smartsheet.reports.getReportPublishStatus(options) + .then(function(status) { + console.log(status); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + status = smartsheet_client.Reports.get_publish_status( + 1653067851556740) # report_id + put: + summary: Set a Report's publish status + description: >- + Sets the publish status of the report and returns the new status, + including the URL of any enabled publishing. + operationId: SetReportPublish + tags: + - reports + security: + - APIToken: [] + - OAuth2: + - ADMIN_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ReportPublish' + responses: + '200': + description: ReportPublish object + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/ItemResult' + - type: object + properties: + result: + $ref: '#/components/schemas/ReportPublish' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + ReportPublish reportPublish = new ReportPublish(); + reportPublish.ReadOnlyFullEnabled = true; + reportPublish.ReadOnlyFullAccessibleBy = "ALL"; + smartsheet.ReportResources.UpdatePublishStatus( + 1653087851556740, // reportId + reportPublish + ); + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/reports/{reportId}/publish \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X PUT \ + + -d '{"readOnlyFullEnabled": true, "readOnlyFullAccessibleBy": + "ORG"}' + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + ReportPublish reportPublish = new ReportPublish(); + reportPublish.setReadOnlyFullEnabled(true); + reportPublish.setReadOnlyFullAccessibleBy("ALL"); + smartsheet.reportResources().updatePublishStatus( + 1653087851556740L, // reportId + reportPublish + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + reportId: 1653087851556740, + body: { + readOnlyFullEnabled: true, + readOnlyFullAccessibleBy: "ALL" + } + }; + + // Set report publish status + smartsheet.reports.setReportPublishStatus(options) + .then(function(status) { + console.log(status); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + response = smartsheet_client.Reports.set_publish_status( + 1653067851556740, # report_id + smartsheet.models.ReportPublish({ + 'read_only_full_enabled': True + }) + ) + /reports/{reportId}/shares: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/reportId' + post: + summary: Share report + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** Please refer to the [Changelog + entry](/api/smartsheet/changelog#2025-08-04) for more details. + + + Shares a Report with the specified users and groups. + deprecated: true + operationId: share-report + tags: + - sharing + - reports + security: + - APIToken: [] + - OAuth2: + - SHARE_SHEETS + parameters: + - $ref: '#/components/parameters/sendEmail' + requestBody: + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/Share' + - type: array + items: + $ref: '#/components/schemas/Share' + responses: + '200': + description: > + Result object containing either a single Share object or an array of + Share objects, corresponding + + to what was specified in the request. All shares have scope=ITEM. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + properties: + result: + oneOf: + - $ref: '#/components/schemas/Share' + - type: array + items: + $ref: '#/components/schemas/Share' + '400': + description: > + If called with a single Share object, and that user or group share + already exists, error code 1025 is returned. + + If called with an array of Share objects, and one or more user or + group shares in the array already exist, + + they are ignored and omitted from the response. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify share (to one user as Editor) + + Share[] shareSpecification = new Share[] { new Share + { + Email = "jane.doe@smartsheet.com", + AccessLevel = AccessLevel.EDITOR + } + }; + + + // Share report + + IList addressList = + smartsheet.ReportResources.ShareResources.ShareTo( + 665829219035012, // long reportId + shareSpecification, + true // Nullable sendEmail + ); + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/reports/{reportId}/shares?sendEmail=true' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '[{"email": "jane.doe@smartsheet.com", "accessLevel": "EDITOR"}]' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify share (to one user as Editor) + + Share shareSpecification = new Share() + .setEmail("jane.doe@smartsheet.com") + .setAccessLevel(AccessLevel.EDITOR); + + // Share report + + List addressList = + smartsheet.reportResources().shareResources().shareTo( + 665829219035012L, // long reportId + Arrays.asList(shareSpecification), + true // Boolean sendEmail + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify share (to one user as Editor) + var share = [ + { + "email": "jane.doe@smartsheet.com", + "accessLevel": "EDITOR" + } + ]; + + // Set options + var options = { + reportId: 665829219035012, + body: share + }; + + // Share report + smartsheet.reports.share(options) + .then(function(addressList) { + console.log(addressList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + response = smartsheet_client.Reports.share_report( + 665829219035012, # report_id + smartsheet.models.Share({ + 'access_level': 'EDITOR', + 'email': 'jane.doe@smartsheet.com' + }) + ) + get: + summary: List report shares + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** Please refer to the [Changelog + entry](/api/smartsheet/changelog#2025-08-04) for more details. + + + Gets a list of all users and groups to whom the specified Report is + shared, + + and their access level. + + + This operation supports query string parameters for pagination of + results. + deprecated: true + operationId: list-report-shares + tags: + - sharing + - reports + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/sharingInclude' + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: >- + IndexResult object containing an array of Share objects. By default, + this operation returns only item-level shares (scope=ITEM). Use the + sharingInclude parameter to request that workspace-level shares + (include=workspaceShares) also be returned. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + result: + type: array + items: + $ref: '#/components/schemas/Share' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PaginatedResult shares = + smartsheet.ReportResources.ShareResources.ListShares( + 665829219035012, // long reportId + null, // PaginationParameters + null // ShareScope shareScope + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/reports/{reportId}/shares \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PagedResult shares = + smartsheet.reportResources().shareResources().listShares( + 665829219035012L, // long reportId + null, // PaginationParameters + true // Boolean includeWorkspaceShares + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + reportId: 665829219035012 + }; + + // List report shares + smartsheet.reports.listShares(options) + .then(function(shareList) { + console.log(shareList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List all + response = smartsheet_client.Reports.list_shares(include_all=True) + shares = response.result + + # Sample 2: Paginate the list + response = smartsheet_client.Reports.list_shares( + page_size=10, + page=1) + pages = response.total_pages + shares = response.result + /reports/{reportId}/shares/{shareId}: + parameters: + - $ref: '#/components/parameters/reportId' + - $ref: '#/components/parameters/shareId' + - $ref: '#/components/parameters/accessApiLevel' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Get report share + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** Please refer to the [Changelog + entry](/api/smartsheet/changelog#2025-08-04) for more details. + + + Gets the share specified in the URL. + deprecated: true + operationId: share-report-get + tags: + - sharing + - reports + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: Returns Share object. + content: + application/json: + schema: + $ref: '#/components/schemas/Share' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Share share = smartsheet.ReportResources.ShareResources.GetShare( + 6932724448552836, // long reportId + "AQAISF82FOeE" // string shareId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/reports/{reportId}/shares/{shareId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + Share share = + smartsheet.reportResources().shareResources().getShare( + 665829219035012L, // long reportId + "AAAQSF82F1eE" // string shareId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + reportId: 6932724448552836, + shareId: "AQAISF82FOeE" + }; + + // Get report share + smartsheet.reports.getShare(options) + .then(function(share) { + console.log(share); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + share = smartsheet_client.Reports.get_share( + 6932724448552836, # report_id + 'AAAQSF82F1eE') # share_id + delete: + summary: Delete report share + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** Please refer to the [Changelog + entry](/api/smartsheet/changelog#2025-08-04) for more details. + + + Deletes the share specified in the URL. + deprecated: true + operationId: delete-report-share + tags: + - sharing + - reports + security: + - APIToken: [] + - OAuth2: + - SHARE_SHEETS + responses: + '200': + description: Returns Result object. + content: + application/json: + schema: + $ref: '#/components/schemas/Result' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.ReportResources.ShareResources.DeleteShare( + 665829219035012, // long reportId + "AAAQSF82F1eE" // string shareId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/reports/{reportId}/shares/{shareId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.reportResources().shareResources().deleteShare( + 665829219035012L, // long reportId + "AAAQSF82F1eE" // string shareId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + reportId: 665829219035012, + shareId: "AAAQSF82F1eE" + }; + + // Delete report share + smartsheet.reports.deleteShare(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Reports.delete_share( + 665829219035012, # report_id + 'AAAQSF82F1eE') # share_id + put: + summary: Update report share + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** Please refer to the [Changelog + entry](/api/smartsheet/changelog#2025-08-04) for more details. + + + Updates the access level of a user or group for the specified report. + deprecated: true + operationId: update-report-share + tags: + - sharing + - reports + security: + - APIToken: [] + - OAuth2: + - SHARE_SHEETS + requestBody: + content: + application/json: + schema: + type: object + properties: + accessLevel: + $ref: '#/components/schemas/AccessLevel' + responses: + '200': + description: Result object containing the modified Share object + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + properties: + result: + type: object + items: + $ref: '#/components/schemas/Share' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Set the access level to Viewer + + Share shareSpecification = new Share + + { + Id = "AAAFeF82FOeE", + AccessLevel = AccessLevel.VIEWER + }; + + + // Update report share + + Share updatedShare = + smartsheet.ReportResources.ShareResources.UpdateShare( + 665829219035012, // long reportId + shareSpecification + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/reports/{reportId}/shares/{shareId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X PUT \ + + -d '{"accessLevel": "VIEWER"}' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Set the access level to Viewer + + Share shareSpecification = new Share(); + shareSpecification.setAccessLevel(AccessLevel.VIEWER) + .setId("AAAFeF82FOeE"); // string shareId + + // Update report share + + Share updatedShare = + smartsheet.reportResources().shareResources().updateShare( + 665829219035012L, // long reportId + shareSpecification + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set the access level to Viewer + var share = {"accessLevel": "VIEWER"}; + + // Set options + var options = { + reportId: 665829219035012, + shareId: "AAAFeF82FOeE", + body: share + }; + + // Update report share + smartsheet.reports.updateShare(options) + .then(function(updatedShare) { + console.log(updatedShare); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + updated_share = smartsheet_client.Reports.update_share( + 665829219035012, # report_id + 'AAAFeF82FOeE', # share_id + smartsheet.models.Share({ + 'access_level': 'VIEWER' + }) + ) + /search: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Search Everything + description: >- + Searches all sheets that the user can access, for the specified text. If + you have not used the public API in a while, we will need to provision + your data. This could take up to 24 hours so please check back later! + tags: + - search + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + operationId: list-search + parameters: + - $ref: '#/components/parameters/query' + - $ref: '#/components/parameters/location' + - $ref: '#/components/parameters/modifiedSince' + - $ref: '#/components/parameters/parameters-include' + - $ref: '#/components/parameters/scopes' + responses: + '200': + description: >- + SearchResult object that contains an array of Search objects + (maximum 100). + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/SearchResult' + - type: object + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set search criteria + string query = "stuff"; + + // Search everything + SearchResult results = smartsheet.SearchResources.Search(query); + - lang: cURL + label: cURL + source: | + curl 'https://api.smartsheet.com/2.0/search?query=stuff' \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set search criteria + String query = "stuff"; + + // Search everything + SearchResult results = smartsheet.searchResources().search(query); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + query: "stuff" + }; + + // Search everything + smartsheet.search.searchAll(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Set search criteria + query = 'stuff' + + # Search everything + result = smartsheet_client.Search.search(query) + # result is a smartsheet.models.SearchResult object + /search/sheets/{sheetId}: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Search Sheet + description: >- + Gets a list of the user's search results in a sheet based on query. The + list contains an abbreviated row object for each search result in a + sheet. If you have not used the public API in a while, we will need to + provision your data. This could take up to 24 hours so please check back + later! *Note* Newly created or recently updated data may not be + immediately discoverable via search. + tags: + - search + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + operationId: list-search-sheet + parameters: + - $ref: '#/components/parameters/query' + responses: + '200': + description: >- + SearchResult object containing an array of SearchResultItem objects + in a sheet (maximum 100) + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/SearchResult' + - type: object + properties: + result: + type: array + items: + $ref: '#/components/schemas/SearchResultItem' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /serverinfo: + get: + summary: Gets application constants. + description: Gets application constants. + operationId: serverinfo-get + tags: + - serverInfo + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ServerInfo' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + ServerInfo serverInfo = + smartsheet.ServerInfoResources.GetServerInfo(); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/serverinfo + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + ServerInfo serverInfo = + smartsheet.serverInfoResources().getServerInfo(); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.server.getInfo() + .then(function(serverInfo) { + console.log(serverInfo); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + info = smartsheet_client.Server.server_info() + /shares: + parameters: + - $ref: '#/components/parameters/Authorization' + get: + summary: List asset shares + description: > + Retrieves a list of all users and groups to whom the specified asset is + shared, and their access level. This + + operation supports query string parameters for pagination of results. + + + For more information, see our [pagination + documentation.](https://developers.smartsheet.com/api/smartsheet/guides/advanced-topics/scalability-options#token-based-pagination). + operationId: list-asset-shares + tags: + - sharing + security: + - APIToken: [] + - OAuth2: + - ADMIN_WORKSPACES + - SHARE_SHEETS + - SHARE_SIGHTS + parameters: + - $ref: '#/components/parameters/assetType' + - $ref: '#/components/parameters/assetId' + - $ref: '#/components/parameters/maxItems' + - $ref: '#/components/parameters/lastKey' + - $ref: '#/components/parameters/sharingInclude' + responses: + '200': + description: > + Object containing an array of [Share + response](/api/smartsheet/openapi/sharing/shareresponse) objects. By + default, this operation returns only item-level shares + + (scope=ITEM). Use the sharingInclude parameter to request that + workspace level shares also be returned. + + + The response result will always exist, but the list may be empty if + there are no shares for the specified asset. + content: + application/json: + schema: + required: + - result + allOf: + - type: object + properties: + lastKey: + $ref: '#/components/schemas/LastKey' + - type: object + properties: + items: + type: array + items: + $ref: '#/components/schemas/ShareResponse' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/shares?assetId=1234567890&assetType=sheet + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: JavaScript SDK + label: JavaScript SDK + source: > + // List all shares for an asset + + const listOptions = { + queryParameters: { + assetType: 'sheet', + assetId: 1234567890, + maxItems: 100 + } + }; + + + const shares = await + smartsheet.sharing.listAssetShares(listOptions); + - lang: Python + label: Python SDK + source: | + # List all shares for an asset + shares = smartsheet.Sharing.list_asset_shares( + asset_type='sheet', + asset_id=1234567890, + max_items=100 + ) + post: + summary: Share asset + description: > + Shares an asset with the specified users and/or groups. + + + **One (and only one) of the following is required (alongside + accessLevel)**: + - email + - groupId + operationId: share-asset + tags: + - sharing + security: + - APIToken: [] + - OAuth2: + - ADMIN_WORKSPACES + - SHARE_SHEETS + - SHARE_SIGHTS + parameters: + - $ref: '#/components/parameters/assetType' + - $ref: '#/components/parameters/assetId' + - $ref: '#/components/parameters/sendEmail' + requestBody: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/CreateShareRequest' + responses: + '200': + description: > + Result object containing an array of [Share + response](/api/smartsheet/openapi/sharing/shareresponse) objects, + corresponding to what was specified in the request. + + + If the users and/or groups are already shared to the specified + asset, they will be omitted from the response. + + An empty response indicates that all the users and/or groups in the + request are already shared to the asset. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/SuccessResult' + - type: object + properties: + result: + type: array + items: + $ref: '#/components/schemas/ShareResponse' + '400': + description: 4XX errors typically indicate client input validation failures. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/shares?assetType=sheet&assetId=1234567890' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '[{"email": "jane.doe@smartsheet.com", "accessLevel": "EDITOR"}]' + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Share asset with users + const shareOptions = { + queryParameters: { + assetType: 'sheet', + assetId: 1234567890, + sendEmail: true + }, + body: [{ + email: 'jane.doe@smartsheet.com', + accessLevel: 'EDITOR', + message: 'Please review this sheet' + }] + }; + + const result = await smartsheet.sharing.shareAsset(shareOptions); + - lang: Python + label: Python SDK + source: | + # Share asset with users + share = smartsheet.models.Share() + share.email = 'jane.doe@smartsheet.com' + share.access_level = 'EDITOR' + share.message = 'Please review this sheet' + + result = smartsheet.Sharing.share_asset( + share_obj=[share], + asset_type='sheet', + asset_id=1234567890, + send_email=True + ) + /shares/{shareId}: + parameters: + - $ref: '#/components/parameters/Authorization' + get: + summary: Get asset share + description: | + Retrieves a specific share for the specified asset. + operationId: get-asset-share + tags: + - sharing + security: + - APIToken: [] + - OAuth2: + - ADMIN_WORKSPACES + - SHARE_SHEETS + - SHARE_SIGHTS + parameters: + - $ref: '#/components/parameters/shareId' + - $ref: '#/components/parameters/assetType' + - $ref: '#/components/parameters/assetId' + responses: + '200': + description: The share specified by the shareId. + content: + application/json: + schema: + $ref: '#/components/schemas/ShareResponse' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/shares/AbcdEFGhIjKlmNoPqRstUvWxyZ?assetId=1234567890&assetType=sheet + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Get a specific share + const shareOptions = { + shareId: 'AbcdEFGhIjKlmNoPqRstUvWxyZ', + queryParameters: { + assetType: 'sheet', + assetId: 1234567890 + } + }; + + const share = await smartsheet.sharing.getAssetShare(shareOptions); + - lang: Python + label: Python SDK + source: | + # Get a specific share + share = smartsheet.Sharing.get_asset_share( + asset_type='sheet', + asset_id=1234567890, + share_id='AbcdEFGhIjKlmNoPqRstUvWxyZ' + ) + patch: + summary: Update asset share + description: Updates the share for a specified asset. + operationId: update-asset-share + tags: + - sharing + security: + - APIToken: [] + - OAuth2: + - ADMIN_WORKSPACES + - SHARE_SHEETS + - SHARE_SIGHTS + parameters: + - $ref: '#/components/parameters/shareId' + - $ref: '#/components/parameters/assetType' + - $ref: '#/components/parameters/assetId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateShareRequest' + responses: + '200': + description: >- + Result object containing a [Share + response](/api/smartsheet/openapi/sharing/shareresponse) object, + corresponding to what was specified in the request. + content: + application/json: + schema: + $ref: '#/components/schemas/ShareResponse' + '400': + description: 4XX errors typically indicate client input validation failures. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify share (to one user as Editor) + + Share[] shareSpecification = new Share[] { new Share + { + Email = "jane.doe@smartsheet.com", + AccessLevel = AccessLevel.EDITOR + } + }; + + + // Share sheet + + IList addressList = + smartsheet.SheetResources.ShareResources.ShareTo( + 4583614634583940, // sheetId + shareSpecification, + true // Nullable sendEmail + ); + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/shares/abcDefgHjiKlmnoPqRstuVwxyZ?assetType=sheet&assetId=1234567890' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X PATCH \ + + -d '{"accessLevel": "ADMIN"}' + - lang: JavaScript SDK + label: JavaScript SDK + source: > + // Update share access level + + const updateOptions = { + shareId: 'abcDefgHjiKlmnoPqRstuVwxyZ', + queryParameters: { + assetType: 'sheet', + assetId: 1234567890 + }, + body: { + accessLevel: 'ADMIN' + } + }; + + + const updatedShare = await + smartsheet.sharing.updateAssetShare(updateOptions); + - lang: Python + label: Python SDK + source: | + # Update share access level + share = smartsheet.models.Share() + share.access_level = 'ADMIN' + + updated_share = smartsheet.Sharing.update_asset_share( + share_obj=share, + asset_type='sheet', + asset_id=1234567890, + share_id='abcDefgHjiKlmnoPqRstuVwxyZ' + ) + delete: + summary: Delete asset share + description: Deletes the share for a specified asset. + operationId: delete-asset-share + tags: + - sharing + security: + - APIToken: [] + - OAuth2: + - ADMIN_WORKSPACES + - SHARE_SHEETS + - SHARE_SIGHTS + parameters: + - $ref: '#/components/parameters/shareId' + - $ref: '#/components/parameters/assetType' + - $ref: '#/components/parameters/assetId' + responses: + '200': + description: >- + Result object indicating a successful deletion of the share for the + specified asset. + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessResult' + '400': + description: 4XX errors typically indicate client input validation failures. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/shares/abcDefgHjiKlmnoPqRstuVwxyZ?assetType=sheet&assetId=1234567890' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + - lang: JavaScript SDK + label: JavaScript SDK + source: > + // Delete a share + + const deleteOptions = { + shareId: 'abcDefgHjiKlmnoPqRstuVwxyZ', + queryParameters: { + assetType: 'sheet', + assetId: 1234567890 + } + }; + + + const result = await + smartsheet.sharing.deleteAssetShare(deleteOptions); + - lang: Python + label: Python SDK + source: | + # Delete a share + result = smartsheet.Sharing.delete_asset_share( + asset_type='sheet', + asset_id=1234567890, + share_id='abcDefgHjiKlmnoPqRstuVwxyZ' + ) + /sheets: + parameters: + - $ref: '#/components/parameters/accessApiLevel' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Sheets + description: > + Gets a list of all sheets that the user has access to. The list contains + an abbreviated Sheet object for each sheet. + operationId: list-sheets + tags: + - sheets + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/sheetInclude' + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/modifiedSince' + - $ref: '#/components/parameters/numericDates' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/schemas-Sheet' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Sample 1: Omit 'include' parameter and pagination parameters + + PaginatedResult sheets = + smartsheet.SheetResources.ListSheets( + null, // IEnumerable includes + null, // PaginationParameters + null // Nullable modifiedSince + ); + + + // Sample 2: Specify 'include' parameter with value of "SOURCE", and + 'includeAll' parameter with value of 'true' + + PaginatedResult sheets = + smartsheet.SheetResources.ListSheets( + new SheetInclusion[] { SheetInclusion.SOURCE }, + new PaginationParameters( + true, // includeAll + null, // int pageSize + null) // int page + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sheets \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Sample 1: Omit 'include' parameter and pagination parameters + + PagedResult sheets = smartsheet.sheetResources().listSheets( + null, // EnumSet includes + null, // PaginationParameters + null // Date modifiedSince + ); + + // Sample 2: Specify pagination parameter 'includeAll' + + PaginationParameters parameters = new PaginationParameters() + .setIncludeAll(true); + + // Specify 'include' parameter with value of "SOURCE", and + 'includeAll' parameter with value of 'true' + + PagedResult sheets = + smartsheet.sheetResources().listSheets(EnumSet.of(SourceInclusion.SOURCE), + parameters, modifiedSince); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.sheets.listSheets() + .then(function(sheetList) { + console.log(sheetList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List All + response = smartsheet_client.Sheets.list_sheets(include_all=True) + sheets = response.data + + # Sample 2: Paginate the list of sheets + response = smartsheet_client.Sheets.list_sheets( + page_size=10, + page=1) + pages = response.total_pages + sheets = response.data + post: + summary: Create Sheet in "Sheets" Folder + deprecated: true + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-03-25), this endpoint will be + removed.** + + + Creates a sheet from scratch or from the specified template in the + user's + + Sheets folder (Home). + + + For subfolders, use Create Sheet in Folder. + operationId: create-sheet-in-sheets-folder + tags: + - sheets + security: + - APIToken: [] + - OAuth2: + - CREATE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + - $ref: '#/components/parameters/include' + requestBody: + description: Sheet to create. + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/SheetToCreate' + - $ref: '#/components/schemas/SheetToCreateFromTemplate' + responses: + '200': + description: >- + Result object containing a Sheet object for newly created sheet, + corresponding to what was specified in the request. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + oneOf: + - $ref: '#/components/schemas/SheetCreated' + - $ref: '#/components/schemas/SheetCreatedFromTemplate' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Sample 1: Create sheet + + // Specify properties of the first column + + Column columnA = new Column + + { + Title = "Favorite", + Primary = false, + Type = ColumnType.CHECKBOX, + Symbol = Symbol.STAR + }; + + + // Specify properties of the second column + + Column columnB = new Column + + { + Title = "Primary Column", + Primary = true, + Type = ColumnType.TEXT_NUMBER + }; + + + // Create sheet in "Sheets" folder (specifying the 2 columns to + include in the sheet) + + Sheet newSheet = smartsheet.SheetResources.CreateSheet(new Sheet + + { + Name = "newsheet", + Columns = new Column[] { columnA, columnB } + } + + ); + + + // Sample 2: Create sheet from template + + // Specify name for the sheet and Id of the template + + Sheet sheetSpecification = new Sheet + + { + Name = "new sheet title", + FromId = 7679398137620356 // template Id + }; + + + // Option 1: Omit 'include' parameter + + Sheet newSheet = smartsheet.SheetResources.CreateSheetFromTemplate( + sheetSpecification, + null // IEnumerable include + ); + + + // Option 2: Include ATTACHMENTS, DATA, and DISCUSSIONS + + Sheet newSheet = smartsheet.SheetResources.CreateSheetFromTemplate( + sheetSpecification, + new TemplateInclusion[] { + TemplateInclusion.ATTACHMENTS, + TemplateInclusion.DATA, + TemplateInclusion.DISCUSSIONS } + ); + - lang: cURL + label: cURL + source: > + // Sample 1: Create sheet + + curl https://api.smartsheet.com/2.0/sheets \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d + '{"name":"newsheet","columns":[{"title":"Favorite","type":"CHECKBOX","symbol":"STAR"}, + {"title":"Primary Column", "primary":true,"type":"TEXT_NUMBER"}]}' + + + + // Sample 2: Create sheet from template + + curl + 'https://api.smartsheet.com/2.0/sheets?include=data,attachments,discussions' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '{"name":"newsheet", "fromId": templateId}' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Sample 1: Create sheet + + // Specify properties of the first column + + Column columnA = new Column() + .setTitle("Favorite") + .setType(ColumnType.CHECKBOX) + .setSymbol(Symbol.STAR); + + // Specify properties of the second column + + Column columnB = new Column() + .setTitle("Primary Column") + .setType(ColumnType.TEXT_NUMBER) + .setPrimary(true); + + // Create sheet in "Sheets" folder (specifying the 2 columns to + include in the sheet) + + Sheet newSheet = new Sheet(); + newSheet.setName("newsheet"); + newSheet.setColumns(Arrays.asList(columnA, columnB)); + + smartsheet.sheetResources().createSheet(newSheet); + + + // Sample 2: Create sheet from template + + // Specify name for the sheet and Id of the template + Sheet sheet = new Sheet(); + sheet.setFromId(7679398137620356L); // long templateId + sheet.setName("newsheet"); + + // Option 1: Omit 'include' parameter + Sheet results = smartsheet.sheetResources().createSheetFromTemplate(sheet, + null // EnumSet includes + ); + + // Option 2: Include ATTACHMENTS, DATA, and DISCUSSIONS + Sheet results = smartsheet.sheetResources().createSheetFromTemplate( + sheet, + EnumSet.of( + SheetTemplateInclusion.ATTACHMENTS, + SheetTemplateInclusion.DATA, + SheetTemplateInclusion.DISCUSSIONS) + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Sample 1: Create sheet + // Specify sheet properties + var sheet = { + "name": "newsheet", + "columns": [ + { + "title": "Favorite", + "type": "CHECKBOX", + "symbol": "STAR" + }, + { + "title": "Primary Column", + "primary": true, + "type": "TEXT_NUMBER" + } + ] + }; + + // Set options + var options = { + body: sheet + }; + + // Create sheet in "Sheets" folder + smartsheet.sheets.createSheet(options) + .then(function(newSheet) { + console.log(newSheet); + }) + .catch(function(error) { + console.log(error); + }); + + // Sample 2: Create sheet from template + // Specify the directive + var sheet = { + "fromId": 7679398137620356, + "name": "newsheet" + }; + + // Set options + var options = { + body: sheet + }; + + // Create sheet from template + smartsheet.sheets.createSheetFromExisting(options) + .then(function(newSheet) { + console.log(newSheet); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: Create sheet + sheet_spec = smartsheet.models.Sheet({ + 'name': 'newsheet', + 'columns': [{ + 'title': 'Favorite', + 'type': 'CHECKBOX', + 'symbol': 'STAR' + }, { + 'title': 'Primary Column', + 'primary': True, + 'type': 'TEXT_NUMBER' + } + ] + }) + response = smartsheet_client.Home.create_sheet(sheet_spec) + new_sheet = response.result + + # Sample 2: Create sheet from template + response = smartsheet_client.Home.create_sheet_from_template( + smartsheet.models.Sheet({ + 'name': 'newsheet', + 'from_id': 7679398137620356 # template_id + }) + ) + new_sheet = response.result + /sheets/import: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + post: + summary: Import Sheet from CSV / XLSX + deprecated: true + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-03-25), this endpoint will be + removed.** + + + Imports CSV or XLSX data into a new sheet in the top-level "Sheets" + folder. + + + Note the following: + + + * Both sheetName and the file name must use ASCII characters. + + + * The source data must be basic text. To include rich formula data, + import + + and create a sheet first, and then use Update Rows. To work with images, + see + + Cell Images. + + + * XLS is not supported. You must use XLSX. + + + * Hierarchical relationships between rows in an external file won't + import. + operationId: import-sheet-into-sheets-folder + tags: + - imports + security: + - APIToken: [] + - OAuth2: + - CREATE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Disposition' + - $ref: '#/components/parameters/parameters-Content-Type' + - $ref: '#/components/parameters/sheetName' + - $ref: '#/components/parameters/headerRowIndex' + - $ref: '#/components/parameters/primaryColumnIndex' + requestBody: + description: Binary content for the CSV / XLSX file. + content: + application/octet-stream: + schema: + type: string + format: binary + responses: + '200': + description: Result object containing a Sheet object for imported sheet. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/SheetImported' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Sheet sheet = smartsheet.SheetResources.ImportXlsSheet( + "D:/ProgressReport.xlsx", + null, // sheetName defaults to file name unless specified + 0, // headerRowIndex + null // primaryColumnIndex + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/import?sheetName=MarketingProgressReport&headerRowIndex=0&primaryColumnIndex=0 + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Disposition: attachment" \ + + -H "Content-Type: text/csv" \ + + -X POST \ + + --data-binary @ProgressReport.csv + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Sheet sheet = smartsheet.sheetResources().importXlsx( + "D:/ProgressReport.xlsx", + "MarketingProgressReport", + 0, // headerRowIndex + 0 // primaryColumnIndex + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Sample 1: Import sheet from CSV + // Set options + var options = { + queryParameters: { + sheetName: 'MarketingProgressReport' + }, + path: "D:/ProgressReport.csv" + }; + + // Import CSV as sheet + smartsheet.sheets.importCsvSheet(options) + .then(function(attachment) { + console.log(attachment); + }) + .catch(function(error) { + console.log(error); + }); + + // Sample 2: Import sheet from XLSX + // Set options + var options = { + queryParameters: { + sheetName: 'MarketingProgressReport' + }, + path: "D:/ProgressReport.xlsx" + }; + + // Import XLSX as sheet + smartsheet.sheets.importXlsxSheet(options) + .then(function(attachment) { + console.log(attachment); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + imported_sheet = smartsheet_client.Sheets.import_xlsx_sheet( + 'D:/ProgressReport.xlsx', + 'MarketingProgressReport', # sheet_name + header_row_index=0 + ) + /sheets/{sheetId}: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/sheetId' + get: + summary: Get Sheet + description: Gets a sheet in the format specified, based on the sheet Id. + operationId: getSheet + parameters: + - $ref: '#/components/parameters/Accept' + - $ref: '#/components/parameters/accessApiLevel' + - $ref: '#/components/parameters/parameters-sheetInclude' + - $ref: '#/components/parameters/sheetExclude' + - $ref: '#/components/parameters/sheetColumnIds' + - $ref: '#/components/parameters/sheetFilterId' + - $ref: '#/components/parameters/sheetIfVersionAfter' + - $ref: '#/components/parameters/sheetLevel' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/paperSize' + - $ref: '#/components/parameters/sheetRowIds' + - $ref: '#/components/parameters/sheetRowNumbers' + - $ref: '#/components/parameters/sheetRowsModifiedSince' + tags: + - sheets + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: The Sheet that was loaded. + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/Sheet' + - $ref: '#/components/schemas/SheetVersion' + application/pdf: + schema: + type: string + format: binary + description: The Sheet in PDF format. + application/vnd.ms-excel: + schema: + type: string + format: binary + description: The Sheet in Excel format. + text/csv: + schema: + type: string + format: binary + description: The Sheet in CSV format. + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Sample 1: Get sheet + // Omit all parameters + Sheet sheet = smartsheet.SheetResources.GetSheet( + 4583173393803140, // sheetId + null, // IEnumerable includes + null, // IEnumerable excludes + null, // IEnumerable rowIds + null, // IEnumerable rowNumbers + null, // IEnumerable columnIds + null, // Nullable pageSize + null // Nullable page + ); + + // Sample 2: Get sheet as Excel + smartsheet.SheetResources.GetSheetAsExcel( + 4583173393803140, // sheetId + outputStream + ); + + // Sample 3: Get sheet as PDF + smartsheet.SheetResources.GetSheetAsPDF( + 4583173393803140, // sheetId + outputStream, + PaperSize.A1 + ); + + // Sample 4: Get sheet as CSV + smartsheet.SheetResources.GetSheetAsCSV( + 4583173393803140, // sheetId + outputStream + ); + - lang: cURL + label: cURL + source: > + // Sample 1: Get sheet + + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}?level=2&include=objectValue + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + + + // Sample 2: Get sheet as Excel + + curl https://api.smartsheet.com/2.0/sheets/{sheetId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Accept: application/vnd.ms-excel" \ + + -o output.xlsx + + + // Sample 3: Get sheet as PDF + + curl 'https://api.smartsheet.com/2.0/sheets/{sheetId}?paperSize=A1' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Accept: application/pdf" + + -o output.pdf + + + // Sample 4: Get sheet as CSV + + curl https://api.smartsheet.com/2.0/sheets/{sheetId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Accept: text/csv" \ + + -o output.csv + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Sample 1: Get sheet + // Omit all parameters + Sheet sheet = smartsheet.sheetResources().getSheet( + 4583173393803140L, // long sheetId + null, // EnumSet includes + null, // EnumSet excludes + null, // Set rowIds + null, // Set rowNumbers + null, // Set columnIds + null, // Integer pageSize + null // Integer page + ); + + // Sample 2: Get sheet as Excel + smartsheet.sheetResources().getSheetAsExcel( + 4583173393803140L, // long sheetId + outputStream + ); + + // Sample 3: Get sheet as PDF + smartsheet.sheetResources().getSheetAsPDF( + 4583173393803140L, // long sheetId + outputStream, + PaperSize.A1 + ); + + // Sample 4: Get sheet as CSV + smartsheet.sheetResources().getSheetAsCSV( + 4583173393803140L, // long sheetId + outputStream + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Sample 1: Get sheet + // Set options + var options = { + id: 4583173393803140 // Id of Sheet + }; + + // Get sheet + smartsheet.sheets.getSheet(options) + .then(function(sheetInfo) { + console.log(sheetInfo); + }) + .catch(function(error) { + console.log(error); + }); + + // Sample 2: Get sheet as Excel + var fs = require("fs") + + // Set options + var options = { + id: 169681224483716 // Id of Sheet + }; + + // Get sheet + smartsheet.sheets.getSheetAsExcel(options) + .then(function(fileContents) { + // Write sheet to file + fs.writeFile('output.xlsx', fileContents, 'binary', (err) => { + if (err) throw err; + console.log('The sheet has been saved!'); + }); + }) + .catch(function(error) { + console.log(error); + }); + + // Sample 3: Get sheet as PDF + var fs = require("fs") + + // Set options + var options = { + id: 169681224483716 // Id of Sheet + }; + + // Get sheet + smartsheet.sheets.getSheetAsPDF(options) + .then(function(fileContents) { + // Write sheet to file + fs.writeFile('output.pdf', fileContents, 'binary', (err) => { + if (err) throw err; + console.log('The sheet has been saved!'); + }); + }) + .catch(function(error) { + console.log(error); + }); + + // Sample 4: Get sheet as CSV + var fs = require("fs") + + // Set options + var options = { + id: 4583173393803140 // Id of Sheet + }; + + // Get sheet + smartsheet.sheets.getSheetAsCSV(options) + .then(function(fileContents) { + // Write sheet to file + fs.writeFile('output.csv', fileContents, (err) => { + if (err) throw err; + console.log('The sheet has been saved!'); + }); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: Get sheet + sheet = smartsheet_client.Sheets.get_sheet( + 4583173393803140) # sheet_id + + # Sample 2: Get sheet as Excel + smartsheet_client.Sheets.get_sheet_as_excel( + 1531988831168388, # sheet_id + download_directory_path) + + # Sample 3: Get sheet as PDF + smartsheet_client.Sheets.get_sheet_as_pdf( + 1531988831168388, # sheet_id + download_directory_path, + 'A1') # paperSize + + # Sample 4: Get sheet as CSV + smartsheet_client.Sheets.get_sheet_as_csv( + 1531988831168388, # sheet_id + download_directory_path) + delete: + summary: Delete Sheet + description: Deletes the sheet specified in the URL. + operationId: deleteSheet + tags: + - sheets + security: + - APIToken: [] + - OAuth2: + - DELETE_SHEETS + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessResult' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.SheetResources.DeleteSheet( + 1531988831168388 // sheetId + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sheets/{sheetId} \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -X DELETE + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.sheetResources().deleteSheet( + 1531988831168388L // long sheetId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + id: 1531988831168388 // Id of Sheet + }; + + // Delete sheet + smartsheet.sheets.deleteSheet(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Sheets.delete_sheet( + 1531988831168388) # sheet_id + put: + summary: Update Sheet + description: >- + Updates the sheet specified in the URL. + + To modify sheet contents, see [Add + Rows](/api/smartsheet/openapi/rows/rows-addtosheet), [Update + Rows](/api/smartsheet/openapi/rows/update-rows), [Add + Columns](/api/smartsheet/openapi/columns/columns-addtosheet), and + [Update Column](/api/smartsheet/openapi/columns/column-updatecolumn). + + This operation can be used to update an individual user's sheet + settings. If the request body contains only the **userSettings** + attribute, this operation may be performed even if the user only has + read-only access to the sheet (for example, the user has viewer + permissions or the sheet is read-only). + operationId: updateSheet + parameters: + - $ref: '#/components/parameters/accessApiLevel' + tags: + - sheets + security: + - APIToken: [] + - OAuth2: + - ADMIN_SHEETS + requestBody: + description: > + [Sheet object](/api/smartsheet/openapi/sheets/sheet) limited to the + following attributes: + + * **name** (optional). + + * **projectSettings** (optional): [ProjectSettings + object](/api/smartsheet/openapi/schemas/projectsettings), containing + at least one of the **projectSettings** attributes, for updating this + sheet's project settings and dependencies. + + * **userSettings** (optional): [SheetUserSettings + object](/api/smartsheet/openapi/schemas/sheetusersettings) for + updating these user's settings for the sheet. + + NOTE: + + * Attributes not specified in **projectSettings** are not updated. + + * If **projectSettings.nonWorkingDays** is specified as an empty + array, all non-working days are removed from the project sheet. + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateSheet' + responses: + '200': + description: >- + Returns [Result object](/api/smartsheet/openapi/schemas/result) + containing a [Sheet object](/api/smartsheet/openapi/sheets/sheet) + for the updated sheet. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Sheet' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify updated sheet properties + + Sheet sheetSpecification = new Sheet + + { + Id = 4583173393803140, + Name = "New Sheet Name", + UserSettings = new SheetUserSettings{CriticalPathEnabled = true} + }; + + + // Update sheet + + Sheet updatedSheet = + smartsheet.SheetResources.UpdateSheet(sheetSpecification); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sheets/{sheetId} \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" \ + -X PUT \ + -d '{"name":"New Sheet Name", + "userSettings": {"criticalPathEnabled": true}, + "projectSettings":{ + "workingDays": ["MONDAY", "TUESDAY", "WEDNESDAY"], + "nonWorkingDays": ["2018-01-01"], + "lengthOfDay": 6 + } \ + }' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify updated sheet properties + + Sheet sheetSpecification = new Sheet(); + + sheetSpecification.setUserSettings(new + SheetUserSettings().setCriticalPathEnabled(true)) + .setName("New Sheet Name") + .setId(7960873114331012L); + + // Update sheet + + Sheet updatedSheet = + smartsheet.sheetResources().updateSheet(sheetSpecification); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify updated sheet properties + var sheet = { + "name": "New Sheet Name", + "userSettings": { + "criticalPathEnabled": true, + } + }; + + // Set options + var options = { + id: 7960873114331012, // Id of Sheet + body: sheet + }; + + // Update sheet + smartsheet.sheets.updateSheet(options) + .then(function(updatedSheet) { + console.log(updatedSheet); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + updated_sheet = smartsheet_client.Sheets.update_sheet( + 4583173393803140, # sheet_id + smartsheet.models.Sheet({ + 'name': 'New Sheet Name', + 'user_settings': smartsheet.models.SheetUserSettings({ + 'critical_path_enabled': True + }) + }) + ) + /sheets/{sheetId}/attachments: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Attachments + description: > + Gets a list of all attachments that are on the sheet, including sheet, + row, and discussion-level attachments. + operationId: attachments-listOnSheet + tags: + - attachments + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/includeAll' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: list of attachments + type: array + items: + $ref: '#/components/schemas/Attachment' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PaginatedResult attachments = + smartsheet.SheetResources.AttachmentResources.ListAttachments( + 9283173393803140, // sheetId + null // PaginationParameters + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/attachments \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination + + PagedResult attachments = + smartsheet.sheetResources().attachmentResources().listAttachments( + 9283173393803140L, // long sheetId + null // PaginationParameters + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 9283173393803140 + }; + + // List attachments + smartsheet.sheets.listAttachments(options) + .then(function(attachmentsList) { + console.log(attachmentsList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List All + response = smartsheet_client.Attachments.list_all_attachments( + 9283173393803140, # sheet_id + include_all=True) + attachments = response.data + + # Sample 2: Paginate the list of attachments + response = smartsheet_client.Attachments.list_all_attachments( + 9283173393803140, # sheet_id + page_size=10, + page=1) + pages = response.total_pages + attachments = response.data + post: + summary: Attach File or URL to Sheet + description: > + Attaches a file to the sheet. The URL can be any of the following: + + + * Normal URL (attachmentType "LINK") + + * Box.com URL (attachmentType "BOX_COM") + + * Dropbox URL (attachmentType "DROPBOX") + + * Egnyte URL (attachmentType "EGNYTE") + + * Evernote URL (attachmentType "EVERNOTE") + + * Google Drive URL (attachmentType "GOOGLE_DRIVE") + + * OneDrive URL (attachmentType "ONEDRIVE") + + + > **Important:** Smartsheet Gov allows only the following attachment + types: + + > - BOX_COM + + > - FILE + + > - GOOGLE_DRIVE + + > - LINK + + > - ONEDRIVEß + + + For multipart uploads please use "multipart/form-data" content type. + + + > **Note:** Posting a file attachment is resource-intensive and is + limited to **30 requests per minute per API token**. For details, see + [Rate + limiting](/api/smartsheet/guides/advanced-topics/scalability-options#rate-limiting). + operationId: attachments-attachToSheet + tags: + - attachments + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/octet-stream: + schema: + type: string + format: binary + multipart/form-data: + schema: + type: object + properties: + name: + type: string + filename: + type: string + format: binary + application/json: + schema: + $ref: '#/components/schemas/URLAttachmentRequest' + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Attachment' + properties: + version: + description: >- + New version of the sheet. Applicable only for operations + which update sheet data. + type: number + nullable: true + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + Attachment attachment = + smartsheet.SheetResources.AttachmentResources.AttachFile( + 9283173393803140, // sheetId + filePath, + "application/msword" + ); + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/attachments \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/msword" \ + + -H 'Content-Disposition: attachment; filename="ProgressReport.docx"' + \ + + -H "Content-Length: FILE_SIZE" \ + + -X POST \ + + --data-binary @ProgressReport.docx + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify file to be attached + File file = new File("/Users/jdoe/Documents/ProgressReport.docx"); + + // Attach file to sheet + Attachment attachment = smartsheet.sheetResources().attachmentResources().attachFile( + 9283173393803140L, // long sheetId + file, + "application/msword" + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Enable FileStream + var fs = require("fs") + + // Set options + var options = { + sheetId: 1694401624483716, + fileSize: 20765, + fileName: "ProgressReport.docx", + fileStream: fs.createReadStream("/Users/jdoe/Documents/ProgressReport.docx") + }; + + // Attach file to sheet + smartsheet.sheets.addFileAttachment(options) + .then(function(attachment) { + console.log(attachment); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + updated_attachment = + smartsheet_client.Attachments.attach_file_to_sheet( + 9283173393803140, # sheet_id + ('ProgressReport.docx', + open('/path/to/ProgressReport.docx', 'rb'), + 'application/msword') + ) + /sheets/{sheetId}/attachments/{attachmentId}: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/attachmentId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Get Attachment + description: > + Fetches a temporary URL that allows you to download an attachment. The + urlExpiresInMillis attribute tells you how long the URL is valid. + operationId: attachments-get + tags: + - attachments + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Attachment' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + Attachment attachment = + smartsheet.SheetResources.AttachmentResources.GetAttachment( + 9283173393803140, // sheetId + 4583173393803140 // attachmentId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/attachments/{attachmentId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + Attachment attachment = + smartsheet.sheetResources().attachmentResources().getAttachment( + 9283173393803140L, // long sheetId + 4583173393803140L // long attachmentId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 9283173393803140, + attachmentId: 4583173393803140 + }; + + // Get attachment + smartsheet.sheets.getAttachment(options) + .then(function(attachment) { + console.log(attachment); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + attachment = smartsheet_client.Attachments.get_attachment( + 9283173393803140, # sheet_id + 4583173393803140) # attachment_id + delete: + summary: Delete Attachment + description: | + Deletes the attachment specified in the URL. + operationId: attachments-delete + tags: + - attachments + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + $ref: '#/components/schemas/GenericResult' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.SheetResources.AttachmentResources.DeleteAttachment( + 9283173393803140, // sheetId + 7169782752536452 // attachmentId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/attachments/{attachmentId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.sheetResources().attachmentResources().deleteAttachment( + 9283173393803140L, // long sheetId + 7169782752536452L // sheetAttachmentId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 2252168947361668, + attachmentId: 7169782752536452, + }; + + // Delete attachment + smartsheet.sheets.deleteAttachment(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Attachments.delete_attachment( + 9283173393803140, # sheet_id + 7169782752536452) # attachment_id + /sheets/{sheetId}/attachments/{attachmentId}/versions: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/attachmentId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Versions + description: > + Gets a list of all versions of the given attachmentId in order from + newest to oldest. + operationId: attachments-versionList + tags: + - attachments + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/includeAll' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: list of attachments + type: array + items: + $ref: '#/components/schemas/Attachment' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PaginatedResult attachments = + smartsheet.SheetResources.AttachmentResources.VersioningResources.ListVersions( + 2252168947361668, // sheetId + 5510069950408580, // attachmentId + null // PaginationParameters + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/attachments/{attachmentId}/versions + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination + + PagedResult attachments = + smartsheet.sheetResources().attachmentResources().versioningResources().listAllVersions( + 2252168947361668L, // long sheetId + 5510069950408580L, // long attachmentId + null // PaginationParameters + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 2252168947361668, + attachmentId: 5510069950408580 + }; + + // List versions of the attachment + smartsheet.sheets.listAttachmentVersions(options) + .then(function(versionList) { + console.log(versionList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List all + response = smartsheet_client.Attachments.list_attachment_versions( + 2252168947361668, # sheet_id + 5510069950408580, # attachment_id + include_all=True) + versions = response.data + + # Sample 2: Paginate the list + response = smartsheet_client.Attachments.list_attachment_versions( + 2252168947361668, # sheet_id + 5510069950408580, # attachment_id + page_size=5, + page=1) + pages = response.total_pages + versions = response.data + post: + summary: Attach New version + description: > + Uploads a new version of a file to a sheet or row. This operation can be + performed using a simple upload or a multipart upload. + operationId: attachments-versionUpload + tags: + - attachments + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/octet-stream: + schema: + type: string + format: binary + multipart/form-data: + schema: + type: object + properties: + name: + type: string + filename: + type: string + format: binary + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Attachment' + properties: + version: + description: >- + New version of the sheet. Applicable only for operations + which update sheet data. + type: number + nullable: true + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + Attachment attachment = + smartsheet.SheetResources.AttachmentResources.VersioningResources.AttachNewVersion( + 9283173393803140, // sheetId + 0123456789123456, // attachmentId + filePath, + "application/msword" + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/attachments/{attachmentId}/versions + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/msword" \ + + -H 'Content-Disposition: attachment; filename="ProgressReport.docx"' + \ + + -H "Content-Length: FILE_SIZE" \ + + -X POST \ + + --data-binary @ProgressReport.docx + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify the new file to be attached + File file = new File("/Users/jdoe/Documents/ProgressReport.docx"); + + // Attach new version of the file + Attachment attachment = smartsheet.sheetResources().attachmentResources().versioningResources().attachNewVersion( + 9283173393803140L, // long sheetId + 0123456789123456L, // long attachmentId + file, + "application/msword" + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Enable FileStream + var fs = require("fs") + + // Set options + var options = { + sheetId: 9283173393803140, + attachmentId: 0123456789123456, + fileSize: 17291, + fileName: "ProgressReport.docx", + fileStream: fs.createReadStream("/Users/jdoe/Documents/ProgressReport.docx") + }; + + // Attach new version + smartsheet.sheets.attachNewVersion(options) + .then(function(updatedAttachment) { + console.log(updatedAttachment); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + response = smartsheet_client.Attachments.attach_new_version( + 9283173393803140, # sheet_id + 0123456789123456, # attachment_id + ('ProgressReport.docx', + open('/path/to/ProgressReport.docx', 'rb'), + 'application/msword') + ) + + updated_attachment = response.result + delete: + summary: Delete All Versions + description: > + Deletes all versions of the attachment corresponding to the specified + attachmentId. For attachments with + + multiple versions, this effectively deletes the attachment from the + object that it’s attached to. + operationId: attachments-versionsDelete + tags: + - attachments + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + $ref: '#/components/schemas/GenericResult' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + smartsheet.SheetResources.AttachmentResources.VersioningResources.DeleteAllVersions( + 9283173393803140, // sheetId + 0123456789123456 // attachmentId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/attachments/{attachmentId}/versions + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + smartsheet.sheetResources().attachmentResources().versioningResources().deleteAllVersions( + 9283173393803140L, // long sheetId + 0123456789123456L // long attachmentId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 2252168947361668, + attachmentId: 5510069950408580 + }; + + // Delete all versions of the attachment + smartsheet.sheets.deleteAllAttachmentVersions(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Attachments.delete_attachment_versions( + 9283173393803140, # sheet_id + 0123456789123456) # attachment_id + /sheets/{sheetId}/automationrules: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + operationId: automationrules-list + summary: List All Automation Rules + description: > + Returns all automation rules associated with the specified sheet. + + + Multistep workflows are not returned via the API. + + Instead, you'll see an error 400 - 1266: This rule is not accessible + through the API. + + Only single-action notifications, approval requests, or update requests + qualify. + + + For users of Smartsheet for Slack, note that Slack notifications are not + returned. + tags: + - automationRules + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: The list of AutomationRule objects + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: list of Automation Rules + type: array + items: + $ref: '#/components/schemas/AutomationRule' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + PaginatedResult AutomationRules = + smartsheet.SheetResources.AutomationRuleResources.ListAutomationRules( + 9283173393803140, // sheetId + null // PaginationParameters + ); + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/automationrules + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 9283173393803140 + }; + + // List automation rules + smartsheet.sheets.listAutomationRules(options) + .then(function(automationRulesList) { + console.log(automationRulesList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List All + response = smartsheet_client.Sheets.list_automation_rules( + 9283173393803140, # sheet_id + include_all=True) + automation_rules = response.data + + # Sample 2: Paginate the list of automation rules + response = smartsheet_client.Sheets.list_automation_rules( + 9283173393803140, # sheet_id + page_size=10, + page=1) + pages = response.total_pages + automation_rules = response.data + /sheets/{sheetId}/automationrules/{automationRuleId}: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/automationRuleId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Get an Automation Rule + description: | + Returns the specified automation rule, including any action values. + operationId: automationrule-get + tags: + - automationRules + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: AutomationRule object + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/AutomationRule' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + AutomationRule automationRule = + smartsheet.SheetResources.GetAutomationRule( + 9283173393803140, // sheetId + 789994550205316 // automationRuleId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/automationrules/{automationRuleId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 9283173393803140, + automationRuleId: 789994550205316 + }; + + // Get automation rule + smartsheet.sheets.getAutomationRule(options) + .then(function(automationRule) { + console.log(automationRule); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + automation_rule = smartsheet_client.Sheets.get_automation_rule( + 4478580756375428, # sheet_id + 4220838007334788) # automation_rule_id + put: + summary: Update an Automation Rule + description: > + Updates an existing automation rule. + + + When sending an AutomationRule, you must always specify **action.type** + and it must match the existing rule type. + operationId: automationrule-update + tags: + - automationRules + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AutomationRule' + responses: + '200': + description: Result object containing the updated AutomationRule object + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + properties: + result: + $ref: '#/components/schemas/AutomationRule' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Set recipient + + Recipient recipient = new Recipient + + { + Email = "jane.roe@smartsheet.com" + }; + + + // Specify the changes + + AutomationRule autoRule = new AutomationRule + + { + Id = 789994550205316, + Action = new AutomationAction + { + Recipients = new[] { recipient }, + Type = AutomationActionType.NOTIFICATION_ACTION, + Frequency = AutomationActionFrequency.WEEKLY + } + }; + + + // Update the automation rule + + AutomationRule automationRule = + smartsheet.SheetResources.UpdateAutomationRule( + 4583173393803140, // sheetId + autoRule + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/automationrules/{automationRuleId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X PUT \ + + -d '{ + "action": { + "type": "APPROVAL_REQUEST_ACTION", + "recipients": [{ + "email": "jane.roe@smartsheet.com" + }], + "frequency": "WEEKLY" + } + }' + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify the changes + var body = { + "name": "Approval Request", + "action": { + "type": "APPROVAL_REQUEST_ACTION", + "recipients": [ + { + "email": "jane.roe@smartsheet.com" + } + ], + "frequency": "WEEKLY", + "includeAllColumns": true, + "includeAttachments": true, + "includeDiscussions": true, + "notifyAllSharedUsers": false + } + }; + + // Set options + var options = { + sheetId: 4583173393803140, + automationRuleId: 789994550205316, + body: body + }; + + // Update the automation rule + smartsheet.sheets.updateAutomationRule(options) + .then(function(updatedAutomationRule) { + console.log(updatedAutomationRule); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + automation_spec = smartsheet.models.AutomationRule({ + 'enabled': False, # Disable Automation Rule + 'name': 'New Name', # Change Name of Automation Rule + 'action': { + 'type': 'NOTIFICATION_ACTION' # Action/Type must always be included + } + }) + + response = smartsheet_client.Sheets.update_automation_rule( + 4478580756375428, # sheet_id + 4220838007334788, # automation_rule_id + automation_spec) + + updated_automation = response.result + delete: + summary: Delete an Automation Rule + description: | + Deletes an automation rule. + operationId: automationrule-delete + tags: + - automationRules + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + responses: + '200': + description: Result object + content: + application/json: + schema: + $ref: '#/components/schemas/Result' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + AutomationRule automationRule = + smartsheet.SheetResources.AutomationRuleResources.DeleteAutomationRule( + 9283173393803140, // sheetId + 789004550205316 // automationRuleId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/automationrules/{automationRuleId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 9283173393803140, + automationRuleId: 789004550205316 + }; + + // Delete automation rule + smartsheet.sheets.deleteAutomationRule(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Sheets.delete_automation_rule( + 4478580756375428, # sheet_id + 4220838007334788) # automation_rule_id + /sheets/{sheetId}/columns: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Columns + description: Gets a list of all columns belonging to the sheet specified in the URL. + operationId: columns-listOnSheet + parameters: + - $ref: '#/components/parameters/columnsLevel' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/includeAll' + tags: + - columns + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: >- + Returns [IndexResult object]() containing an array of [Column + objects](). + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/GetColumn' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit 'include' parameter and pagination parameters + + PaginatedResult columns = + smartsheet.SheetResources.ColumnResources.ListColumns( + 9283173393803140, // sheetId + null, // IEnumerable include + null, // PaginationParameters + 2 // int compatibilityLevel + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/columns \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit 'include' parameter and pagination parameters + + PagedResult columns = + smartsheet.sheetResources().columnResources().listColumns( + 9283173393803140L, // long sheetId + null, // EnumSet includes + null // PaginationParameters + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 9283173393803140 + }; + + // List columns + smartsheet.sheets.getColumns(options) + .then(function(columnList) { + console.log(columnList); + }) + .catch(function(error) { + console.log(error); + }); + post: + summary: Add Columns + description: >- + Inserts one or more columns into the sheet specified in the URL.This + operation can be performed using a [simple + upload](/api/smartsheet/openapi/attachments) or a [multipart + upload](/api/smartsheet/openapi/attachments). For more information, see + [Post an Attachment](/api/smartsheet/openapi/attachments). + operationId: columns-addToSheet + tags: + - columns + security: + - APIToken: [] + - OAuth2: + - ADMIN_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + description: | + A [Column object]() that contains the following attributes + * **title** + * **type** + * **formula** (optional) + * **index** (zero-based) + * **autoNumberFormat** (optional) + * **description** (optional) + * **locked**(optional) + * **options** (optional) + * **symbol** (optional) + * **systemColumnType** (optional) + * **validation** (optional) + * **width** (optional) + + **NOTES:** + * When setting a column type of PICKLIST or MULTI_PICKLIST, you must follow a one operation per API call rule. For these column types, you must set the column type first, and then add any additional constraints in a second call, such as setting *validation* to *true*. + * When creating more than one column at a time, you cannot designate multiple index locations. Use one common index as the starting point. For example, designate the primary column as "1". + content: + application/json: + schema: + $ref: '#/components/schemas/ColumnObjectAttributes' + responses: + '200': + description: >- + Returns [Result object](/api/smartsheet/openapi/schemas/result) + containing the newly created columns -- either a single [Column + object](/api/smartsheet/openapi/columns/column) or an array of + Column objects, corresponding to what was specified in the request. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + type: array + items: + $ref: '#/components/schemas/AddColumns' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Create a column + + Column columnA = new Column + + { + Title = "This is a new multi-picklist column", + Index = 0, + Type = ColumnType.MULTI_PICKLIST, + Options = new string[] { "Cat", "Rat", "Bat" } + }; + + + // Create another column + + Column columnB = new Column + + { + Title = "New Date Column", + Index = 4, + Type = ColumnType.DATE + }; + + + // Add columns to the sheet + + IList addedColumns = + smartsheet.SheetResources.ColumnResources.AddColumns( + 2252168947361668, // sheet Id + new Column[] { columnA, columnB } + ); + - lang: cURL + label: cURL + source: "curl https://api.smartsheet.com/2.0/sheets/{sheetId}/columns \\\n-H \"Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789\" \\\n-H \"Content-Type: application/json\" \\\n-X POST \\\n-d '[{\"title\": \"New Multi-Picklist Column 1\", \"type\": \"MULTI_PICKLIST\", \"options\": [\"First\", \"Second\", \"Third\"], \"index\": 4} , {\"title\":\"New Date Column\", \"type\":\"DATE\", \"formula\": \"=data@row\", \"validation\":\"true\", \"index\":4},]' \\\n-d '[{\"index\": 6, \"title\": \"Dropdown Multi Select\", \"type\": \"MULTI_PICKLIST\", \"options\": [\"Template\", \"Blog\",\t\"Newsletter\",\t\"Email\", \"Press Release\", \"Advertisement\"],\t\"validation\": false, \"width\": 150}]'\n" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Create columns + Column column1 = new Column() + .setTitle("New Multi-Picklist Column 1") + .setType(ColumnType.MULTI_PICKLIST) + .setIndex(4) + .setOptions(Arrays.asList("First", "Second", "Third")); + + Column column2 = new Column() + .setTitle("New Date Column") + .setType(ColumnType.DATE) + .setFormula("=data@row") + .setValidation(true) + .setIndex(4); + + // Add columns to the sheet + List newColumns = smartsheet.sheetResources().columnResources().addColumns( + 2252168947361668L, // long sheetId + Arrays.asList(column1, column2) + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify new columns + var column = [ + { + "title": "New Picklist Column 1", + "type": "PICKLIST", + "options": [ + "First", + "Second", + "Third" + ], + "index": 4 + }, + { + "title": "New Date Column", + "type": "DATE", + "formula": "=data@row", + "validation": true, + "index": 4 + } + ]; + + // Set options + var options = { + sheetId: 2252168947361668, + body: column + }; + + // Add columns to the sheet + smartsheet.sheets.addColumn(options) + .then(function(newColumns) { + console.log(newColumns); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Create the columns + column1 = smartsheet.models.Column({ + 'title': 'New Picklist Column 1', + 'type': 'PICKLIST', + 'options': [ + 'First', + 'Second', + 'Third' + ], + 'index': 4 + }) + + column2 = smartsheet.models.Column({ + 'title': 'New Date Column', + 'type': 'DATE', + 'formula': '=data@row', + 'validation': 'True', + 'index': 4 + }) + + # Add columns to the sheet + new_columns = smartsheet_client.Sheets.add_columns( + 2252168947361668, # sheet_id + [column1, column2]) + /sheets/{sheetId}/columns/{columnId}: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/columnId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Get Column + description: >- + Gets definitions for the column specified in the URL. **Note:** If you + need to see the values of individual cells within the column, use [Get + Sheet](#operation/getSheet) or [Get Row](#operation/row-get). + operationId: column-get + parameters: + - $ref: '#/components/parameters/sheetLevel' + tags: + - columns + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GetColumn' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Sample 1: Omit 'include' parameter + Column column = smartsheet.SheetResources.ColumnResources.GetColumn( + 9283173393803140, // sheetId + 7960873114331012, // columnId + null // IEnumerable includes + ); + + // Sample 2: Specify 'include' parameter with value of "FILTERS" + Column column = smartsheet.SheetResources.ColumnResources.GetColumn( + 9283173393803140, // sheetId + 7960873114331012, // columnId + new ColumnInclusion[] { ColumnInclusion.FILTERS } + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/columns/{columnId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Sample 1: Omit 'include' parameter + + Column column = + smartsheet.sheetResources().columnResources().getColumn( + 9283173393803140L, // long sheetId + 7960873114331012L, // long columnId + null // EnumSet includes + ); + + // Sample 2: Specify 'include' parameter with value of "FILTERS" + Column column = smartsheet.sheetResources().columnResources().getColumn( + 9283173393803140L, // long sheetId + 7960873114331012L, // long columnId + EnumSet.of(ColumnInclusion.FILTERS) + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 9283173393803140, + columnId: 7960873114331012 + }; + + // Get column + smartsheet.sheets.getColumns(options) + .then(function(column) { + console.log(column); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + column = smartsheet_client.Sheets.get_column( + 9283173393803140, # sheet_id + 7960873114331012, # column_id + level=1) + delete: + summary: Delete Column + description: Deletes the column specified in the URL. + operationId: column-delete + tags: + - columns + security: + - APIToken: [] + - OAuth2: + - ADMIN_SHEETS + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + $ref: '#/components/schemas/GenericResult' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.SheetResources.ColumnResources.DeleteColumn( + 9283173393803140, // sheetId + 0123456789012345 // columnId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/columns/{columnId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.sheetResources().columnResources().deleteColumn( + 9283173393803140L, // long sheetId + 0123456789012345L // long columnId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 9283173393803140, + columnId: 0123456789012345 + }; + + // Delete column + smartsheet.sheets.deleteColumn(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Sheets.delete_column( + 9283173393803140, # sheet_id + 0123456789012345) # column_id + put: + summary: Update Column + description: > + Updates properties of the column, moves the column, or renames the + column. + + + **Note:** + + * You cannot change the type of a Primary column. + + * While dependencies are enabled on a sheet, you can't change the type + of any special calendar/Gantt columns. + + * If the column type is changed, all cells in the column are converted + to the new column type and column validation is cleared. + + * Type is optional when moving or renaming, but required when changing + type or dropdown values. + operationId: column-updateColumn + tags: + - columns + security: + - APIToken: [] + - OAuth2: + - ADMIN_SHEETS + requestBody: + description: > + A [Column object]() that contains the following attributes: + * **index** + * **autoNumberFormat** (optional) + * **contactOptions** (optional) -- must have set column type to CONTACT_LIST + * **description** (optional) + * **format** (optional) + * **formula** (optional) + * **hidden**(optional) + * **locked** (optional) + * **options** (optional) + * **symbol** (optional) + * **systemColumnType** (optional) + * **title** (optional) + * **type** (optional) + * **validation** (optional) + * **width** (optional) + + **Note:** When setting a column type of PICKLIST or MULTI_PICKLIST, + you must follow a one operation per API call rule. For these column + types, you must set the column type first, and then add any additional + constraints in a second call, such as setting *validation* to *true*. + content: + application/json: + schema: + $ref: '#/components/schemas/ColumnObjectAttributes' + responses: + '200': + description: >- + Returns [Result object](/api/smartsheet/openapi/schemas/result) + containing the [Column + object](/api/smartsheet/openapi/columns/column) that was modified. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/UpdateColumn' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify column properties + + Column columnSpecification = new Column + + { + Id = 5005385858869124, + Title = "First Column", + Index = 0, + Type = ColumnType.PICKLIST, + Options = new string[] { "One", "Two"} + }; + + + // Update column + + Column updatedColumn = + smartsheet.SheetResources.ColumnResources.UpdateColumn( + 2252168947361668, // sheetId + columnSpecification + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/columns/{columnId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X PUT \ + + -d '{"title": "New multi-select dropdown column", "index": 0, + "type": "MULTI_PICKLIST", "options": ["One", "Two"]}' + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify column properties + Column columnSpecification = new Column(5005385858869124L) + .setTitle("First Column") + .setIndex(0) + .setType(ColumnType.PICKLIST) + .setOptions(Arrays.asList("One", "Two")); + + // Update column + Column updatedColumn = smartsheet.sheetResources().columnResources().updateColumn( + 2252168947361668L, // sheetId + columnSpecification + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify column properties + var column = { + "index": 0, + "title": "First Column", + "type": "PICKLIST", + "options": ["One", "Two"] + }; + + // Set options + var options = { + sheetId: 2252168947361668, + columnId: 5005385858869124, + body: column + }; + + // Update column + smartsheet.sheets.updateColumn(options) + .then(function(updatedColumn) { + console.log(updatedColumn); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Specify column properties + column_spec = smartsheet.models.Column({ + 'title': 'First Column', + 'type': 'PICKLIST', + 'options': ["One", "Two"], + 'index': 0 + }) + + # Update column + response = smartsheet_client.Sheets.update_column( + 2252168947361668, # sheet_id + 5005385858869124, # column_id + column_spec) + + updated_column = response.result + /sheets/{sheetId}/comments/{commentId}: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/commentId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Get a comment + description: | + Gets the comment specified by commentId. + operationId: comment-get + tags: + - comments + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Comment' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + Comment comment = + smartsheet.SheetResources.CommentResources.GetComment( + 2252168947361668, // sheetId + 48569348493401200 // commentId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/comments/{commentId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + Comment comment = + smartsheet.sheetResources().commentResources().getComment( + 2252168947361668L, // long sheetId + 4856934849340120L // long commentId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 2252168947361668, + commentId: 48569348493401200 + }; + + // Get comment + smartsheet.sheets.getComment(options) + .then(function(comment) { + console.log(comment); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + comment = smartsheet_client.Discussions.get_discussion_comment( + 2252168947361668, # sheet_id + 4856934849340120 # comment_id + ) + put: + summary: Edit a comment + description: > + Updates the text of a comment. NOTE: Only the user that created the + comment is permitted to update it. + operationId: comment-edit + tags: + - comments + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CommentCreationRequest' + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Comment' + properties: + version: + description: >- + New version of the Sheet. Applicable only for operations + which update sheet data. + type: number + nullable: true + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify edited comment properties + + Comment commentSpecification = new Comment + + { + Id = 7144101943502724, + Text = "This is the updated comment text" + } + + + // Edit comment + + Comment updatedComment = + smartsheet.SheetResources.DiscussionResources.CommentResources.UpdateComment( + 3285357287499652, // sheetId + commentSpecification + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/comments/{commentId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X PUT \ + + -d '{"text":"This is the updated comment text."}' + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify text + var body = { + text: "This is the updated comment text." + }; + + // Set options + var options = { + sheetId: 3285357287499652, + commentId: 7144101943502724, + body: body + }; + + // Edit comment + smartsheet.sheets.editComment(options) + .then(function(updatedComment) { + console.log(updatedComment); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + comment = smartsheet_client.Discussions.update_comment( + 3285357287499652, # sheet_id + 7144101943502724, # comment_id + smartsheet.models.Comment({ + 'text': 'This is the updated comment text'})) + delete: + summary: Delete a comment + description: | + Deletes the comment specified in the URL. + operationId: comment-delete + tags: + - comments + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + properties: + version: + description: >- + New version of the Sheet. Applicable only for operations + which update sheet data. + type: number + nullable: true + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.SheetResources.CommentResources.DeleteComment( + 2252168947361668, // sheetId + 4952999001909124 // commentId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/comments/{commentId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X 'DELETE' + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.sheetResources().commentResources().deleteComment( + 2252168947361668L, // long sheetId + 4952999001909124L // long commentId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 2252168947361668, + commentId: 4952999001909124 + }; + + // Delete comment + smartsheet.sheets.deleteComment(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Discussions.delete_discussion_comment( + 2252168947361668, # sheet_id + 4952999001909124) # comment_id + /sheets/{sheetId}/comments/{commentId}/attachments: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/commentId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + post: + summary: Attach File or URL to Comment + description: > + Attaches a file to the comment. The URL can be any of the following: + + + * Normal URL (attachmentType "LINK") + + * Box.com URL (attachmentType "BOX_COM") + + * Dropbox URL (attachmentType "DROPBOX") + + * Egnyte URL (attachmentType "EGNYTE") + + * Evernote URL (attachmentType "EVERNOTE") + + * Google Drive URL (attachmentType "GOOGLE_DRIVE") + + * OneDrive URL (attachmentType "ONEDRIVE") + + + > **Important:** Smartsheet Gov allows only the following attachment + types: + + > - BOX_COM + + > - FILE + + > - GOOGLE_DRIVE + + > - LINK + + > - ONEDRIVEß + + + This operation can be performed using a simple upload or a multipart + upload. + + + > **Note:** Posting a file attachment is resource-intensive and is + limited to **30 requests per minute per API token**. For details, see + [Rate + limiting](/api/smartsheet/guides/advanced-topics/scalability-options#rate-limiting). + operationId: attachments-attachToComment + tags: + - attachments + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/octet-stream: + schema: + type: string + format: binary + multipart/form-data: + schema: + type: object + properties: + name: + type: string + filename: + type: string + format: binary + application/json: + schema: + $ref: '#/components/schemas/URLAttachmentRequest' + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Attachment' + properties: + version: + description: >- + New version of the sheet. Applicable only for operations + which update sheet data. + type: number + nullable: true + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + Attachment attachment = + smartsheet.SheetResources.CommentResources.AttachmentResources.AttachFile( + 9283173393803140, // sheetId + 1234567890234568, // commentId + filePath, + "application/msword" + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/comments/{commentId}/attachments + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/msword" \ + + -H 'Content-Disposition: attachment; filename="ProgressReport.docx"' + \ + + -H "Content-Length: FILE_SIZE" \ + + -X POST \ + + --data-binary @ProgressReport.docx + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify file to be attached + File file = new File("/Users/jdoe/Documents/ProgressReport.docx"); + + // Attach file to comment + Attachment attachment = smartsheet.sheetResources().commentResources().attachmentResources().attachFile( + 9283173393803140L, // long sheetId + 1234567890234568L, // long commentId + file, + "application/msword" + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Enable FileStream + var fs = require("fs") + + // Set options + var options = { + sheetId: 1696803624483716, + commentId: 7722333183016324, + fileSize: 20765, + fileName: "ProgressReport.docx", + fileStream: fs.createReadStream("/Users/jdoe/Documents/ProgressReport.docx") + }; + + // Attach file to comment + smartsheet.sheets.addCommentFileAttachment(options) + .then(function(attachment) { + console.log(attachment); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + updated_attachment = + smartsheet_client.Attachments.attach_file_to_comment( + 9283173393803140, # sheet_id + 1234567890234568, # comment_id + ('ProgressReport.docx', + open('/path/to/ProgressReport.docx', 'rb'), + 'application/msword') + ) + /sheets/{sheetId}/copy: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/Content-Type' + - $ref: '#/components/parameters/sheetCopyInclude' + - $ref: '#/components/parameters/sheetCopyExclude' + post: + summary: Copy Sheet + description: | + Creates a copy of the specified sheet. + operationId: copy-sheet + tags: + - sheets + security: + - APIToken: [] + - OAuth2: + - CREATE_SHEETS + requestBody: + description: Destination where to create a copy of the specified sheet. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerDestinationForCopy' + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + properties: + result: + $ref: '#/components/schemas/components-schemas-Sheet' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify destination + ContainerDestination destination = new ContainerDestination { + DestinationId = 3791509922310020, // long destinationFolderId + DestinationType = DestinationType.FOLDER, + NewName = "newSheetName" + }; + + // Sample 1: Omit 'include' parameter + Sheet sheet = smartsheet.SheetResources.CopySheet( + 9283173393803140, // sheetId + destination, + null // IEnumerable include + ); + + // Sample 2: Specify 'include' parameter with value of "data" + Sheet sheet = smartsheet.SheetResources.CopySheet( + 9283173393803140, // sheetId + destination, + new SheetCopyInclusion[] { SheetCopyInclusion.DATA } + ); + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/sheets/{sheetId}/copy?include=data,attachments' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -d '{ + "destinationType": "folder", + "destinationId": 7960873114331012, + "newName": "newSheetName" + }' \ + + -X POST + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify destination + ContainerDestination destination = new ContainerDestination() + .setDestinationType(DestinationType.FOLDER) + .setDestinationId(9283173393803140L) + .setNewName("newSheetName"); + + // Sample 1: Omit 'include' parameter + Sheet sheet = smartsheet.sheetResources().copySheet( + 4583173393803140L, // long sheetId + destination, + null // EnumSet includes + ); + + // Sample 2: Specify 'include' parameter with value of "data" + Sheet sheet = smartsheet.sheetResources().copySheet( + 4583173393803140L, // long sheetId + destination, + EnumSet.of(SheetCopyInclusion.DATA) + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set destination information + var body = { + destinationType: "home", + newName: "newSheetName" + }; + + // Set elements to copy + var params = { + include: "attachments,data", + includeAll: true + }; + + // Set options + var options = { + sheetId: 7254137655060356, + body: body, + queryParameters: params + }; + + // Copy sheet + smartsheet.sheets.copySheet(options) + .then(function(copiedSheet) { + console.log(copiedSheet); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: Copy sheet + response = smartsheet_client.Sheets.copy_sheet( + 4583173393803140, # sheet_id + smartsheet.models.ContainerDestination({ + 'destination_type': 'folder', # folder, workspace, or home + 'destination_id': 9283173393803140, # folder_id + 'new_name': 'newSheetName' + }) + ) + + # Sample 2: Copy sheet with attachments and discussions + response = smartsheet_client.Sheets.copy_sheet( + 4583173393803140, # sheet_id + include='attachments,discussions' + ) + /sheets/{sheetId}/crosssheetreferences: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + post: + summary: Create Cross-sheet References + description: >- + Adds a cross-sheet reference between two sheets and defines the data + range for formulas. Each distinct data range requires a new cross-sheet + reference. + operationId: add-crosssheet-reference + parameters: + - $ref: '#/components/parameters/Content-Type' + tags: + - crossSheetReferences + security: + - APIToken: [] + - OAuth2: + - CREATE_SHEETS + requestBody: + description: CrossSheetReference object to create + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/CrossSheetReferenceRequestWithColumnIds' + - $ref: '#/components/schemas/CrossSheetReferenceRequestWithRowIds' + - $ref: >- + #/components/schemas/CrossSheetReferenceRequestWithColumnAndRowIds + responses: + '200': + description: >- + Result object containing a CrossSheetReference object, corresponding + to what was specified in the request. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + properties: + result: + $ref: '#/components/schemas/CrossSheetReference' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + CrossSheetReference xref = new CrossSheetReference(); + + xref.Name = "Sample Time Log Sheet Range 1"; + + xref.SourceSheetId = 154378742065028; + + xref.StartRowId = 4089096300717956; + + xref.EndRowId = 2681721417164676; + + xref.StartColumnId = 824812248557444; + + xref.EndColumnId = 824812248557444; + + CrossSheetReference newXRef = + smartsheet.SheetResources.CrossSheetReferenceResources.CreateCrossSheetReference( + 1755440242550660, //sheetId + xref + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/crosssheetreferences + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '{ + "name": "Sample Time Log Sheet Range 1", + "sourceSheetId": 154378742065028, + "startRowId": 4089096300717956, + "endRowId": 2681721417164676, + "startColumnId": 824812248557444, + "endColumnId": 824812248557444 + }' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + CrossSheetReference xref = new CrossSheetReference(); + xref.setName("Sample Time Log Sheet Range 1"); + xref.setSourceSheetId(154378742065028L); + xref.setStartRowId(4089096300717956L); + xref.setEndRowId(2681721417164676L); + xref.setStartColumnId(824812248557444L); + xref.setEndColumnId(824812248557444L); + + CrossSheetReference newXRef = + smartsheet.sheetResources().crossSheetReferenceResources().createCrossSheetReference( + 1755440242550660, //sheetId + xref + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + var body = { + name: "my cross sheet reference", + sourceSheetId: 154378742065028, + startRowId: 4089096300717956, + endRowId: 2681721417164676, + "startColumnId": 824812248557444, + "endColumnId": 824812248557444 + }; + + + smartsheet.sheets.createCrossSheetReference({sheetId: 456745674567, + body: body}) + .then((result) => { + console.log("success"); + console.log(JSON.stringify(result)); + }) + .catch((error) => { + console.log("error"); + console.log(JSON.stringify(error)); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + xref = smartsheet.models.CrossSheetReference({ + 'name': 'Sample Time Log Sheet Range 1', + 'source_sheet_id': 154378742065028, + 'start_row_id': 4089096300717956, + 'end_row_id': 2681721417164676, + 'start_column_id': 824812248557444, + 'end_column_id': 824812248557444 + }) + result = smartsheet_client.Sheets.create_cross_sheet_reference( + 1755440242550660, xref) + get: + summary: List Cross-sheet References + description: Lists all cross-sheet references for the sheet. + operationId: list-crosssheet-references + tags: + - crossSheetReferences + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: >- + IndexResult object containing an array of CrossSheetReference + objects + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/CrossSheetReference' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + //Sample 1: List all + + smartsheet.SheetResources.CrossSheetReferenceResources.ListCrossSheetReferences( + 9283173393803140, // sheetId + null // PaginationParameters + ); + + //Sample 2: Paginate the list + + PaginationParameters paginationParameters = new + PaginationParameters( + false, // includeAll + 100, // pageSize + 1 // page + ); + smartsheet.SheetResources.CrossSheetReferenceResources.ListCrossSheetReferences( + 9283173393803140, // sheetId + paginationParameters + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/crosssheetreferences + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + //Sample 1: List all + + smartsheet.sheetResources().crossSheetReferenceResources().listCrossSheetReferences( + 9283173393803140L, // sheetId + null // PaginationParameters + ); + + //Sample 2: Paginate the list + + PaginationParameters paginationParameters = new + PaginationParameters( + false, // includeAll + 100, // pageSize + 1 // page + ); + smartsheet.sheetResources().crossSheetReferenceResources().listCrossSheetReferences( + 9283173393803140L, // sheetId + paginationParameters + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + smartsheet.sheets.listCrossSheetReferences({sheetId: + 9283173393803140}) + .then((result) => { + console.log("success"); + console.log(JSON.stringify(result)); + }) + .catch((error) => { + console.log("error"); + console.log(JSON.stringify(error)); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List All + result = smartsheet_client.Sheets.list_cross_sheet_references( + 9283173393803140) + + # Sample 2: Paginate the list of cross-sheet references + response = smartsheet_client.Sheets.list_cross_sheet_references( + 9283173393803140, # sheet_id + page_size=10, + page=1) + pages = response.total_pages + crosssheetreferences = response.data + /sheets/{sheetId}/crosssheetreferences/{crossSheetReferenceId}: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/crossSheetReferenceId' + get: + summary: Get Cross-sheet Reference + description: Gets the cross-sheet reference specified in the URL. + operationId: get-crosssheet-reference + tags: + - crossSheetReferences + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: CrossSheetReference object + content: + application/json: + schema: + $ref: '#/components/schemas/CrossSheetReference' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + CrossSheetReference xref = + smartsheet.SheetResources.CrossSheetReferenceResources.GetCrossSheetReference( + 9283173393803140, // sheetId + 8157685695702916 // crossSheetReferenceId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/crosssheetreferences/{crossSheetReferenceId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + CrossSheetReference xref = + smartsheet.sheetResources().crossSheetReferenceResources().getCrossSheetReference( + 9283173393803140L, // sheetId + 8157685695702916L // crossSheetReferenceId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + smartsheet.sheets.getCrossSheetReference({sheetId: 9283173393803140, + crossSheetReferenceId: 8157685695702916}) + .then((result) => { + console.log("success"); + console.log(JSON.stringify(result)); + }) + .catch((error) => { + console.log("error"); + console.log(JSON.stringify(error)); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + result = smartsheet_client.Sheets.get_cross_sheet_reference( + 9283173393803140, # sheet_id + 8157685695702916 # cross_sheet_reference_id + ) + /sheets/{sheetId}/discussions: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Discussions + description: > + Gets a list of all discussions associated with the specified sheet. + Remember that discussions are containers + + for the conversation thread. To see the entire thread, use the + include=comments parameter. + operationId: discussions-list + tags: + - discussions + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/discussionInclude' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/includeAll' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: list of discussions + type: array + items: + $ref: '#/components/schemas/Discussion' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Sample 1: Omit 'include' parameter and pagination parameters + + PaginatedResult results = + smartsheet.SheetResources.DiscussionResources.ListDiscussions( + 9283173393803140, // sheetId + null, // IEnumerable include + null // PaginationParameters + ); + + + // Sample 2: Specify 'include' parameter with values of 'COMMENTS' + and 'ATTACHMENTS', and 'includeAll' parameter with value of 'true' + + PaginatedResult results = + smartsheet.SheetResources.DiscussionResources.ListDiscussions( + 9283173393803140, // sheetId + new DiscussionInclusion[] { DiscussionInclusion.COMMENTS, DiscussionInclusion.ATTACHMENTS }, + new PaginationParameters( + true, // includeAll + null, // int pageSize + null) // int page + ); + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/sheets/{sheetId}/discussions?include=comments,attachments' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Sample 1: Omit 'include' parameter and pagination parameters + + PagedResult results = + smartsheet.sheetResources().discussionResources().listDiscussions( + 9283173393803140L, // long sheetId + null, // PaginationParameters + null // EnumSet includes + ); + + // Sample 2: Specify pagination parameter 'includeAll' + + PaginationParameters parameters = new PaginationParameters() + .setIncludeAll(true); + + // List discussions (specify 'include' parameter with values of + 'COMMENTS' and 'ATTACHMENTS', and 'includeAll' parameter with value + of 'true') + + PagedResult results = + smartsheet.sheetResources().discussionResources().listDiscussions( + 9283173393803140L, // long sheetId + parameters, + EnumSet.of(DiscussionInclusion.COMMENTS, DiscussionInclusion.ATTACHMENTS) + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 3138415114905476 + }; + + // List discussions + smartsheet.sheets.getDiscussions(options) + .then(function(discussionList) { + console.log(discussionList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List all + response = smartsheet_client.Discussions.get_all_discussions( + 9283173393803140, # sheet_id + include_all=True) + discussions = response.data + + # Sample 2: Paginate the list + response = smartsheet_client.Discussions.get_all_discussions( + 9283173393803140, # sheet_id + page_size=10, + page=1) + pages = response.total_pages + discussions = response.data + post: + summary: Create a Discussion + description: > + Creates a new discussion on a sheet. To create a discussion with an + attachment please use "multipart/form-data" content type. + operationId: discussions-create + tags: + - discussions + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DiscussionCreationRequest' + multipart/form-data: + schema: + $ref: '#/components/schemas/DiscussionCreationRequestWithAttachment' + encoding: + discussion: + contentType: application/json + file: + contentType: application/octet-stream + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Discussion' + properties: + version: + description: >- + New version of the sheet. Applicable only for operations + which update sheet data. + type: number + nullable: true + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Example request: create discussion on sheet (without attachment) + + + // Create discussion (including the comment) + + Discussion discussionSpecification = new Discussion + + { + Comment = new Comment + { + Text = "This text is the body of the first comment" + }, + Comments = null // workaround for SDK issue + }; + + + // Add discussion to sheet + + Discussion newDiscussion = + smartsheet.SheetResources.DiscussionResources.CreateDiscussion( + 9283173393803140, // sheetId + discussionSpecification + ); + + + // Example request: create discussion on sheet (with attachment) + + + // Create discussion (including the comment) + + Discussion discussionSpecification = new Discussion + + { + Comment = new Comment + { + Text = "This text is the body of the first comment" + }, + Comments = null // workaround for SDK issue + }; + + + // Add discussion (including comment with attachment) to sheet + + Discussion newDiscussion = + smartsheet.SheetResources.DiscussionResources.CreateDiscussionWithAttachment( + 9283173393803140, // sheetId + discussionSpecification, + filePath, + "application/octet-stream" + ); + - lang: cURL + label: cURL + source: > + # Example request: create discussion on sheet (without attachment) + + + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/discussions \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '{"comment": {"text":"This text is the body of the first + comment"}}' + + + # Example request: create discussion on sheet (with attachment) + + + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/discussions \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: multipart/form-data" \ + + -X POST \ + + -F 'discussion={ "comment": { "text": "This text is the body of the + first comment" } };type=application/json' \ + + -F "file=@file_to_attach;type=application/octet-stream" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Example request: create discussion on sheet (without attachment) + + // Create comment + Comment commentSpecification = new Comment() + .setText("This text is the body of the first comment"); + + // Create discussion (including the comment) + Discussion discussionSpecification = new Discussion() + .setComment(commentSpecification) + .setComments(null); // workaround for SDK issue + + // Add discussion to sheet + Discussion newDiscussion = smartsheet.sheetResources().discussionResources().createDiscussion( + 9283173393803140L, // long sheetId + discussionSpecification + ); + + // Example request: create discussion on sheet (with attachment) + + // Create comment + Comment commentSpecification = new Comment() + .setText("This text is the body of the first comment"); + + // Create discussion (including the comment) + Discussion discussionSpecification = new Discussion() + .setComment(commentSpecification) + .setComments(null); // workaround for SDK issue + + File file = new File(filePath); + + // Add discussion (including comment with attachment) to sheet + Discussion newDiscussion = smartsheet.sheetResources().discussionResources().createDiscussionWithAttachment( + 9283173393803140L, // long sheetId + discussionSpecification, + file, + "application/octet-stream" + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Example request: create discussion on sheet (without attachment) + + + // Specify discussion + + var discussion = { + "comment": { + "text": "This text is the body of the first comment" + } + }; + + + // Set options + + var options = { + sheetId: 2252168947361668, + body: discussion + }; + + // Add discussion to sheet + + smartsheet.sheets.createDiscussion(options) + .then(function(newDiscussion) { + console.log(newDiscussion); + }) + .catch(function(error) { + console.log(error); + }); + + // Example request: create discussion on sheet (with attachment) + + + // Multipart operations are not supported by the Node SDK. Instead, + see instructions to Create Discussion on Sheet, and then Attach File + to Comment. + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + # Example request: create discussion on sheet (without attachment) + + + response = smartsheet_client.Discussions.create_discussion_on_sheet( + 9283173393803140, # sheet_id + smartsheet.models.Discussion({ + 'comment': smartsheet.models.Comment({ + 'text': 'This text is the body of the first comment' + }) + }) + ) + + + # Example request: create discussion on sheet (with attachment) + + + response = + smartsheet_client.Discussions.create_discussion_on_sheet_with_attachment( + 9283173393803140, # sheet_id + smartsheet.models.Discussion({ + 'comment': smartsheet.models.Comment({ + 'text': 'This text is the body of the first comment' + }) + }), + ('photo.jpg', open('/path/to/photo.jpg', 'rb'), 'image/jpeg') + ) + /sheets/{sheetId}/discussions/{discussionId}: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/discussionId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Get Discussion + description: | + Gets the discussion specified by discussionId. + operationId: discussion-get + tags: + - discussions + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Discussion' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + Discussion discussion = + smartsheet.SheetResources.DiscussionResources.GetDiscussion( + 9283173393803140, // sheetId + 0123456789012345 // discussionId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/discussions/{discussionId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + Discussion discussion = + smartsheet.sheetResources().discussionResources().getDiscussion( + 9283173393803140L, // long sheetId + 0123456789012345L // long discussionId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 2252168947361668, + discussionId: 2331373580117892 + }; + + // Get discussion + smartsheet.sheets.getDiscussions(options) + .then(function(discussion) { + console.log(discussion); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + discussion = smartsheet_client.Discussions.get_discussion( + 9283173393803140, # sheet_id + 0123456789012345) # discussion_id + + # discussion is an instance of smartsheet.models.Discussion + delete: + summary: Delete a Discussion + description: | + Deletes the discussion specified in the URL. + operationId: discussion-delete + tags: + - discussions + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + $ref: '#/components/schemas/GenericResult' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.SheetResources.DiscussionResources.DeleteDiscussion( + 9283173393803140, // sheetId + 0123456789012345 // discussionId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/discussions/{discussionId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789"\ + + -X 'DELETE' + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.sheetResources().discussionResources().deleteDiscussion( + 9283173393803140L, // long sheetId + 0123456789012345L // long discussionId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 2252168947361668, + discussionId: 991393444325252 + }; + + // Delete discussion + smartsheet.sheets.deleteDiscussion(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Discussions.delete_discussion( + 9283173393803140, # sheet_id + 0123456789012345) # discussion_id + /sheets/{sheetId}/discussions/{discussionId}/attachments: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/discussionId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Discussion Attachments + description: | + Gets a list of all attachments that are in the discussion. + operationId: discussion-listAttachments + tags: + - attachments + - discussions + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/includeAll' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: list of attachments + type: array + items: + $ref: '#/components/schemas/Attachment' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PaginatedResult attachments = + smartsheet.SheetResources.DiscussionResources.AttachmentResources.ListAttachments( + 9283173393803140, // sheetId + 1234567890123456, // discussionId + null // PaginationParameters + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/discussions/{discussionId}/attachments + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination + + PagedResult attachments = + smartsheet.sheetResources().discussionResources().attachmentResources().getAttachments( + 9283173393803140L, // long sheetId + 1234567890123456L, // long discussionId + null // PaginationParameters + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 2252168947361668, + discussionId: 3962273862576004 + }; + + // List discussion attachments + smartsheet.sheets.listDiscussionAttachments(options) + .then(function(attachmentsList) { + console.log(attachmentsList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + # Sample 1: List All + + response = + smartsheet_client.Attachments.list_discussion_attachments( + 9283173393803140, # sheet_id + 1234567890123456, # discussion_id + include_all=True) + attachments = response.data + + + # Sample 2: Paginate the list + + response = + smartsheet_client.Attachments.list_discussion_attachments( + 9283173393803140, # sheet_id + 1234567890123456, # discussion_id + page_size=10, + page=1) + pages = response.total_pages + + attachments = response.data + /sheets/{sheetId}/discussions/{discussionId}/comments: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/discussionId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + post: + summary: Create a comment + description: > + Adds a comment to a discussion. To create a comment with an attachment + please use "multipart/form-data" content type. + operationId: comments-create + tags: + - comments + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CommentCreationRequest' + multipart/form-data: + schema: + $ref: '#/components/schemas/CommentCreationRequestWithAttachment' + encoding: + comment: + contentType: application/json + file: + contentType: application/octet-stream + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Comment' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Example request: add comment (without attachment) + + + // Create comment + + Comment commentSpecification = new Comment + + { + Text = "This is a new comment." + }; + + + // Add comment to discussion + + Comment newComment = + smartsheet.SheetResources.DiscussionResources.CommentResources.AddComment( + 2252168947361668, // sheetId + 3962273862576004, // discussionId + commentSpecification + ); + + + // Example request: add comment (with attachment) + + + // Create comment + + Comment commentSpecification = new Comment + + { + Text = "This is a new comment." + }; + + + // Add comment (with attachment) to discussion + + Comment newComment = + smartsheet.SheetResources.DiscussionResources.CommentResources.AddCommentWithAttachment( + 2252168947361668, // sheetId + 3962273862576004, // discussionId + commentSpecification, + filePath, + "application/octet-stream" + ); + - lang: cURL + label: cURL + source: > + # Example request: add comment (without attachment) + + + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/discussions/{discussionId}/comments + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '{"text":"This is a new comment."}' + + + # Example request: add comment (with attachment) + + + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/discussions/{discussionId}/comments + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: multipart/form-data" \ + + -X POST \ + + -F 'comment={ "text":"This is a new comment." + };type=application/json' \ + + -F "file=@insurance_benefits.pdf;type=application/octet-stream" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Example request: add comment (without attachment) + + // Create comment + Comment commentSpecification = new Comment() + .setText("This is a new comment."); + + // Add comment to discussion + Comment newComment = smartsheet.sheetResources().discussionResources().commentResources().addComment( + 2252168947361668L, // long sheetId + 3962273862576004L, // long discussionId + commentSpecification + ); + + // Example request: add comment (with attachment) + + // Create comment + Comment commentSpecification = new Comment() + .setText("This is a new comment."); + + // Add comment (with attachment) to discussion + File file = new File(filePath); + smartsheet.sheetResources().discussionResources().commentResources().addCommentWithAttachment( + 2252168947361668L, // long sheetId + 3962273862576004L, // long discussionId + commentSpecification, + file, + "application/octet-stream" + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Example request: add comment (without attachment) + + + // Specify comment + + var comment = { "text": "This is a new comment." }; + + + // Set options + + var options = { + sheetId: 2252168947361668, + discussionId: 3962273862576004, + body: comment + }; + + // Add comment to discussion + + smartsheet.sheets.addDiscussionComment(options) + .then(function(newComment) { + console.log(newComment); + }) + .catch(function(error) { + console.log(error); + }); + + // Example request: add comment (with attachment) + + + // Multipart operations are not supported by the Node SDK. Instead, + see instructions to Add Comment, and then Attach File to Comment. + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + # Example request: add comment (without attachment) + + + response = smartsheet_client.Discussions.add_comment_to_discussion( + 2252168947361668, # sheet_id + 3962273862576004, # discussion_id + smartsheet.models.Comment({ + 'text': 'This is a new comment.' + }) + ) + + + # Example request: add comment (with attachment) + + + # Create comment + + comment = smartsheet.models.Comment({ + 'text': 'This is a new comment.' + }) + + + # Add comment (with attachment) to discussion + + response = + smartsheet_client.Discussions.add_comment_to_discussion_with_attachment( + 2252168947361668, # sheet_id + 3962273862576004, # discussion_id + comment, + ('image.png', open('/path/to/image.png', 'rb'), 'image/png') + ) + /sheets/{sheetId}/emails: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/Content-Type' + post: + summary: Send Sheet via Email + description: >- + Sends the sheet as a PDF attachment via email to the designated + recipients. + operationId: sheet-send + tags: + - sheets + security: + - APIToken: [] + - OAuth2: + - SHARE_SHEETS + requestBody: + description: | + [SheetEmail object](/api/smartsheet/openapi/sendviaemail/sheetemail) + content: + application/json: + schema: + $ref: '#/components/schemas/SheetEmail' + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify recipients + + Recipient[] recipients = new Recipient[] { + new Recipient { Email = "john.doe@smartsheet.com" }, + new Recipient { GroupId = 2258118617917316 } + }; + + + // Configure email + + SheetEmail sheetEmail = new SheetEmail { + SendTo = recipients, + Subject = "Check this report out!", + Message = "Here are the rows I mentioned in our meeting", + CcMe = false, + Format = SheetEmailFormat.PDF, + FormatDetails = new FormatDetails { PaperSize = PaperSize.A4 } + }; + + + // Send sheet via email + + smartsheet.SheetResources.SendSheet(4293147074291588, + sheetEmail); // sheetId + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/emails \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '{"sendTo" : [{"email": "john.doe@smartsheet.com"}, {"groupId": + 2258118617917316}], "subject": "Check these rows out!", "message": + "Here is the Sheet I mentioned in our meeting.", "ccMe": false, + "format": "PDF", "formatDetails": {"paperSize": "A4"}}' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify individual recipient + + RecipientEmail recipientEmail = new + RecipientEmail.AddRecipientEmailBuilder() + .setEmail("john.doe@smartsheet.com") + .build(); + + // Specify group recipient + + RecipientGroup recipientGroup = new + RecipientGroup.AddRecipientGroupBuilder() + .setGroupId(2258118617917316L) + .build(); + + // Set recipients + + List recipients = + Arrays.asList(recipientEmail,recipientGroup); + + + // Set format details + + FormatDetails formatDetails = new FormatDetails(); + + formatDetails.setPaperSize(PaperSize.A0); + + + // Configure email + + SheetEmail email = new SheetEmail.AddSheetEmailBuilder() + .setSendTo(recipients) + .setSubject("Check these rows out!") + .setMessage("Here are the rows I mentioned in our meeting") + .setCcMe(false) + .setFormat(SheetEmailFormat.PDF) + .setFormatDetails(formatDetails) + .build(); + + // Send sheet via email + + smartsheet.sheetResources().sendSheet(4293147074291588L, + email); // sheetId + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Configure email + var email = { + "sendTo": [ + { + "email": "john.doe@smartsheet.com" + }, + { + "groupId": 2258118617917316 + } + ], + "subject": "Check these rows out!", + "message": "Here are the rows I mentioned in our meeting", + "ccMe": false, + "format": "PDF", + "formatDetails": { + "paperSize": "A4" + } + }; + + // Set options + var options = { + body: email, + sheetId: 2252168947361668 + }; + + // Send sheet via email + smartsheet.sheets.sendSheetViaEmail(options) + .then(function(data) { + console.log(data); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + response = smartsheet_client.Sheets.send_sheet( + 4293147074291588, # sheet_id + smartsheet.models.SheetEmail({ + 'send_to': [ + smartsheet.models.Recipient({'email': 'john.doe@smartsheet.com'}), + smartsheet.models.Recipient({'group_id': 2258118617917316}) + ], + 'subject': 'Check these rows out!', + 'message': 'Here are the rows I mentioned in our meeting.', + 'cc_me': False, + 'format': 'PDF', + 'format_details': smartsheet.models.FormatDetails({ + 'paper_size': 'A4' + }) + }) + ) + /sheets/{sheetId}/move: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/Content-Type' + post: + summary: Move Sheet + description: > + Moves the specified sheet to a new location. + + When a sheet that is shared to one or more users and/or groups is moved + into or out of a workspace, those sheet-level shares are preserved. + operationId: move-sheet + tags: + - sheets + security: + - APIToken: [] + - OAuth2: + - CREATE_SHEETS + requestBody: + description: Destination to move the specified sheet. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerDestinationForMove' + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + properties: + result: + $ref: '#/components/schemas/components-schemas-Sheet' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify destination + ContainerDestination destination = new ContainerDestination { + DestinationId = 7960873114331012, // destinationFolderId + DestinationType = DestinationType.FOLDER, + }; + + // Move sheet + Sheet sheet = smartsheet.SheetResources.MoveSheet( + 4583173393803140, // sheetId + destination + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/move \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" \ + -d '{ + "destinationType": "folder", + "destinationId": 7960873114331012 + }' \ + -X POST + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify destination + ContainerDestination destination = new ContainerDestination(); + destination.setDestinationType(DestinationType.FOLDER) + .setDestinationId(7960873114331012L); + + // Move sheet + Sheet sheet = smartsheet.sheetResources().moveSheet( + 4583173393803140L, // long sheetId + destination + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set destination information + var body = { + destinationType: "folder", + destinationId: 7960873114331012 + }; + + // Set options + var options = { + sheetId: 4583173393803140, + body: body + }; + + // Move sheet + smartsheet.sheets.moveSheet(options) + .then(function(movedSheet) { + console.log(movedSheet); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + sheet = smartsheet_client.Sheets.move_sheet( + 4583173393803140, # sheet_id + smartsheet.models.ContainerDestination({ + 'destination_type': 'folder', # folder, workspace, or home + 'destination_id': 7960873114331012 # folder_id + }) + ) + /sheets/{sheetId}/proofs: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/includeAll' + summary: List Proofs + description: | + Gets a list of all proofs for a given sheet. + operationId: proofs-getAllProofs + tags: + - proofs + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: list of all proofs + type: array + items: + $ref: '#/components/schemas/Proof' + x-codeSamples: + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/proofs \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + /sheets/{sheetId}/proofs/{proofId}: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/proofId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + parameters: + - $ref: '#/components/parameters/proofInclude' + summary: Get Proof + description: > + Gets the proof specified in the URL. Returns the proof, which is + optionally populated with discussion and attachment objects. + operationId: proofs-get + tags: + - proofs + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Proof' + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/proofs/{proofId}?include=attachments,discussions + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + delete: + summary: Delete Proof + description: > + Deletes the proof including all versions. The proofId must be for the + original version. + operationId: proofs-delete + tags: + - proofs + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + $ref: '#/components/schemas/GenericResult' + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/sheets/{sheetId}/proofs/{proofId}' \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + put: + summary: Update Proof Status + description: | + Sets the proof status as either complete or incomplete. + operationId: proofs-update + tags: + - proofs + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateProofStatusRequest' + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Proof' + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/proofs/{proofId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Disposition: attachment; filename="abc.bmp"" \ + + -X PUT + /sheets/{sheetId}/proofs/{proofId}/attachments: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/proofId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Proof Attachments + description: > + Gets a list of all attachments that are in the proof, excluding + discussion-level attachments in the proof. + operationId: proofs-listAttachments + tags: + - proofs + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/includeAll' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: list of proof attachments + type: array + items: + $ref: '#/components/schemas/Attachment' + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/proofs/{proofId}/attachments + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + post: + summary: Attach File to Proof + description: > + Attaches a file to the proof. + + + > **Note:** Posting a file attachment is resource-intensive and is + limited to **30 requests per minute per API token**. For details, see + [Rate + limiting](/api/smartsheet/guides/advanced-topics/scalability-options#rate-limiting). + operationId: proofs-attachToProof + tags: + - proofs + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/octet-stream: + schema: + type: string + format: binary + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Attachment' + properties: + version: + description: >- + New version of the sheet. Applicable only for operations + which update sheet data. + type: number + nullable: true + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/proofs/{proofId}/attachments + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: image/gif" \ + + -H "Content-Disposition: attachment; filename="giphy.gif"" \ + + -X POST \ + + --data-binary "@home/giphy.gif" + /sheets/{sheetId}/proofs/{proofId}/discussions: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/proofId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Proof Discussions + description: | + Gets a list of all discussions that are in the proof. + operationId: proofs-listDiscussions + tags: + - proofs + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/discussionInclude' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/includeAll' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: list of proof discussions + type: array + items: + $ref: '#/components/schemas/Discussion' + post: + summary: Create Proof Discussion + description: | + Creates a discussion on a proof. + operationId: proofs-createDiscussion + tags: + - proofs + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DiscussionCreationRequest' + multipart/form-data: + schema: + $ref: '#/components/schemas/DiscussionCreationRequestWithAttachment' + encoding: + discussion: + contentType: application/json + file: + contentType: application/octet-stream + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Discussion' + properties: + version: + description: >- + New version of the sheet. Applicable only for operations + which update sheet data. + type: number + nullable: true + x-codeSamples: + - lang: cURL + label: cURL + source: > + // Sample 1: create proof discussion (without attachment) + + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/proofs/{proofId}/discussions + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: multipart/form-data \ + + -X POST \ + + --data-binary "@/home/Downloads/test_b (4).pdf" + + + // Sample 2: create proof discussion (with attachment) + + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/proofs/{proofId}/discussions + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: multipart/form-data \ + + -X POST \ + + -F 'discussion={ "comment": { "text": "This text is the body of the + first comment" } };type=application/json' \ + + -F "file=@/home/Downloads/test_b + (4).pdf;type=application/octet-stream" + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/sheets/{sheetId}/proofs/{proofId}/discussions' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + /sheets/{sheetId}/proofs/{proofId}/requestactions: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/proofId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Proof Request Actions + description: > + Gets a summarized list of all request actions associated with the + specified proof. + operationId: proofs-listRequestActions + tags: + - proofs + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/includeAll' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: list of proof request actions + type: array + items: + $ref: '#/components/schemas/ProofRequestAction' + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/proofs/{proofId}/requestactions + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + /sheets/{sheetId}/proofs/{proofId}/requests: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/proofId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + delete: + summary: Delete Proof Requests + description: | + Deletes all proof requests in a proof. + operationId: proofs-deleteProofRequests + tags: + - proofs + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + $ref: '#/components/schemas/GenericResult' + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/proofs/{proofId}/requests + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + post: + summary: Create Proof Request + description: | + Creates a proof request. + operationId: proofs-createProofRequests + tags: + - proofs + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ProofRequestBody' + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/ProofRequest' + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/proofs/{proofId}/requests + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '{ + "sendTo": [{ + "email": "john.doe@smartsheet.com" + }], + "subject": "This is a test." + }' + /sheets/{sheetId}/proofs/{proofId}/versions: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/proofId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Proof Versions + description: > + Gets a list of all versions of the given proofId in order from newest to + oldest. + operationId: proofs-getVersions + tags: + - proofs + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/includeAll' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: list of proof versions + type: array + items: + $ref: '#/components/schemas/Proof' + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/proofs/{proofId}/versions + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + delete: + summary: Delete Proof Version + description: | + Deletes a proof version. Proof Id must be a current version proof Id. + operationId: proofs-deleteVersion + tags: + - proofs + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + $ref: '#/components/schemas/GenericResult' + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/proofs/{proofId}/versions + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + post: + summary: Create Proof Version + description: | + Creates a proof version. Proof Id must be for the original proof. + operationId: proofs-createVersion + tags: + - proofs + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/octet-stream: + schema: + type: string + format: binary + multipart/form-data: + schema: + type: object + properties: + name: + type: string + filename: + type: string + format: binary + application/json: + schema: + $ref: '#/components/schemas/URLAttachmentRequest' + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Proof' + properties: + version: + description: >- + New version of the sheet. Applicable only for operations + which update sheet data. + type: number + nullable: true + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/proofs/{proofId}/versions + \ + + -H "Content-Disposition: attachment; filename="error.gif"" \ + + -H "Content-Type: image/gif" \ + + -X POST \ + + --data-binary "@/home/Downloads/giphy.gif" + /sheets/{sheetId}/publish: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Get Sheet Publish Status + description: | + Gets the sheet's 'Publish' settings. + operationId: get-sheetPublish + tags: + - sheets + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SheetPublish' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + SheetPublish status = smartsheet.SheetResources.GetPublishStatus( + 4583173393803140 // sheetId + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/publish \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + SheetPublish status = smartsheet.sheetResources().getPublishStatus( + 4583173393803140L, // long sheetId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 4583614634583940 + }; + + // Get sheet publish status + smartsheet.sheets.getPublishStatus(options) + .then(function(status) { + console.log(status); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + response = smartsheet_client.Sheets.get_publish_status( + 4583173393803140) # sheet_id + status = response.result + # status is a smartsheet.models.SheetPublish object + put: + summary: Set Sheet Publish Status + description: > + Sets the publish status of the sheet and returns the new status, + including the URLs of any enabled publishings. + operationId: set-sheetPublish + tags: + - sheets + security: + - APIToken: [] + - OAuth2: + - ADMIN_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + description: > + SheetPublish object. + + + For Read Only, if you do not specify a value for + **readOnlyFullAccessibleBy**, the value defaults + + to the organization-level 'Sheet Publishing' setting (if the sheet + owner belongs to an organization account) + + or to **ALL** (if the sheet owner does not belong to an organization + account). + + + For Read Write, if you do not specify a value for + **readWriteAccessibleBy**, the value defaults + + to the organization-level 'Sheet Publishing' setting (if the sheet + owner belongs to an organization account) + + or to **ALL** (if the sheet owner does not belong to an organization + account). + content: + application/json: + schema: + $ref: '#/components/schemas/SheetPublishRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/SheetPublish' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify sheet publish status properties + + SheetPublish publishSpecification = new SheetPublish + + { + ReadOnlyLiteEnabled = true, + ReadOnlyFullEnabled = false, + ReadWriteEnabled = false, + IcalEnabled = false + }; + + + // Set sheet publish status + + SheetPublish updatedStatus = + smartsheet.SheetResources.UpdatePublishStatus( + 4583614634583940, // sheetId + publishSpecification + ); + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/publish \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X PUT \ + + -d '{"readOnlyLiteEnabled": true,"readOnlyFullEnabled": + false,"readWriteEnabled": false,"icalEnabled": false}' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify sheet publish status properties + + SheetPublish publishSpecification = new SheetPublish() + .setIcalEnabled(false) + .setReadOnlyFullEnabled(false) + .setReadWriteEnabled(false) + .setReadOnlyLiteEnabled(true); + + // Set sheet publish status + + SheetPublish updatedStatus = + smartsheet.sheetResources().updatePublishStatus( + 4583614634583940L, // long sheetId + publishSpecification + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify publish status + var publishStatus = { + "readOnlyLiteEnabled": true, + "readOnlyFullEnabled": false, + "readWriteEnabled": false, + "icalEnabled": false + }; + + // Set options + var options = { + sheetId: 4583614634583940, + body: publishStatus + }; + + // Set publish status + smartsheet.sheets.setPublishStatus(options) + .then(function(updatedStatus) { + console.log(updatedStatus); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + # With the Python SDK, if fewer than all four flags are set, current + status is retrieved and merged with the flags that _are_ set with + this method call. + + + updated_status = smartsheet_client.Sheets.set_publish_status( + 4583173393803140, # sheet_id + smartsheet.models.SheetPublish({ + 'read_only_lite_enabled': True + }) + ) + /sheets/{sheetId}/rows: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + post: + summary: Add Rows + description: > + Inserts one or more rows into the sheet specified in the URL. If you + want to insert the rows in any position but the default, use + [location-specifier attributes](/api/smartsheet/openapi/rows) (that is, + toTop, toBottom, parentId, siblingId, above, indent, outdent). See + language tabs for variations in syntax. + + + Note: This operation does not add rows with cells that have images. + However, you can upload an image to a cell *after* the cell exists in a + sheet. To do so, call the operation described in the [Add Image to + Cell](/api/smartsheet/openapi/cellimages/addimagetocell) page. + + + This operation supports both single-object and bulk semantics. For more + information, see [Optional Bulk + Operations](/api/smartsheet/guides/advanced-topics/scalability-options#bulk-operations). + operationId: rows-addToSheet + tags: + - rows + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/accessApiLevel' + - $ref: '#/components/parameters/Content-Type' + - $ref: '#/components/parameters/allowPartialSuccess' + - $ref: '#/components/parameters/overrideValidation' + requestBody: + description: > + [Row object](/api/smartsheet/openapi/rows/row) or an array of Row + objects, with the following attributes: + * One or more [location-specifier attributes](/api/smartsheet/openapi/rows) (required) + * **expanded** (optional) + * **format** (optional) + * **cells** (optional) -- if specified, must be an array of [Cell objects](/api/smartsheet/openapi/cells/cell), where each object is limited to the following attributes: + * **columnId** (required) + * One of the following (required): + * **formula**: the formula for the cell. For cross-sheet formulas, you must first define a [cross-sheet reference](/api/smartsheet/openapi/crosssheetreferences) + * **value** + * When **value** is specified + * [hyperlink](/api/smartsheet/openapi/schemas/widgethyperlink) (optional) with exactly one of the following attributes set: + * **reportId** + * **sheetId** + * **url** + * [linkInFromCell]() (optional) with all of the following attributes set: + * **columnId** + * **rowId** + * **sheetId** + * **strict** (optional) + * **format** (optional) + * **overrideValidation** (optional) + * **locked** (optional) - **true** to lock the row or **false** to unlock the row. + + See [Column Types](/api/smartsheet/openapi/columns) for more + information. + + + **NOTES:** + + * Column Ids must be valid for the sheet to which the row belongs, and + must only be used once for each row in the operation. + + * Cells of a project sheet in the "Finish Date" column cannot be + updated via API. + + * Cells of a project sheet in the "Start Date" column cannot be + updated via API for rows that contain a value in the "Predecessor" + column. + + * Max length for a cell value is 4000 characters after which + truncation occurs without warning. Empty string values are converted + to null. + + * When adding or updating rows, there is a 500 row limit for each API + call. + + * Calculation errors or problems with a formula do not cause the API + call to return an error code. Instead, the response contains the same + value as in the UI, such as cell.value = "#CIRCULAR REFERENCE". + + * If you are adding or updating a row using *linkInFromCell*, you + cannot use *overrideValidation* as a query param. In this case, you + must pass *overrideValidation* in the body as a cell update field. + Additionally, *linkInFromCell* requires a *value* of null. + + * Any one sheet can have up to 500,000 inbound cell links. (Smartsheet + Gov has an inbound cell link limit of 100,000.) + + * If you want to clear a cell link, you can either pass *value* as an + empty string or set the *value* to the current value and omit + *linkInFromCell*. + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/Row' + - type: array + items: + $ref: '#/components/schemas/Row' + responses: + '200': + description: >- + Returns [Result object](/api/smartsheet/openapi/schemas/result) + containing the newly created rows -- either a single [Row + object](/api/smartsheet/openapi/rows/row) or array of Row objects, + corresponding to what was specified in the request, as well as the + new version of the sheet. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + type: array + items: + $ref: '#/components/schemas/AddRowsObject' + default: + description: > + When **allowPartialSuccess=false** (or not specified): + + + If an error occurs, the [Error + object](/api/smartsheet/openapi/schemas/error) returned contains a + **detail** attribute set to an object with the following attribute: + + * **index**: the array index of the row that caused the error (0 if + a single Row was passed in) + + + If any error occurs, the entire request fails (no rows are added), + and the error response returned describes the first problem that was + encountered. For example: + + ``` + + { + "errorCode": 1042, + "message": "The cell value in column 5504245941200772 did not conform to the strict requirements for type CHECKBOX." + "detail": { + "index": 4 + } + } + + ``` + + + When **allowPartialSuccess=true**: + + + When partial success is enabled, and one or more of the objects in + the request fail to be added/updated/deleted, a standard [Result + object](/api/smartsheet/openapi/schemas/result) is returned, but + with a **message** of **'PARTIAL_SUCCESS'** (instead of + **'SUCCESS'**), and a **resultCode** of **3**. Additionally, the + object contains a **failedItems** attribute -- an array of + [BulkItemFailure + objects](/api/smartsheet/openapi/schemas/bulkitemfailure) that + contains an item for each object in the request that failed to be + added/updated/deleted. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify cell values for first row + Cell[] cellsToInsert = new Cell[] + { + new Cell + { + ColumnId = addedColumns[0].Id, + ObjectValue = new MultiPicklistObjectValue(new string[] {"Bat", "Cat"}) + } + }; + Row rowA = new Row + { + ToTop = true, + Cells = cellsToInsert + }; + + // Specify cell values of second row + Cell[] cellsB = new Cell[] { + new Cell + { + ColumnId = 7960873114331012, + Value = true + }, + new Cell + { + ColumnId = 642523719853956, + Value = "New status" + } + }; + + // Specify contents of second row + Row rowB = new Row + { + ToTop = true, + Cells = cellsB + }; + + // Add rows to sheet + IList newRows = smartsheet.SheetResources.RowResources.AddRows( + 2331373580117892, // sheetId + new Row[] { rowA, rowB } // IEnumerable rowsToAdd + ); + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/rows \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '[{"toTop":true, "cells": [ {"columnId": 7960873114331012, + "value": true}, {"columnId": 642523719853956, "value": "New status", + "strict": false} ] }, {"toTop":true, "cells": [ {"columnId": + 7960873114331012, "value": true}, {"columnId": 642523719853956, + "value": "New status", "strict": false} ] }]' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify cell values for first row + + List rowACells = Arrays.asList( + new Cell(7960873114331012L) // column Id + .setValue(true), + new Cell(642523719853956L) // column Id + .setValue("New status") + ); + + // Specify contents of first row + + Row rowA = new Row(); + + rowA.setCells(rowACells) + .setToBottom(true); + + // Specify cell values for second row + + List rowBCells = Arrays.asList( + new Cell(7960873114331012L) + .setValue(true), + new Cell(642523719853956L) + .setValue("New status") + ); + + // Specify contents of second row + + Row rowB = new Row(); + + rowB.setCells(rowBCells) + .setToBottom(true); + + // Add rows to sheet + + List newRows = + smartsheet.sheetResources().rowResources().addRows( + 1639534409607044L, // sheet Id + Arrays.asList(rowA, rowB)); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify rows + var row = [ + { + "toTop": true, + "cells": [ + { + "columnId": 7960873114331012, + "value": true + }, + { + "columnId": 642523719853956, + "value": "New status", + "strict": false + } + ] + }, + { + "toTop": true, + "cells": [ + { + "columnId": 7960873114331012, + "value": true + }, + { + "columnId": 642523719853956, + "value": "New status", + "strict": false + } + ] + } + ]; + + // Set options + var options = { + sheetId: 2252168947361668, + body: row + }; + + // Add rows to sheet + smartsheet.sheets.addRows(options) + .then(function(newRows) { + console.log(newRows); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Specify cell values for one row + row_a = smartsheet.models.Row() + row_a.to_top = True + row_a.cells.append({ + 'column_id': 7960873114331012, + 'value': True + }) + row_a.cells.append({ + 'column_id': 642523719853956 + 'value': 'New Status', + 'strict': False + }) + + # Specify cell values for another row + row_b = smartsheet.models.Row() + row_b.to_top = True + row_b.cells.append({ + 'column_id': 7960873114331012, + 'value': True + }) + row_b.cells.append({ + 'column_id': 642523719853956 + 'value': 'New Status', + 'strict': False + }) + + # Add rows to sheet + response = smartsheet_client.Sheets.add_rows( + 2331373580117892, # sheet_id + [row_a, row_b]) + delete: + summary: Delete Rows + description: Deletes one or more rows from the sheet specified in the URL. + operationId: delete-rows + tags: + - rows + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/rowIds' + - $ref: '#/components/parameters/ignoreRowsNotFound' + responses: + '200': + description: >- + Returns [Result object](/api/smartsheet/openapi/schemas/result) + containing row Ids corresponding to all rows that were successfully + deleted (including any child rows of rows specified in the URL). + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + type: array + items: + type: number + '404': + $ref: '#/components/responses/404' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify 'ignoreRowsNotFound' parameter with value of 'true' + smartsheet.SheetResources.RowResources.DeleteRows( + 2252168947361668, // sheetId + new long[] { 207098194749316, 207098194749317 }, // rowIds + true // Boolean ignoreRowsNotFound + ); + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/sheets/{sheetId}/rows?ids={rowId1},{rowId2},{rowId3}&ignoreRowsNotFound=true' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify 'ignoreRowsNotFound' parameter with value of 'true' + smartsheet.sheetResources().rowResources().deleteRows( + 2252168947361668L, // long sheetId + new HashSet(Arrays.asList( + 207098194749316L, // long rowId, + 207098194749317L, // long additional rowId + 207098194749318L,) // long additional rowId + true // Boolean ignoreRowsNotFound + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 2252168947361668, + rowId: 207098194749316 + }; + + // Delete row + smartsheet.sheets.deleteRow(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Sheets.delete_rows( + 2252168947361668, # sheet_id + [207098194749316, 207098194749317]) # row_ids + put: + summary: Update Rows + description: > + Updates cell values in the specified rows, expands/collapses the + specified rows, or modifies the position of specified rows (including + indenting/outdenting). For detailed information about changing row + positions, see [location-specifier + attributes](/api/smartsheet/openapi/rows). + + + Note: This operation does not handle adding images to cells. However, + you can upload an image to a cell by calling the operation described in + the [Add Image to + Cell](/api/smartsheet/openapi/cellimages/addimagetocell) page. + operationId: update-rows + tags: + - rows + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/accessApiLevel' + - $ref: '#/components/parameters/Content-Type' + - $ref: '#/components/parameters/allowPartialSuccess' + - $ref: '#/components/parameters/overrideValidation' + requestBody: + description: > + [Row object](/api/smartsheet/openapi/rows/row) or an array of Row + objects, with the following attributes: + + * **id** (required) + + * One or more [location-specifier + attributes](/api/smartsheet/openapi/rows) (optional) + + * **expanded** (optional) + + * **format** (optional) + + * **cells** (optional) -- if specified, must be an array of [Cell + objects](/api/smartsheet/openapi/cells/cell), where each object is + limited to the following attributes: + * **columnId** (required) + * One of the following (required): + * **formula**: the formula for the cell. For cross-sheet formulas, you must first define a [cross-sheet reference](/api/smartsheet/openapi/crosssheetreferences) + * **value**: a desired value, a label for a **hyperlink** you're inserting (see below), or an empty string `""` if you're linking to another cell (see **linkInFromCell** below). + * **hyperlink**: (optional) a link to a report, sheet, or URL. Note, you must set the **value** attribute (e.g., set to a label you want or set to an empty string `""` to use the linked item's title). Specify the one attribute applicable to the item you're linking: + * **reportId** + * **sheetId** + * **url** + * **linkInFromCell** (optional) links in another cell's value. Smartsheet synchronizes the source cell into this cell. Note, the synchronization may take several minutes. Set all of the following attributes: + * **columnId** + * **rowId** + * **sheetId** + * **strict** (optional) - Set it `false` for lenient value parsing; default is `true`. See [Cell value parsing](/api/smartsheet/openapi/cells) for details. + * **format** (optional) + * **image** (optional) -- object for setting a cell image's attributes, such as its alternate text (e.g., `altText = string`). + * **overrideValidation** (optional) + * **locked** (optional) - **true** to lock the row or **false** to + unlock the row. + + + See [Column Types](/api/smartsheet/openapi/columns) for more + information. + + + **Note:** + + * Column Ids must be valid for the sheet to which the row belongs, and + must only be used once for each row in the operation. + + * Cells of a project sheet in the "Finish Date" column cannot be + updated via API. + + * Cells of a project sheet in the "Start Date" column cannot be + updated via API for rows that contain a value in the "Predecessor" + column. + + * Max length for a cell value is 4000 characters after which + truncation occurs without warning. Empty string values are converted + to null. + + * Calculation errors or problems with a formula do not cause the API + call to return an error code. Instead, the response contains the same + value as in the UI, such as cell.value = "#CIRCULAR REFERENCE". + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/Row' + - type: array + items: + $ref: '#/components/schemas/Row' + responses: + '200': + description: >- + Returns [Result object](/api/smartsheet/openapi/schemas/result) + containing an array of the updated rows. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + type: array + items: + $ref: '#/components/schemas/UpdateRowsObject' + default: + description: > + When **allowPartialSuccess=false** (or not specified): + + + If an error occurs, the [Error + object](/api/smartsheet/openapi/schemas/error) returned contains a + **detail** attribute set to an object with the following attribute: + + * **index**: the array index of the row that caused the error (0 if + a single Row was passed in) + + * **rowId**: the id of the row that caused the error (omitted if the + row was missing an Id) + + + If any error occurs, the entire request fails (no rows are added), + and the error response returned describes the first problem that was + encountered. For example: + + ``` + + { + + "errorCode": 1042, + + "message": "The cell value in column 5504245941200772 did not + conform to the strict requirements for type CHECKBOX." + + "detail": { + "index": 4 + "rowId": 6572427401553796 + } + } + + ``` + + When **allowPartialSuccess=true**: + + + When partial success is enabled, and one or more of the objects in + the request fail to be added/updated/deleted, a standard [Result + object](/api/smartsheet/openapi/schemas/result) is returned, but + with a **message** of **'PARTIAL_SUCCESS'** (instead of + **'SUCCESS'**), and a **resultCode** of **3**. Additionally, the + object contains a **failedItems** attribute -- an array of + [BulkItemFailure + objects](/api/smartsheet/openapi/schemas/bulkitemfailure) that + contains an item for each object in the request that failed to be + added/updated/deleted. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify updated value for first cell + + var cellToUpdateA = new Cell + + { + ColumnId = 7518312134403972, + Value = "new value" + }; + + + // Specify updated value for second cell + + var cellToUpdateB = new Cell + + { + ColumnId = 1888812600190852, + Value = "A" + }; + + + // Identify row and add new cell values to it + + var rowToUpdate = new Row + + { + Id = 6572427401553796, + Cells = new Cell[] { cellToUpdateA, cellToUpdateB } + }; + + + IList updatedRow = + smartsheet.SheetResources.RowResources.UpdateRows( + 2068827774183300, // sheet Id + new Row[] {rowToUpdate} + ); + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/rows \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X PUT \ + + -d '[{"id": "6572427401553796", "cells": [{"columnId": + 7518312134403972,"image": {"altText": "New Alt Text"},"value": "new + value"}, {"columnId": 1888812600190852,"value": "A"}]}, {"id": + "2068827774183300", "cells": [{"columnId": 7518312134403972,"value": + "desc_updated"}, {"columnId": 1888812600190852,"value": "B"}, + {"columnId": 6552023773538180,"objectValue": {"objectType": + "MULTI_CONTACT","values": [{"objectType": "CONTACT","email": + "john.doe@smartsheet.com","name": "John Doe"}, {"objectType": + "CONTACT","email": "jane.roe@smartsheet.com","name": "Jane + Roe"}]}}]}]' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify updated cell values for first row + + Cell cellA = new Cell(7518312134403972L) // column Id + .setValue("new value"); + + Cell cellB = new Cell(6392412227561348L) // column Id + .setValue(123); + + Row rowA = new Row(2068827774183300L); + rowA.setCells(Arrays.asList(cellA, cellB)); + + // Specify updated cell values for second row + + Cell cellC = new Cell(7518312134403972L) + .setValue("desc_updated"); + + Cell cellD = new Cell(6392412227561348L) + .setValue(456); + + Row rowB = new Row(6572427401553796L); + rowB.setCells(Arrays.asList(cellC, cellD)); + + // Update rows in sheet + + List updatedRows = + smartsheet.sheetResources().rowResources().updateRows( + 1639534409607044L, // long sheetId + Arrays.asList(rowA, rowB) + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify updated cell values + var row = [ + { + "id": "6572427401553796", + "cells": [ + { + "columnId": 7518312134403972, + "value": "new value" + }, + { + "columnId": 1888812600190852, + "value": "A" + } + ] + }, + { + "id": "2068827774183300", + "cells": [ + { + "columnId": 7518312134403972, + "value": "desc_updated" + }, + { + "columnId": 1888812600190852, + "value": "B" + } + ] + } + ]; + + // Set options + var options = { + sheetId: 2068827774183300, + body: row + }; + + // Update rows in sheet + smartsheet.sheets.updateRow(options) + .then(function(updatedRows) { + console.log(updatedRows); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Build new cell value + new_cell = smartsheet.models.Cell() + new_cell.column_id = 7036894123976580 + new_cell.value = "new value" + new_cell.strict = False + + # Build the row to update + new_row = smartsheet.models.Row() + new_row.id = 6809535313667972 + new_row.cells.append(new_cell) + + # Update rows + updated_row = smartsheet_client.Sheets.update_rows( + 2068827774183300, # sheet_id + [new_row]) + /sheets/{sheetId}/rows/emails: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + post: + summary: Send Rows via Email + description: Sends one or more rows via email. + operationId: rows-send + tags: + - rows + security: + - APIToken: [] + - OAuth2: + - SHARE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + description: > + The columns included for each row in the email are populated according + to the following rules: + + * If the **columnIds** attribute of the MultiRowEmail object is + specified as an array of column Ids, those specific columns are + included. + + * If the **columnIds** attribute of the MultiRowEmail object is + omitted, all columns except hidden columns shall be included. + + * If the **columnIds** attribute of the MultiRowEmail object is + specified as empty, no columns shall be included. (**Note:** In this + case, either **includeAttachments=true** or + **includeDiscussions=true** must be specified.) + content: + application/json: + schema: + $ref: '#/components/schemas/MultiRowEmail' + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify recipients + + Recipient[] recipients = new Recipient[] { + new Recipient { Email = "recipient@smartsheet.com" } + }; + + + // Configure email + + MultiRowEmail multiRowEmail = new MultiRowEmail { + SendTo = recipients, + Subject = "some subject", + Message = "some message", + CcMe = false, + RowIds = new long[] { 6327127650920324, 3404239197235076 }, + ColumnIds = new long[] { 5190835902932868, 3791509922310020 }, + IncludeAttachments = false, + IncludeDiscussions = false + }; + + + // Send rows via email + + smartsheet.SheetResources.RowResources.SendRows(4293147074291588, + multiRowEmail); // sheetId + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/emails \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" \ + -X POST \ + -d '{ + "sendTo": [ + {"email": "recipient@smartsheet.com"} + ], + "subject": "Check these rows out!", + "message": "Here are the rows I mentioned in our meeting", + "ccMe": false, + "rowIds": [ + 6327127650920324, 3404239197235076 + ], + "columnIds": [ + 5190835902932868, 3791509922310020 + ], + "includeAttachments": false, + "includeDiscussions": false + }' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify recipients + + RecipientEmail recipientEmail = new + RecipientEmail.AddRecipientEmailBuilder() + .setEmail("recipient@smartsheet.com") + .build(); + + List recipients = new ArrayList(); + + recipients.add(recipientEmail); + + + // Configure email + + MultiRowEmail multiRowEmail = new + MultiRowEmail.AddMultiRowEmailBuilder() + .setSendTo(recipients) + .setSubject("some subject") + .setMessage("some message") + .setCcMe(false) + .setRowIds(Arrays.asList(6327127650920324L, 3404239197235076L) + .setColumnIds(Arrays.asList(5190835902932868L, 3791509922310020L) + .setIncludeAttachments(false) + .setIncludeDiscussions(false) + .build(); + + // Send rows via email + + smartsheet.sheetResources().rowResources().sendRows(4293147074291588L, + multiRowEmail); // sheetId + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Configure email + var email = { + "sendTo": [ + { + "email": "john.doe@smartsheet.com" + }, + { + "groupId": 2258118617917316 + } + ], + "subject": "Check these rows out!", + "message": "Here are the rows I mentioned in our meeting", + "ccMe": false, + "includeDiscussions": false, + "includeAttachments": true, + "rowIds": [ + 1049041315358596, + 5552640942729092 + ] + }; + + // Set options + var options = { + "body": email, + "sheetId": 2252168947361668 + }; + + // Send row via email + smartsheet.sheets.sendRows(options) + .then(function(data) { + console.log(data); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Configure email + email = smartsheet.models.MultiRowEmail() + email.send_to = smartsheet.models.Recipient({ + 'email': 'john.doe@smartsheet.com' + }) + email.row_ids = [6327127650920324, 3404239197235076] + email.column_ids = [5190835902932868, 3791509922310020] + + # Send rows via email + response = smartsheet_client.Sheets.send_rows( + 4293147074291588, # sheet_id + email) + /sheets/{sheetId}/rows/copy: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + post: + summary: Copy Rows to Another Sheet + description: >- + Copies rows from the sheet specified in the URL to (the bottom of) + another sheet. + operationId: copy-rows + tags: + - rows + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + - $ref: '#/components/parameters/copyRowsInclude' + - $ref: '#/components/parameters/ignoreRowsNotFoundForCopyRows' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CopyOrMoveRowDirective' + responses: + '200': + description: CopyOrMoveRowResult object + content: + application/json: + schema: + $ref: '#/components/schemas/CopyOrMoveRowResult' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify destination sheet + + CopyOrMoveRowDestination destination = new CopyOrMoveRowDestination + { SheetId = 2258256056870788 }; + + + // Specify rows to be copied (and destination sheet) + + CopyOrMoveRowDirective directive = new CopyOrMoveRowDirective { + RowIds = new long[] { 145417762563972, 8026717110462340 }, To = + destination }; + + + // Sample 1: Omit 'include' and 'ignoreRowsNotFound' parameters + + CopyOrMoveRowResult results = + smartsheet.SheetResources.RowResources.CopyRowsToAnotherSheet( + 4583173393803140, // sheetId + directive, + null, // IEnumerable include + null // Nullable ignoreRowsNotFound + ); + + + // Sample 2: Specify 'include' parameter with value of "CHILDREN", + and 'ignoreRowsNotFound' parameter with value of 'true' + + CopyOrMoveRowResult results = + smartsheet.SheetResources.RowResources.CopyRowsToAnotherSheet( + 4583173393803140, // sheetId + directive, + new CopyRowInclusion[] { + CopyRowInclusion.CHILDREN }, + true + ); + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/copy \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '{ "rowIds": [145417762563972, 8026717110462340], "to": + {"sheetId": 2258256056870788} }' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify destination sheet + + CopyOrMoveRowDestination destination = new + CopyOrMoveRowDestination() + .setSheetId(2258256056870788L); + + // Specify rows to be copied (and destination sheet) + + CopyOrMoveRowDirective directive = new CopyOrMoveRowDirective() + .setRowIds(Arrays.asList(145417762563972L, 8026717110462340L)) + .setTo(destination); + + // Sample 1: Omit 'include' and 'ignoreRowsNotFound' parameters + + CopyOrMoveRowResult results = + smartsheet.sheetResources().rowResources().copyRows( + 4583173393803140L, // long sheetId + null, // EnumSet includes + true, // Boolean ignoreRowsNotFound + directive + ); + + // Sample 2: Specify 'include' parameter with value of "CHILDREN", + and 'ignoreRowsNotFound' parameter with value of 'true' + + CopyOrMoveRowResult results = + smartsheet.sheetResources().rowResources().copyRows( + 4583173393803140L, // long sheetId + EnumSet.of(RowCopyInclusion.CHILDREN), + true, + directive + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify the directive + var copyRow = { + "rowIds": [145417762563972,8026717110462340], + "to": { + "sheetId": 2258256056870788 + } + }; + + // Set options + var options = { + sheetId: 4583173393803140, + body: copyRow + }; + + // Copy rows + smartsheet.sheets.copyRowToAnotherSheet(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + response = smartsheet_client.Sheets.copy_rows( + 4583173393803140, # sheet_id of rows to be copied + smartsheet.models.CopyOrMoveRowDirective({ + 'row_ids': [145417762563972, 8026717110462340], + 'to': smartsheet.models.CopyOrMoveRowDestination({ + 'sheet_id': 2258256056870788 + }) + }) + ) + /sheets/{sheetId}/rows/move: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + post: + summary: Move Rows to Another Sheet + description: >- + Moves rows from the sheet specified in the URL to (the bottom of) + another sheet. + operationId: move-rows + tags: + - rows + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + - $ref: '#/components/parameters/moveRowsInclude' + - $ref: '#/components/parameters/ignoreRowsNotFoundForMoveRows' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CopyOrMoveRowDirective' + responses: + '200': + description: CopyOrMoveRowResult object + content: + application/json: + schema: + $ref: '#/components/schemas/CopyOrMoveRowResult' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify destination sheet + + CopyOrMoveRowDestination destination = new CopyOrMoveRowDestination + { SheetId = 2258256056870788 }; + + + // Specify rows to be moved (and destination sheet) + + CopyOrMoveRowDirective directive = new CopyOrMoveRowDirective { + RowIds = new long[] { 145417762563972, 8026717110462340 }, To = + destination }; + + + // Sample 1: Omit 'include' and 'ignoreRowsNotFound' parameters + + CopyOrMoveRowResult results = + smartsheet.SheetResources.RowResources.MoveRowsToAnotherSheet( + 4583173393803140, // sheetId + directive, + null, // IEnumerable include + null // Nullable ignoreRowsNotFound + ); + + + // Sample 2: Specify 'include' parameter with value of "ATTACHMENTS" + and "DISCUSSIONS", and 'ignoreRowsNotFound' parameter with value of + 'true' + + CopyOrMoveRowResult results = + smartsheet.SheetResources.RowResources.MoveRowsToAnotherSheet( + 4583173393803140, // sheetId + directive, + new MoveRowInclusion[] { + MoveRowInclusion.ATTACHMENTS, + MoveRowInclusion.DISCUSSIONS }, + true // Nullable ignoreRowsNotFound + ); + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/move \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '{ "rowIds": [145417762563972, 8026717110462340], "to": + {"sheetId": 2258256056870788} }' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify destination sheet + + CopyOrMoveRowDestination destination = new + CopyOrMoveRowDestination() + .setSheetId(2258256056870788L); + + // Specify rows to be moved (and destination sheet) + + CopyOrMoveRowDirective directive = new CopyOrMoveRowDirective() + .setRowIds(Arrays.asList(145417762563972L, 8026717110462340L)) + .setTo(destination); + + // Sample 1: Omit 'include' and 'ignoreRowsNotFound' parameters + + CopyOrMoveRowResult results = + smartsheet.sheetResources().rowResources().moveRows( + 4583173393803140L, // long sheetId + null, // EnumSet includes + true, // Boolean ignoreRowsNotFound + directive + ); + + // Sample 2: Specify 'include' parameter with value of "ATTACHMENTS" + and "DISCUSSIONS", and 'ignoreRowsNotFound' parameter with value of + 'true' + + CopyOrMoveRowResult results = + smartsheet.sheetResources().rowResources().moveRows( + 4583173393803140L, // long sheetId + EnumSet.of( + RowMoveInclusion.ATTACHMENTS, + RowMoveInclusion.DISCUSSIONS), + true, // Boolean ignoreRowsNotFound + directive + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify the directive + var moveRow = { + "rowIds": [145417762563972,8026717110462340], + "to": { + "sheetId": 2258256056870788 + } + }; + + // Set options + var options = { + sheetId: 4583173393803140, + body: moveRow + }; + + // Move rows + smartsheet.sheets.moveRowToAnotherSheet(options) + .then(function(movedRow) { + console.log(movedRow); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + response = smartsheet_client.Sheets.move_rows( + 4583173393803140, # sheet_id of rows to be moved + smartsheet.models.CopyOrMoveRowDirective({ + 'row_ids': [145417762563972, 8026717110462340], + 'to': smartsheet.models.CopyOrMoveRowDestination({ + 'sheet_id': 2258256056870788 + }) + }) + ) + /sheets/{sheetId}/rows/{rowId}: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/rowId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Get Row + description: Gets the row specified in the URL. + operationId: row-get + parameters: + - $ref: '#/components/parameters/accessApiLevel' + - $ref: '#/components/parameters/rowInclude' + - $ref: '#/components/parameters/sheetExclude' + - $ref: '#/components/parameters/sheetLevel' + tags: + - rows + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: >- + Returns [Row object]() populated according to the specified + parameters. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GetRowObject' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit 'include' parameter and pagination parameters + + Row row = smartsheet.SheetResources.RowResources.GetRow( + 4583173393803140, // sheetId + 2361756178769796, // rowId + null, // IEnumerable include + null // IEnumerable exclude + ); + + + // Specify 'include' parameter with values of "COLUMNS" and + "COLUMN_TYPE", and 'exclude' parameter with value of + "NONEXISTENT_CELLS" + + Row row = smartsheet.SheetResources.RowResources.GetRow( + 4583173393803140, // sheetId + 2361756178769796, // rowId + new RowInclusion[] { + RowInclusion.COLUMNS, + RowInclusion.COLUMN_TYPE }, + new ObjectExclusion[] { ObjectExclusion.NONEXISTENT_CELLS } + ); + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}?include=discussions,attachments,columns,columnType' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Sample 1: Omit 'include' parameter and pagination parameters + + Row row = smartsheet.sheetResources().rowResources().getRow( + 4583173393803140L, // long sheetId + 2361756178769796L, // long rowId + null, // EnumSet includes + null // EnumSet excludes + ); + + // Sample 2: Specify 'include' parameter with values of "COLUMNS" + and "COLUMN_TYPE", and 'exclude' parameter with value of + "NONEXISTENT_CELLS" + + Row row = smartsheet.sheetResources().rowResources().getRow( + 4583173393803140L, // long sheetId + 2361756178769796L, // long rowId + EnumSet.of( + RowInclusion.COLUMNS, + RowInclusion.COLUMN_TYPE), + EnumSet.of( + ObjectExclusion.NONEXISTENT_CELLS) + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 4583173393803140, + rowId: 2361756178769796 + }; + + // Get row + smartsheet.sheets.getRow(options) + .then(function(row) { + console.log(row); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + # Sample 1: Get row + + row = smartsheet_client.Sheets.get_row( + 4583173393803140, # sheet_id + 2361756178769796 # row_id + ) + + + # Sample 2: Include discussions, attachments, columns, and + columnType + + row = smartsheet_client.Sheets.get_row( + 4583173393803140, # sheet_id + 2361756178769796, # row_id + include='discussions,attachments,columns,columnType' + ) + /sheets/{sheetId}/rows/{rowId}/attachments: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/rowId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Row Attachments + description: > + Gets a list of all attachments that are on the row, including row and + discussion-level attachments. + operationId: attachments-listOnRow + tags: + - attachments + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/includeAll' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: list of attachments + type: array + items: + $ref: '#/components/schemas/Attachment' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PaginatedResult attachments = + smartsheet.SheetResources.RowResources.AttachmentResources.ListAttachments( + 2252168947361668, // sheetId + 4293147074291588, // rowId + null // PaginationParameters + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}/attachments + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination + + PagedResult attachments = + smartsheet.sheetResources().rowResources().attachmentResources().getAttachments( + 2252168947361668L, // long sheetId + 4293147074291588L, // long rowId + null // PaginationParameters + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 2252168947361668, + rowId: 4293147074291588 + }; + + // List row attachments + smartsheet.sheets.getRowAttachments(options) + .then(function(attachmentsList) { + console.log(attachmentsList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List all + response = smartsheet_client.Attachments.list_row_attachments( + 2252168947361668, # sheet_id + 4293147074291588, # row_id + include_all=True) + attachments = response.data + + # Sample 2: Paginate the list + response = smartsheet_client.Attachments.list_row_attachments( + 2252168947361668, # sheet_id + 4293147074291588, # row_id + page_size=10, + page=1) + pages = response.total_pages + attachments = response.data + post: + summary: Attach File or URL to Row + description: > + Attaches a file to the row. The URL can be any of the following: + + + * Normal URL (attachmentType "LINK") + + * Box.com URL (attachmentType "BOX_COM") + + * Dropbox URL (attachmentType "DROPBOX") + + * Egnyte URL (attachmentType "EGNYTE") + + * Evernote URL (attachmentType "EVERNOTE") + + * Google Drive URL (attachmentType "GOOGLE_DRIVE") + + * OneDrive URL (attachmentType "ONEDRIVE") + + + > **Important:** Smartsheet Gov allows only the following attachment + types: + + > - BOX_COM + + > - FILE + + > - GOOGLE_DRIVE + + > - LINK + + > - ONEDRIVEß + + + For multipart uploads please use "multipart/form-data" content type. + + + > **Note:** Posting a file attachment is resource-intensive and is + limited to **30 requests per minute per API token**. For details, see + [Rate + limiting](/api/smartsheet/guides/advanced-topics/scalability-options#rate-limiting). + operationId: row-attachments-attachFile + tags: + - attachments + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/octet-stream: + schema: + type: string + format: binary + multipart/form-data: + schema: + type: object + properties: + name: + type: string + filename: + type: string + format: binary + application/json: + schema: + $ref: '#/components/schemas/URLAttachmentRequest' + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Attachment' + properties: + version: + description: >- + New version of the sheet. Applicable only for operations + which update sheet data. + type: number + nullable: true + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + Attachment attachment = + smartsheet.SheetResources.RowResources.AttachmentResources.AttachFile( + 9283173393803140, // sheetId + 0123456789012345, // rowId + filePath, + "application/msword" + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}/attachments + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/msword" \ + + -H 'Content-Disposition: attachment; filename="ProgressReport.docx"' + \ + + -H "Content-Length: FILE_SIZE" \ + + -X POST \ + + --data-binary @ProgressReport.docx + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify file to be attached + File file = new File("/Users/jdoe/Documents/ProgressReport.docx"); + + // Attach file to row + Attachment attachment = smartsheet.sheetResources().rowResources().attachmentResources().attachFile( + 9283173393803140L, // long sheetId + 0123456789012345L, // long rowId + file, + "application/msword" + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Enable FileStream + var fs = require("fs") + + // Set options + var options = { + sheetId: 1696803624483716, + rowId: 1049041355358596, + fileSize: 20765, + fileName: "ProgressReport.docx", + fileStream: fs.createReadStream("/Users/jdoe/Documents/ProgressReport.docx") + }; + + // Attach file to row + smartsheet.sheets.addRowFileAttachment(options) + .then(function(attachment) { + console.log(attachment); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + updated_attachment = + smartsheet_client.Attachments.attach_file_to_row( + 9283173393803140, # sheet_id + 0123456789012345, # row_id + ('ProgressReport.docx', + open('/path/to/ProgressReport.docx', 'rb'), + 'application/msword') + ) + /sheets/{sheetId}/rows/{rowId}/columns/{columnId}/cellimages: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/rowId' + - $ref: '#/components/parameters/columnId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + post: + summary: Add Image to Cell + description: Uploads an image to the specified cell within a sheet. + operationId: addImageToCell + tags: + - cellImages + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + - $ref: '#/components/parameters/Content-Disposition' + - $ref: '#/components/parameters/Content-Length' + - $ref: '#/components/parameters/altText' + - $ref: '#/components/parameters/overrideValidation' + requestBody: + content: + application/octet-stream: + schema: + type: string + format: binary + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + properties: + result: + $ref: '#/components/schemas/Row' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + Image image = new Image + { + AltText = "Caution Sign", + Height = 16, + Width = 16 + }; + + smartsheet.SheetResources.RowResources.CellResources.AddImageToCell( + 1696831624483716, // sheetId + 1049441315358596, // rowId + 74761903175665540, // columnId + "/Users/jdoe/Documents/images/img_pl_decisionshapesHold.png", + "image" + ); + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}/columns/{columnId}/cellimages?altText=my%20image' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: image/jpeg" \ + + -H 'Content-Disposition: attachment; filename="picture.jpg"' \ + + -H "Content-Length: FILE_SIZE" \ + + -X POST \ + + --data-binary @picture.jpg + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + Image image = new Image() + .setAltText("Caution sign") + .setHeight(16L) + .setWidth(16L); + + smartsheet.sheetResources().rowResources().cellResources().addImageToCell( + 1639534409607044L, // sheetId + 1049441315358596L, // rowId + 74761903175665540L, // columnId + "/Users/jdoe/Documents/images/img_pl_decisionshapesHold.png", + "image" + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Enable FileStream + var fs = require("fs") + + // Set options + var options = { + sheetId: 1696831624483716, + rowId: 1049441315358596, + columnId: 74761903175665540, + fileSize: 458, // Must be exact bytes; no rounding + fileName: "img_pl_decisionshapesHold.png", + fileStream: fs.createReadStream("/Users/jroe/Documents/images/img_pl_decisionshapesHold.png"), + queryParameters: { + "altText": "Caution sign", + "overrideValidation": true + } + }; + + // Add image to cell + smartsheet.sheets.addImageToCell(options) + .then(function(image) { + console.log(image); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + sheet_id = 1696831624483716 + + column_id = 74761903175665540 + + row_id = 1049441315358596 + + caution_pic = + "/Users/jdoe/Documents/images/img_pl_decisionshapesHold.png" + + file_type = "png" + + smartsheet_client.Cells.add_image_to_cell(sheet_id, row_id, + column_id, caution_pic, file_type) + /sheets/{sheetId}/rows/{rowId}/columns/{columnId}/history: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/rowId' + - $ref: '#/components/parameters/columnId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Cell History + description: > + Gets the cell modification history. + + + > **Note:** Fetching cell history is resource-intensive and is limited + to **30 requests per minute per API token**. For details, see [Rate + limiting](/api/smartsheet/guides/advanced-topics/scalability-options#rate-limiting). + operationId: cellHistory-get + parameters: + - $ref: '#/components/parameters/cellHistoryInclude' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/sheetLevel' + tags: + - cells + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: List of cell history objects + type: array + items: + $ref: '#/components/schemas/CellHistory' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Sample 1: Omit 'include' parameter and pagination parameters + + PaginatedResult results = + smartsheet.SheetResources.RowResources.CellResources.GetCellHistory( + 9283173393803140, // sheetId + 0123456789012345, // rowId + 4567890123456789, // columnId + null, // IEnumerable includes + null // PaginationParameters + ); + + + // Sample 2: Specify 'include' parameter with value of "COLUMN_TYPE" + and 'includeAll' parameter with value of 'true' + + PaginatedResult results = + smartsheet.SheetResources.RowResources.CellResources.GetCellHistory( + 9283173393803140, // sheetId + 0123456789012345, // rowId + 4567890123456789, // columnId + new CellInclusion[] { CellInclusion.COLUMN_TYPE }, + new PaginationParameters( + true, // Boolean includeAll + null, // int pageSize + null) // int page + ); + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}/columns/{columnId}/history?include=columnType' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination + + PagedResult cellHistory = + smartsheet.sheetResources().rowResources().cellResources().getCellHistory( + 9283173393803140L, // long sheetId + 0123456789012345L, // long rowId + 4567890123456789L, // long columnId + null // PaginationParameters + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 9283173393803140, + rowId: 0123456789012345, + columnId: 4567890123456789 + }; + + // Get cell history + smartsheet.sheets.getCellHistory(options) + .then(function(history) { + console.log(history); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: Get history + response = smartsheet_client.Cells.get_cell_history( + 9283173393803140, # sheet_id + 0123456789012345, # row_id + 4567890123456789, # column_id + include_all=True) + revisions = response.data + + # Sample 2: Paginate the list + response = smartsheet_client.Cells.get_cell_history( + 9283173393803140, # sheet_id + 0123456789012345, # row_id + 4567890123456789, # column_id + page_size=5, + page=1) + pages = response.total_pages + revisions = response.data + /sheets/{sheetId}/rows/{rowId}/discussions: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/rowId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Discussions with a Row + description: > + Gets a list of all discussions associated with the specified row. + Remember that discussions are containers + + for the conversation thread. To see the entire thread, use the + include=comments parameter. + operationId: row-discussions-list + tags: + - discussions + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/discussionInclude' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/includeAll' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: list of discussions + type: array + items: + $ref: '#/components/schemas/Discussion' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Sample 1: Omit 'include' parameter and pagination parameters + + PaginatedResult results = + smartsheet.SheetResources.RowResources.DiscussionResources.ListDiscussions( + 2252168947361668, // sheetId + 4293147074291588, // rowId + null, // IEnumerable include + null // PaginationParameters + ); + + + // Sample 2: Specify 'include' parameter with values of 'COMMENTS' + and 'ATTACHMENTS', and 'includeAll' parameter with value of 'true' + + PaginatedResult results = + smartsheet.SheetResources.RowResources.DiscussionResources.ListDiscussions( + 2252168947361668, // sheetId + 4293147074291588, // rowId + new DiscussionInclusion[] { DiscussionInclusion.COMMENTS, DiscussionInclusion.ATTACHMENTS }, + new PaginationParameters( + true, // includeAll + null, // int pageSize + null) // int page + ); + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}/discussions?include=comments,attachments' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Sample 1: Omit 'include' parameter and pagination parameters + + PagedResult results = + smartsheet.sheetResources().rowResources().discussionResources().listDiscussions( + 2252168947361668L, // long sheetId + 4293147074291588L, // long rowId + null, // PaginationParameters + null // EnumSet includes + ); + + // Sample 2: Specify pagination parameter 'includeAll' + + PaginationParameters parameters = new PaginationParameters() + .setIncludeAll(true); + + // Get all row discussions (specify 'include' parameter with values + of 'COMMENTS' and 'ATTACHMENTS', and 'includeAll' parameter with + value of 'true') + + PagedResult results = + smartsheet.sheetResources().rowResources().discussionResources().listDiscussions( + 2252168947361668L, // long sheetId + 4293147074291588L, // long rowId + parameters, + EnumSet.of(DiscussionInclusion.COMMENTS, DiscussionInclusion.ATTACHMENTS) + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 2252168947361668, + rowId: 4293147074291588 + }; + + // List row discussions + smartsheet.sheets.getRowDiscussions(options) + .then(function(discussionList) { + console.log(discussionList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List all + response = smartsheet_client.Discussions.get_row_discussions( + 2252168947361668, # sheet_id + 4293147074291588, # row_id + include_all=True) + discussions = response.data + + # Sample 2: Paginate the list + response = smartsheet_client.Discussions.get_row_discussions( + 2252168947361668, # sheet_id + 4293147074291588, # row_id + page_size=10) + pages = response.total_pages # starts on page 1 by default + discussions = response.data + post: + summary: Create a Discussion on a Row + description: > + Creates a new discussion on a row. To create a discussion with an + attachment please use "multipart/form-data" content type. + operationId: row-discussions-create + tags: + - discussions + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DiscussionCreationRequest' + multipart/form-data: + schema: + $ref: '#/components/schemas/DiscussionCreationRequestWithAttachment' + encoding: + discussion: + contentType: application/json + file: + contentType: application/octet-stream + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Discussion' + properties: + version: + description: >- + New version of the sheet. Applicable only for operations + which update sheet data. + type: number + nullable: true + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Example request: create discussion on row (without attachment) + + + // Create discussion (including the comment) + + Discussion discussionSpecification = new Discussion + + { + Comment = new Comment + { + Text = "This text is the body of the first comment" + }, + Comments = null // workaround for SDK issue + }; + + + // Add discussion to row + + Discussion newDiscussion = + smartsheet.SheetResources.RowResources.DiscussionResources.CreateDiscussion( + 9283173393803140, // sheetId + 0123456789012345, // rowId + discussionSpecification + ); + + + // Example request: create discussion on row (with attachment) + + + // Create discussion (including the comment) + + Discussion discussionSpecification = new Discussion + + { + Comment = new Comment + { + Text = "This text is the body of the first comment" + }, + Comments = null // workaround for SDK issue + }; + + + // Add discussion to row + + Discussion newDiscussion = + smartsheet.SheetResources.RowResources.DiscussionResources.CreateDiscussionWithAttachment( + 9283173393803140, // sheetId + 0123456789012345, // rowId + discussionSpecification, + filePath, + "application/octet-stream" + ); + - lang: cURL + label: cURL + source: > + # Example request: create discussion on row (without attachment) + + + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}/discussions + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '{"comment": {"text":"This text is the body of the first + comment"}}' + + + # Example request: create discussion on row (with attachment) + + + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}/discussions + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: multipart/form-data" \ + + -X POST \ + + -F 'discussion={ "comment": { "text": "This text is the body of the + first comment" } };type=application/json' \ + + -F "file=@insurance_benefits.pdf;type=application/octet-stream" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Example request: create discussion on row (without attachment) + + // Create comment + Comment commentSpecification = new Comment() + .setText("This text is the body of the first comment"); + + // Create discussion (including the comment) + Discussion discussionSpecification = new Discussion() + .setComment(commentSpecification) + .setComments(null); // workaround for SDK issue + + // Add discussion to row + Discussion newDiscussion = smartsheet.sheetResources().rowResources().discussionResources().createDiscussion( + 9283173393803140L, // sheetId + 0123456789012345L, // rowId + discussionSpecification + ); + + // Example request: create discussion on row (with attachment) + + // Create comment + Comment commentSpecification = new Comment() + .setText("This text is the body of the first comment"); + + // Create discussion (including the comment) + Discussion discussionSpecification = new Discussion() + .setComment(commentSpecification) + .setComments(null); // workaround for SDK issue + + // Set file path + File file = new File(filePath); + + // Add discussion to row + Discussion newDiscussion = smartsheet.sheetResources().rowResources().discussionResources().createDiscussionWithAttachment( + 9283173393803140L, // long sheetId + 0123456789012345L, // long rowId + discussionSpecification, + file, + "application/octet-stream" + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Example request: create discussion on row (without attachment) + + + // Specify discussion + + var discussion = { + "comment": { + "text": "This text is the body of the first comment" + } + }; + + + // Set options + + var options = { + sheetId: 2252168947361668, + rowId: 4293147074291588, + body: discussion + }; + + // Add discussion to row + + smartsheet.sheets.createRowDiscussion(options) + .then(function(newDiscussion) { + console.log(newDiscussion); + }) + .catch(function(error) { + console.log(error); + }); + + // Example request: create discussion on row (with attachment) + + + // Multipart operations are not supported by the Node SDK. Instead, + see instructions to Create Discussion on Row, and then Attach File + to Comment. + - lang: Python SDK + label: Python SDK + source: > + # Example request: create discussion on row (without attachment) + + + response = smartsheet_client.Discussions.create_discussion_on_row( + 9283173393803140, # sheet_id + 0123456789012345, # row_id + smartsheet.models.Discussion({ + 'comment': smartsheet.models.Comment({ + 'text': 'This text is the body of the first comment' + }) + }) + ) + + + # Example request: create discussion on row (with attachment) + + + # Add discussion to row + + response = + smartsheet_client.Discussions.create_discussion_on_row_with_attachment( + 9283173393803140, # sheet_id + 0123456789012345, # row_id + smartsheet.models.Discussion({ + 'comment': smartsheet.models.Comment({ + 'text': 'This text is the body of the first comment' + }) + }), + ('photo.jpg', open('/path/to/photo.jpg', 'rb'), 'image/jpeg') + ) + /sheets/{sheetId}/rows/{rowId}/proofs: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/rowId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + post: + summary: Create Proof + description: | + Creates a proof on a row. + operationId: proofs-create + tags: + - proofs + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/octet-stream: + schema: + type: string + format: binary + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Proof' + properties: + version: + description: >- + New version of the sheet. Applicable only for operations + which update sheet data. + type: number + nullable: true + x-codeSamples: + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}/proofs + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Disposition: attachment; filename="giphy.gif"" \ + + -H "Content-Type: image/gif" \ + + --data-binary @giphy.gif \ + + -X POST + /sheets/{sheetId}/sentupdaterequests: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Sent Update Requests + description: | + Gets a summarized list of all sent update requests on the sheet. + Only the following fields are returned in the response: + * **id** + * **message** + * **sendTo** + * **sentAt** + * **sentBy** + * **status** + * **subject** + * **updateRequestId** + operationId: sentupdaterequests-list + tags: + - updateRequests + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: The list of SentUpdateRequest objects + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: list of Sent Update Requests + type: array + items: + $ref: '#/components/schemas/SentUpdateRequest' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + # Example request: list sent update requests + + + PaginatedResult results = + smartsheet.SheetResources.UpdateRequestResources.ListSentUpdateRequests( + 1639534409607044, // sheetId + null // PaginationParameters + ); + - lang: cURL + label: cURL + source: > + # Example request: list sent update requests + + + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/sentupdaterequests \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + # Example request: list sent update requests + + + PagedResult results = + smartsheet.sheetResources().updateRequestResources().listSentUpdateRequests( + 1639534409607044L, // long sheetId + null // PaginationParameters + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + # Example request: list sent update requests + + // Set options + var options = { + sheetId: 1639534409607044 + }; + + // List sent update requests + smartsheet.sheets.getAllSentUpdateRequests(options) + .then(function(requestsList) { + console.log(requestsList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List sent update requests + response = smartsheet_client.Sheets.list_sent_update_requests( + 5190835902932868) # sheet_id + update_requests = response.data + + # Sample 2: Paginate the list of sent update requests + response = smartsheet_client.Sheets.list_sent_update_requests( + 5190835902932868, # sheet_id + page_size=10, + page=1) + pages = response.total_pages + update_requests = response.data + /sheets/{sheetId}/sentupdaterequests/{sentUpdateRequestId}: + parameters: + - $ref: '#/components/parameters/sheetId' + - name: sentUpdateRequestId + in: path + required: true + description: ID of the sent update request + schema: + type: string + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Get Sent Update Request + description: | + Gets the specified sent update request on the sheet. + operationId: sentupdaterequest-get + tags: + - updateRequests + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: SentUpdateRequest object + content: + application/json: + schema: + $ref: '#/components/schemas/SentUpdateRequest' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + # Example request: get sent update request + + + SentUpdateRequest results = + smartsheet.SheetResources.UpdateRequestResources.GetSentUpdateRequest( + 3285357287499652, // sheetId + 2303451729291140 // sentUpdateRequestId + ); + - lang: cURL + label: cURL + source: > + # Example request: get sent update request + + + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/sentupdaterequests/{sentUpdateRequestId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + # Example request: get sent update request + + + SentUpdateRequest results = + smartsheet.sheetResources().updateRequestResources().getSentUpdateRequest( + 1639534409607044L, // long sheetId + 67287475611524L // long sentUpdateRequestId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + # Example request: get sent update request + + // Set options + var options = { + sheetId: 1639534409607044, + sentUpdateRequestId: 67287475611524 + }; + + // Get sent update request + smartsheet.sheets.getSentUpdateRequest(options) + .then(function(updateRequest) { + console.log(updateRequest); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Example request: get sent update request + + response = smartsheet_client.Sheets.get_sent_update_request( + 5190835902932868, # sheet_id + 7510551698925444 # update_request_id + ) + delete: + summary: Delete Sent Update Request + description: > + Deletes the specified sent update request. + + + **Delete operation is supported only when the specified sent update + request is in the pending status. + + Deleting a sent update request that was already completed by recipient + is not allowed.** + operationId: sentupdaterequest-delete + tags: + - updateRequests + security: + - APIToken: [] + - OAuth2: + - ADMIN_SHEETS + - WRITE_SHEETS + responses: + '200': + description: Result object + content: + application/json: + schema: + $ref: '#/components/schemas/Result' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + # Example request: delete sent update request + + + smartsheet.SheetResources.UpdateRequestResources.DeleteSentUpdateRequest( + 3285357287499652, // sheetId + 2303451729291140 // sentUpdateRequestId + ); + - lang: cURL + label: cURL + source: > + # Example request: delete sent update request + + + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/sentupdaterequests/{sentUpdateRequestId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + # Example request: delete sent update request + + + smartsheet.sheetResources().updateRequestResources().deleteSentUpdateRequest( + 1639534409607044L, // long sheetId + 965780272637828L // long sentUpdateRequestId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + # Example request: delete sent update request + + // Set options + var options = { + sheetId: 1639534409607044, + sentUpdateRequestId: 965780272637828 + }; + + // Delete sent update request + smartsheet.sheets.deleteSentUpdateRequest(options) + .then(function(result) { + console.log(result); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Example request: delete sent update request + + smartsheet_client.Sheets.delete_sent_update_request( + 5190835902932868, # sheet_id + 381297098024836 # sent_update_request_id + ) + /sheets/{sheetId}/summary: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Get Sheet Summary + description: >- + Returns object containing array of summary fields. Allows for pagination + of results. + operationId: list-summary-fields + tags: + - sheetSummary + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/sheetSummaryInclude' + - $ref: '#/components/parameters/sheetSummaryExclude' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SheetSummary' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.SheetResources.SummaryResources.GetSheetSummary( + 1421228469708676, // sheetId + new List { SummaryFieldInclusion.FORMAT, SummaryFieldInclusion.WRITER_INFO }, + new List { SummaryFieldExclusion.DISPLAY_VALUE } + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/summary?include=writerInfo + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.sheetResources().summaryResources().getSheetSummary( + 1421228469708676L, // long sheetId + EnumSet.of(SummaryFieldInclusion.FORMAT, SummaryFieldInclusion.WRITERINFO), + EnumSet.of(SummaryFieldExclusion.DISPLAYVALUE) + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + var options = { + sheetId: 1421228469708676 + }; + + smartsheet.sheets.getSummary(options) + .then(function(summary) { + console.log(summary); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Sheets.get_sheet_summary( + 1421228469708676, # sheet_id + include='format,writerInfo', + exclude='displayValue' + ) + /sheets/{sheetId}/summary/fields: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Get Summary Fields + description: >- + Returns object containing array of summary fields. Allows for pagination + of results. + operationId: list-summary-fields-paginated + tags: + - sheetSummary + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/sheetSummaryInclude' + - $ref: '#/components/parameters/sheetSummaryExclude' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: List of Summary Fields + type: array + items: + $ref: '#/components/schemas/SummaryField' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + PaginationParameters paginationParameters = new + PaginationParameters( + false, // includeAll + 100, // pageSize + 1 // page + ); + + smartsheet.SheetResources.SummaryResources.GetSheetSummaryFields( + 1421228469708676, // sheetId + new List { SummaryFieldInclusion.FORMAT, SummaryFieldInclusion.WRITER_INFO }, + new List { SummaryFieldExclusion.DISPLAY_VALUE }, + paginationParameters + ); + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/summary/fields + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + PaginationParameters paginationParameters = new + PaginationParameters( + false, // includeAll + 100, // pageSize + 1 // page + ); + smartsheet.sheetResources().summaryResources().getSheetSummaryFields( + 1421228469708676L, // long sheetId + EnumSet.of(SummaryFieldInclusion.FORMAT, SummaryFieldInclusion.WRITERINFO), + EnumSet.of(SummaryFieldExclusion.DISPLAYVALUE), + paginationParameters + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + var options = { + sheetId: 1421228469708676 + }; + + smartsheet.sheets.getSummaryFields(options) + .then(function(summary) { + console.log(summary); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Sheets.get_sheet_summary_fields( + 1421228469708676, # sheet_id + include='format,writerInfo', + exclude='displayValue', + 100, # page_size + 1, # page + False # include_all + ) + put: + summary: Update Summary Fields + description: Updates the summary fields for the given sheet. + operationId: update-summary-fields + tags: + - sheetSummary + security: + - APIToken: [] + - OAuth2: + - ADMIN_SHEETS + parameters: + - $ref: '#/components/parameters/renameIfConflict' + requestBody: + description: Array of SummaryField objects + required: true + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/SummaryFieldUpdateRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + description: A list of updated summary fields + properties: + result: + type: array + items: + $ref: '#/components/schemas/SummaryField' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + SummaryField summaryField = new SummaryField(); + summaryField.Type = ColumnType.TEXT_NUMBER; + summaryField.ObjectValue = new StringObjectValue("Sally Smart"); + summaryField.Index = 2; + summaryField.Title = "Author"; + + smartsheet.SheetResources.SummaryResources.UpdateSheetSummaryFields( + 1421228469708676, // sheetId + new SummaryField[] { summaryField }, + false // renameIfConflict + ); + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/summary/fields + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X PUT \ + + -d '[{ + "id": 5629723890335892, + "type": "CONTACT_LIST", + "objectValue": { + "objectType": "CONTACT", + "email": "jane.roe@smartsheet.com", + "name": "Jane Roe" + }, + "index": 2, + "title": "Author" + }]' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + SummaryField summaryField = new SummaryField(); + + summaryField.setType(ColumnType.TEXT_NUMBER); + + summaryField.setObjectValue(new StringObjectValue("Sally Smart")); + + summaryField.setIndex(2); + + summaryField.setTitle("Author"); + + + smartsheet.sheetResources().summaryResources().updateSheetSummaryFields( + 1421228469708676L, // long sheetId + Arrays.asList(summaryField), + false // renameIfConflict + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + var options = { + sheetId: 1421228469708676, + body: [{ + id: 5629723890335892, + objectValue: 'Accepted' + }] + }; + + smartsheet.sheets.updateSummaryFields(options) + .then(function(summary) { + console.log(summary); + }).catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + summary_field1 = smartsheet.models.SummaryField() + + summary_field1.type = ColumnType.TEXT_NUMBER + + summary_field1.object_value = + smartsheet.models.StringObjectValue('Sally Smart') + + summary_field1.index = 2 + + summary_field1.title = 'Author' + + + smartsheet_client.Sheets.update_sheet_summary_fields( + 1421228469708676, # sheet_id + [summary_field1], + False # rename_if_conflict + ) + delete: + summary: Delete Summary Fields + description: Deletes summary fields from the specified sheet. + operationId: delete-summary-fields + tags: + - sheetSummary + security: + - APIToken: [] + - OAuth2: + - ADMIN_SHEETS + parameters: + - $ref: '#/components/parameters/sheetSummaryFieldIds' + - $ref: '#/components/parameters/ignoreSummaryFieldsNotFound' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + description: >- + A list of fieldIds corresponding to all summary fields + that were successfully deleted. + properties: + result: + type: array + items: + type: number + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.SheetResources.SummaryResources.DeleteSheetSummaryFields( + 1421228469708676, // sheetId + new long[] { 1421228469708676, 1421228469708676, 1421228469708676 }, // summaryFieldIds + true // ignoreSummaryFieldsNotFound + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/summary/fields?ids={fieldId1},{fieldId2},{fieldId3} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + smartsheet.sheetResources().summaryResources().deleteSheetSummaryFields( + 1421228469708676L, // long sheetId + new HashSet(Arrays.asList(1421228469708676L, 1421228469708676L, 1421228469708676L)), // long summaryFieldIds + true // ignoreSummaryFieldsNotFound + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + var options = { + sheetId: 1421228469708676, + queryParameters: { + ids: '207098194749316', + '100091196549967', + '450360473006272' + } + }; + + smartsheet.sheets.deleteSummaryFields(options) + .then(function(summary) { + console.log(summary); + }).catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Sheets.delete_sheet_summary_fields( + 1421228469708676, # sheet_id + [1421228469708676, 1421228469708676, 1421228469708676], # summary_field_ids + True # ignore_summary_fields_not_found + ) + post: + summary: Add Summary Fields + description: Creates one or more summary fields for the specified sheet. + operationId: add-summary-fields + tags: + - sheetSummary + security: + - APIToken: [] + - OAuth2: + - ADMIN_SHEETS + parameters: + - $ref: '#/components/parameters/renameIfConflict' + requestBody: + description: Array of SummaryField objects + required: true + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/SummaryFieldCreateRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + description: A list of created summary fields + properties: + result: + type: array + items: + $ref: '#/components/schemas/SummaryField' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + SummaryField summaryField = new SummaryField(); + summaryField.Type = ColumnType.TEXT_NUMBER; + summaryField.ObjectValue = new StringObjectValue("Sally Smart"); + summaryField.Index = 2; + summaryField.Title = "Author"; + + smartsheet.SheetResources.SummaryResources.AddSheetSummaryFields( + 1421228469708676, // sheetId + new SummaryField[] { summaryField }, + false // renameIfConflict + ); + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/summary/fields + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '[{ + "type": "TEXT_NUMBER", + "objectValue": "Sally Smart", + "index": 2, + "title": "Author" + }]' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + SummaryField summaryField = new SummaryField(); + + summaryField.setType(ColumnType.TEXT_NUMBER); + + summaryField.setObjectValue(new StringObjectValue("Sally Smart")); + + summaryField.setIndex(2); + + summaryField.setTitle("Author"); + + + smartsheet.sheetResources().summaryResources().addSheetSummaryFields( + 1421228469708676L, // long sheetId + Arrays.asList(summaryField), + false // renameIfConflict + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + var options = { + sheetId: 1421228469708676, + body: [{ + type: 'TEXT_NUMBER', + objectValue: 'Sally Smart', + index: 2, + title: 'Author' + }] + }; + + smartsheet.sheets.addSummaryFields(options) + .then(function(summary) { + console.log(summary); + }).catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + summary_field1 = smartsheet.models.SummaryField() + + summary_field1.type = ColumnType.TEXT_NUMBER + + summary_field1.object_value = + smartsheet.models.StringObjectValue('Sally Smart') + + summary_field1.index = 2 + + summary_field1.title = 'Author' + + + smartsheet_client.Sheets.add_sheet_summary_fields( + 1421228469708676, # sheet_id + [summary_field1], + False # rename_if_conflict + ) + /sheets/{sheetId}/summary/fields/{fieldId}/images: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/summaryFieldId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + post: + summary: Add Image to Sheet Summary + description: Adds an image to the summary field. + operationId: add-image-summaryField + tags: + - sheetSummary + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + - $ref: '#/components/parameters/Content-Disposition' + - $ref: '#/components/parameters/Content-Length' + - $ref: '#/components/parameters/altText' + - $ref: '#/components/parameters/overrideValidation' + requestBody: + content: + application/octet-stream: + schema: + type: string + format: binary + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + - type: object + properties: + result: + $ref: '#/components/schemas/SummaryFieldAddImage' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + smartsheet.SheetResources.SummaryResources.AddSheetSummaryFieldImage( + 1421228469708676, // sheetId + 5629723890335892, // fieldId + "picture.jpg", // file + "image/jpeg", // contentType + "my image" // altText + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/summary/fields/{fieldId}/images?altText=my%20image + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: image/jpeg" \ + + -H 'Content-Disposition: attachment; filename="picture.jpg"' \ + + -X POST \ + + --data-binary @picture.jpg + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + smartsheet.sheetResources().summaryResources().addSheetSummaryFieldImage( + 1421228469708676L, // long sheetId + 5629723890335892L, // long fieldId + "picture.jpg", // file + "image/jpeg", // contentType + "my image" // altText + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + var options = { + sheetId: 1421228469708676, + fieldId: 5629723890335892, + path: 'C:/picture.jpg', + fileName: 'picture.jpg' + }; + + smartsheet.sheets.addSummaryFieldImage(options) + .then(function(summary) { + console.log(summary); + }).catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Sheets.add_sheet_summary_field_image( + 1421228469708676, # sheet_id + 5629723890335892, # field_id + "picture.jpg", # file + "image/jpeg", # file_type + "my image" # alt_text + ) + /sheets/{sheetId}/updaterequests: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List Update Requests + description: > + Gets a summarized list of all update requests that have future schedules + associated with the specified sheet. + + Only the following fields are returned in the response: + * **id** + * **ccMe** + * **createdAt** + * **message** + * **modifiedAt** + * **schedule** + * **sendTo** + * **sentBy** + * **subject** + operationId: updaterequests-list + tags: + - updateRequests + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: The list of UpdateRequest objects + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: list of UpdateRequest objects + type: array + items: + $ref: '#/components/schemas/UpdateRequest' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + # Example request: list update requests + + + PaginatedResult results = + smartsheet.SheetResources.UpdateRequestResources.ListUpdateRequests( + 1639534409607044, // sheetId + null // PaginationParameters + ); + - lang: cURL + label: cURL + source: > + # Example request: list update requests + + + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/updaterequests + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + # Example request: list update requests + + + PagedResult results = + smartsheet.sheetResources().updateRequestResources().listUpdateRequests( + 1639534409607044L, // long sheetId + null // PaginationParameters + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + # Example request: list update requests + + // Set options + var options = { + sheetId: 1639534409607044 + }; + + // List update requests + smartsheet.sheets.getAllUpdateRequests(options) + .then(function(requestsList) { + console.log(requestsList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List update requests + response = smartsheet_client.Sheets.list_update_requests( + 5190835902932868) # sheet_id + update_requests = response.data + + # Sample 2: Paginate the list of update requests + response = smartsheet_client.Sheets.list_update_requests( + 5190835902932868, # sheet_id + page_size=10, + page=1) + pages = response.total_pages + update_requests = response.data + post: + summary: Create an Update Request + description: > + Creates an update request for the specified rows within the sheet. An + email notification (containing a link to the update request) is sent to + the specified recipients according to the specified schedule. + + + The recipients of an update request must be specified by using email + addresses only. Sending an update request to a group is not supported. + + + The following attributes have the following values when not specified: + + * **ccMe:** false + + * **message:** Please update the following rows in my online sheet. + + * **subject:** Update Request: {Sheet Name} + + + When the Schedule object is not specified, the request is sent to the + recipients immediately. + + + If an error occurs because the request specified one or more *alternate + email addresses*, + + please retry using the primary email address. + operationId: updaterequests-create + tags: + - updateRequests + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateRequest' + responses: + '200': + description: Result object containing the newly created UpdateRequest object. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + properties: + result: + $ref: '#/components/schemas/UpdateRequest' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + # Example request: create update request + + + // Specify recipients + + Recipient[] recipientSpecification = new Recipient[] { + new Recipient { Email = "recipient1@smartsheet.com"} + }; + + + // Configure update request + + UpdateRequest updateRequestSpecification = new UpdateRequest + + { + SendTo = recipientSpecification, + Subject = "Sample Monthly Update Request", + Message = "Please update my online sheet.", + CcMe = true, + RowIds = new long[] { 1123834706323332, 5627434333693828 }, + ColumnIds = new long[] { 4549065498224516, 2297265684539268 }, + IncludeAttachments = true, + IncludeDiscussions = true + }; + + + // Send update request via email + + UpdateRequest newUpdateRequest = + smartsheet.SheetResources.UpdateRequestResources.CreateUpdateRequest( + 3285357287499652, // sheetId + updateRequestSpecification + ); + - lang: cURL + label: cURL + source: > + # Example request: create update request + + + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/updaterequests + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '{ + "sendTo": [ + {"email": "recipient1@smartsheet.com"}, + {"email": "recipient2@smartsheet.com"} + ], + "subject": "Sample Monthly Update Request", + "message": "Please update my online sheet.", + "ccMe": false, + "rowIds": [4508292249610116, 2256492435924868], + "columnIds": [4508284196546436, 2256484382861188], + "includeAttachments": false, + "includeDiscussions": false + }' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + # Example request: create update request + + + // Specify recipients + + RecipientEmail recipientA = new RecipientEmail() + .setEmail("recipient1@smartsheet.com"); + + RecipientEmail recipientB = new RecipientEmail() + .setEmail("recipient2@smartsheet.com"); + + List recipients = Arrays.asList(recipientA, recipientB); + + + // Specify parameters for update request + + UpdateRequest updateRequest = new UpdateRequest(); + + updateRequest.setRowIds((Arrays.asList(3344087179913092L, + 7847686807283588L)); + + updateRequest.setSendTo(recipients) + .setSubject("Sample Monthly Update Request") + .setMessage("Please update my online sheet.") + .setColumnIds(Arrays.asList(1735559124150148L, 1735559124150148L)) + .setIncludeAttachments(false) + .setIncludeDiscussions(false); + + // Create update request + + smartsheet.sheetResources().updateRequestResources().createUpdateRequest( + 1639534409607044L, // long sheetId + updateRequest + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + # Example request: create update request + + // Set body + var body = { + rowIds: [ + 1049041315358596, + 5552640942729092 + ], + includeAttachments: true, + includeDiscussions: false, + sendTo: [ + { + email: "jane.roe@smartsheet.com" + } + ], + subject: "Sample Monthly Update Request", + message: "Please update my online sheet.", + schedule: { + type: "DAILY", + startAt: "2016-04-01T00:00:00Z", + endAt: "2018-12-31T00:00:00Z", + dayDescriptors: [ + "WEEKDAY" + ] + } + }; + + // Set options + var options = { + sheetId: 1696801624483716, + body: body + }; + + // Create update request + smartsheet.sheets.createUpdateRequest(options) + .then(function(updatedRequest) { + console.log(updatedRequest); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Example request: create update request + + # Configure update request + request = smartsheet.models.UpdateRequest() + request.send_to = [{'email': 'someone@smartsheet.com'}] + request.subject = 'Please update based on meeting' + request.message = 'Hello, please checkout my update request' + request.cc_me = False + request.include_discussions = False + request.include_attachments = False + request.row_ids = [6809535313667972] + request.column_ids = [7036894123976580] + + # Send update request + action = smartsheet_client.Sheets.create_update_request( + 5190835902932868, # sheet_id + request + ) + /sheets/{sheetId}/updaterequests/{updateRequestId}: + parameters: + - $ref: '#/components/parameters/sheetId' + - name: updateRequestId + in: path + required: true + description: ID of the Update Request + schema: + type: string + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Get an Update Request + description: > + Gets the specified update request for the sheet that has a future + schedule. + + + The rowIds and columnIds in the returned UpdateRequest object represent + the list at the time + + the update request was created or last modified. The lists may contain + Ids of rows or columns + + that are no longer valid (for example, they have been removed from the + sheet). + operationId: updaterequests-get + tags: + - updateRequests + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: UpdateRequest object + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateRequest' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + # Example request: get update request + + + UpdateRequest results = + smartsheet.SheetResources.UpdateRequestResources.GetUpdateRequest( + 3285357287499652, // sheetId + 2409350321989508 // updateRequestId + ); + - lang: cURL + label: cURL + source: > + # Example request: get update request + + + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/updaterequests/{updateRequestId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + # Example request: get update request + + + UpdateRequest results = + smartsheet.sheetResources().updateRequestResources().getUpdateRequest( + 1639534409607044L, // long sheetId + 965780272637828L // long updateRequestId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + # Example request: get update request + + // Set options + var options = { + sheetId: 3285357287499652, + updateRequestId: 2409350321989508 + }; + + // Get update request + smartsheet.sheets.getUpdateRequest(options) + .then(function(updateRequest) { + console.log(updateRequest); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Example request: get update request + + response = smartsheet_client.Sheets.get_update_request( + 5190835902932868, # sheet_id + 7510551698925444 # update_request_id + ) + put: + summary: Update an Update Request + description: > + Changes the specified update request for the sheet. + + + **Making changes to update requests that do not have future scheduled + delivery is not allowed.** + + + The UpdateRequest object in the request body must specify one or more of + the following attributes: + + + * **ccMe:** Boolean + + * **columnIds:** number[] + + * **includeAttachments:** Boolean + + * **includeDiscussions:** Boolean + + * **message:** string + + * **schedule:** Schedule object + + * **sendTo:** Recipient[] + + * **subject:** string + + + If an error occurs because the request specified one or more *alternate + email addresses*, + + please retry using the primary email address. + operationId: updaterequests-update + tags: + - updateRequests + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/Content-Type' + responses: + '200': + description: Result object containing the modified UpdateRequest object + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + properties: + result: + $ref: '#/components/schemas/UpdateRequest' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + # Example request: change update request + + + // Identify the update request you want to change + + UpdateRequest updateRequestSpecification = new UpdateRequest + + { + Id = 7178482007467908, // long updateRequestId + Subject = "Sample Monthly Update Request", + Message = "Please update my online sheet." + }; + + + // Change update request + + UpdateRequest updatedUpdateRequest = + smartsheet.SheetResources.UpdateRequestResources.UpdateUpdateRequest( + 3285357287499652, // sheetId + updateRequestSpecification + ); + - lang: cURL + label: cURL + source: > + # Example request: change update request + + + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/updaterequests/{updateRequestId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X PUT \ + + -d '{ + "subject": "Sample Monthly Update Request", + "message": "Please update my online sheet." + }' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + Example request: change update request + + + UpdateRequest updateRequest = new UpdateRequest(); + + updateRequest.setId(3294745817573252L); + + updateRequest.setColumnIds(Arrays.asList(1735559124150148L, + 1735559124150148L)); + + updateRequest.setIncludeAttachments(true); + + smartsheet.sheetResources().updateRequestResources().updateUpdateRequest( + 3294745817573252L, // long sheetId + updateRequest + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + # Example request: change update request + + // Set text + var body = { + subject: "Sample Monthly Update Request" + }; + + // Set options + var options = { + sheetId: 3285357287499652, + updateRequestId: 7178482007467908, + body: body + }; + + // Change update request + smartsheet.sheets.changeUpdateRequest(options) + .then(function(updatedRequest) { + console.log(updatedRequest); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Example request: change update request + + # Update required request fields + request = smartsheet.models.UpdateRequest() + request.subject = 'Sample Monthly Update Request' + request.column_ids = [7036894123976580] + request.include_attachments = True + + # Change update request + action = smartsheet_client.Sheets.update_update_request( + 3294745817573252, # sheet_id + 7820135625975684, # update_request_id + request + delete: + summary: Delete an Update Request + description: > + Terminates the future scheduled delivery of the update request specified + in the URL. + operationId: updaterequests-delete + tags: + - updateRequests + security: + - APIToken: [] + - OAuth2: + - ADMIN_SHEETS + - WRITE_SHEETS + responses: + '200': + description: Result object + content: + application/json: + schema: + $ref: '#/components/schemas/Result' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + # Example request: delete update request + + + smartsheet.SheetResources.UpdateRequestResources.DeleteUpdateRequest( + 3285357287499652, // sheetId + 2409350321989508 // updateRequestId + ); + - lang: cURL + label: cURL + source: > + # Example request: delete update request + + + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/updaterequests/{updateRequestId} + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + # Example request: delete update request + + + smartsheet.sheetResources().updateRequestResources().deleteUpdateRequest( + 1639534409607044L, // long sheetId + 965780272637828L // long updateRequestId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + # Example request: delete update request + + // Set options + var options = { + sheetId: 3285357287499652, + updateRequestId: 2409350321989508 + }; + + // Delete update request + smartsheet.sheets.deleteUpdateRequest(options) + .then(function(result) { + console.log(result); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Example request: delete update request + + smartsheet_client.Sheets.delete_update_request( + 5190835902932868, # sheet_id + 7444581001258884 # update_request_id + ) + /sheets/{sheetId}/shares: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/accessApiLevel' + post: + summary: Share sheet + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** Please refer to the [Changelog + entry](/api/smartsheet/changelog#2025-08-04) for more details. + + + Shares a sheet with the specified users and groups. + deprecated: true + operationId: share-sheet + tags: + - sharing + - sheets + security: + - APIToken: [] + - OAuth2: + - SHARE_SHEETS + parameters: + - $ref: '#/components/parameters/sendEmail' + requestBody: + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/Share' + - type: array + items: + $ref: '#/components/schemas/Share' + responses: + '200': + description: > + Result object containing either a single Share object or an array of + Share objects, corresponding to what + + was specified in the request. All shares have scope=ITEM. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + properties: + result: + oneOf: + - $ref: '#/components/schemas/Share' + - type: array + items: + $ref: '#/components/schemas/Share' + '400': + description: > + If called with a single Share object, and that user or group share + already exists, error code 1025 is returned. + + If called with an array of Share objects, and one or more user or + group shares in the array already exist, + + they are ignored and omitted from the response. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify share (to one user as Editor) + + Share[] shareSpecification = new Share[] { new Share + { + Email = "jane.doe@smartsheet.com", + AccessLevel = AccessLevel.EDITOR + } + }; + + + // Share sheet + + IList addressList = + smartsheet.SheetResources.ShareResources.ShareTo( + 4583614634583940, // sheetId + shareSpecification, + true // Nullable sendEmail + ); + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/sheets/{sheetId}/shares?sendEmail=true' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '[{"email": "jane.doe@smartsheet.com", "accessLevel": "EDITOR"}]' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify share (to one user as Editor) + + Share shareSpecification = new Share() + .setEmail("jane.doe@smartsheet.com") + .setAccessLevel(AccessLevel.EDITOR); + + // Share sheet + + List addressList = + smartsheet.sheetResources().shareResources().shareTo( + 4583614634583940L, // long sheetId + (Arrays.asList(shareSpecification)), + true // Boolean sendEmail + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify share (to one user as Editor) + var share = [ + { + "email": "jane.doe@smartsheet.com", + "accessLevel": "EDITOR" + } + ]; + + // Set options + var options = { + sheetId: 4583614634583940, + body: share + }; + + // Share sheet + smartsheet.sheets.share(options) + .then(function(addressList) { + console.log(addressList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + response = smartsheet_client.Sheets.share_sheet( + 4583614634583940, # sheet_id + smartsheet.models.Share({ + 'access_level': 'EDITOR', + 'email': 'jane.doe@smartsheet.com' + }), + True # sendEmail + ) + get: + summary: List sheet shares + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** Please refer to the [Changelog + entry](/api/smartsheet/changelog#2025-08-04) for more details. + + + Gets a list of all users and groups to whom the specified Sheet is + shared, + + and their access level. This operation + + + supports query string parameters for pagination of results. For more + + information, see Paging Query String Parameters. + deprecated: true + operationId: list-sheet-shares + tags: + - sharing + - sheets + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/sharingInclude' + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: > + IndexResult object containing an array of Share objects. By default, + this operation returns only item-level + + shares (scope=ITEM). Use the sharingInclude parameter to request + that workspace-level shares + + (include=workspaceShares) also be returned. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + result: + type: array + items: + $ref: '#/components/schemas/Share' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PaginatedResult shares = + smartsheet.SheetResources.ShareResources.ListShares( + 4583614634583940, // sheetId + null // PaginationParameters + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/shares \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PagedResult shares = + smartsheet.sheetResources().shareResources().listShares( + 4583614634583940L, // long sheetId + null, // PaginationParameters + true // Boolean includeWorkspaceShares + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 4583614634583940 + }; + + // List sheet shares + smartsheet.sheets.listShares(options) + .then(function(shareList) { + console.log(shareList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List all + response = smartsheet_client.Sheets.list_shares( + 4583614634583940, # sheet_id + include_all=True) + shares = response.data + + # Sample 2: Paginate the list + response = smartsheet_client.Sheets.list_shares( + 4583614634583940, # sheet_id + page_size=10, + page=1) + pages = response.total_pages + shares = response.data + /sheets/{sheetId}/shares/{shareId}: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/shareId' + - $ref: '#/components/parameters/accessApiLevel' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Get sheet share + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** Please refer to the [Changelog + entry](/api/smartsheet/changelog#2025-08-04) for more details. + + + Gets the share specified in the URL. + deprecated: true + operationId: share-sheet-get + tags: + - sharing + - sheets + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: Returns Share object. + content: + application/json: + schema: + $ref: '#/components/schemas/Share' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Share share = smartsheet.SheetResources.ShareResources.GetShare( + 4583614634583940, // sheetId + "AQAISF82FOeE" // string shareId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/shares/{shareId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Share share = smartsheet.sheetResources().shareResources().getShare( + 4583614634583940L, // long sheetId + "AAAASuWWFOeE" // string shareId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 4583614634583940, + shareId: "AQAISF82FOeE" + }; + + // Get sheet share + smartsheet.sheets.getShare(options) + .then(function(share) { + console.log(share); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + share = smartsheet_client.Sheets.get_share( + 4583614634583940, # sheet_id + 'AAAASuWWFOeE') # share_id + delete: + summary: Delete sheet share + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** Please refer to the [Changelog + entry](/api/smartsheet/changelog#2025-08-04) for more details. + + + Deletes the share specified in the URL. + deprecated: true + operationId: delete-sheet-share + tags: + - sharing + - sheets + security: + - APIToken: [] + - OAuth2: + - SHARE_SHEETS + responses: + '200': + description: Returns Result object. + content: + application/json: + schema: + $ref: '#/components/schemas/Result' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.SheetResources.ShareResources.DeleteShare( + 4583614634583940, // sheetId + "AAAASuWWFOeE" // string shareId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/shares/{shareId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.sheetResources().shareResources().deleteShare( + 4583614634583940L, // long sheetId + "AAAASuWWFOeE" // string shareId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 4583614634583940, + shareId: "AAAASuWWFOeE" + }; + + // Delete sheet share + smartsheet.sheets.deleteShare(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Sheets.delete_share( + 4583614634583940, # sheet_id + 'AAAFeF82FOeE') # share_id + put: + summary: Update sheet share + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** Please refer to the [Changelog + entry](/api/smartsheet/changelog#2025-08-04) for more details. + + + Updates the access level of a user or group for the specified sheet. + deprecated: true + operationId: update-sheet-share + tags: + - sharing + - sheets + security: + - APIToken: [] + - OAuth2: + - SHARE_SHEETS + requestBody: + content: + application/json: + schema: + type: object + properties: + accessLevel: + $ref: '#/components/schemas/AccessLevel' + responses: + '200': + description: Returns Result object containing the modified Share object. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + properties: + result: + type: object + items: + $ref: '#/components/schemas/Share' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Set the access level to Viewer + + Share shareSpecification = new Share + + { + Id = "AAAFeF82FOeE", + AccessLevel = AccessLevel.VIEWER + }; + + + // Update sheet share + + Share updatedShare = + smartsheet.SheetResources.ShareResources.UpdateShare( + 4583614634583940, // sheetId + shareSpecification + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sheets/{sheetId}/shares/{shareId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X PUT \ + + -d '{"accessLevel": "VIEWER"}' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Set the access level to Viewer + + Share shareSpecification = new Share() + .setEmail("jane.doe@smartsheet.com") + .setAccessLevel(AccessLevel.EDITOR); + + // Update sheet share + + Share updatedShare = + smartsheet.sheetResources().shareResources().updateShare( + 4583614634583940L, // long sheetId + shareSpecification + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set access level to Viewer + var shareSpecification = {"accessLevel": "VIEWER"}; + + // Set options + var options = { + sheetId: 1696801624483716, + shareId: "AAAHAYImFOeE", + body: shareSpecification + }; + + // Update sheet share + smartsheet.sheets.updateShare(options) + .then(function(updatedShare) { + console.log(updatedShare); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + updated_share = smartsheet_client.Sheets.update_share( + 4583614634583940, # sheet_id + 'AAAFeF82FOeE', # share_id + smartsheet.models.Share({ + 'access_level': 'VIEWER' + }) + ) + /sheets/{sheetId}/sort: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/Content-Type' + post: + summary: Sort Rows in Sheet + description: Sorts the rows of a sheet, either in ascending or descending order. + operationId: rows-sort + tags: + - rows + security: + - APIToken: [] + - OAuth2: + - WRITE_SHEETS + parameters: + - $ref: '#/components/parameters/sortRows' + requestBody: + description: > + [SortSpecifier](/api/smartsheet/openapi/schemas/sortspecifier) with + the following attribute: + + * **sortCriteria** -- + [SortCriterion](/api/smartsheet/openapi/schemas/sortcriterion) array + in priority order. Specifies sort order. + content: + application/json: + schema: + $ref: '#/components/schemas/SortSpecifier' + responses: + '200': + description: >- + Returns [Sheet object](/api/smartsheet/openapi/sheets/sheet), + populated according to the specified parameters. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Sheet' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + SortCriterion criterion = new SortCriterion + { + ColumnId = 4583173393803140, // columnId + Direction = SortDirection.DESCENDING + }; + SortSpecifier specifier = new SortSpecifier + { + SortCriteria = new SortCriterion[] { criterion } + }; + + Sheet sheet = smartsheet.SheetResources.SortSheet( + 4583173393803140, // sheetId + specifier + ); + - lang: cURL + label: cURL + source: > + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/sort \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '{"sortCriteria": [{"columnId": 4583173393803140, "direction": + "DESCENDING"}]}' + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + SortCriterion criterion = new SortCriterion(); + criterion.setColumnId(4583173393803140L); // long columnId + criterion.setDirection(SortDirection.DESCENDING); + SortSpecifier specifier = new SortSpecifier(); + specifier.setSortCriteria(Arrays.asList(criterion)); + + Sheet sheet = smartsheet.sheetResources().sortSheet( + 4583173393803140L, // long sheetId + specifier + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify sort criteria + + var body = { + sortCriteria: [ + { + columnId: 4583173393803140, + direction: "DESCENDING" + } + ] + }; + + + // Sort rows + + smartsheet.sheets.sortRowsInSheet({sheetId: 9283173393803140, body: + body}) + .then((result) => { + console.log("success"); + console.log(JSON.stringify(result)); + }) + .catch((error) => { + console.log("error"); + console.log(JSON.stringify(error)); + }); + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + sort_specifier = smartsheet.models.SortSpecifier({ + 'sort_criteria': [smartsheet.models.SortCriterion({ + 'column_id': 4583173393803140, + 'direction': 'DESCENDING' + })] + }) + + sheet = smartsheet_client.Sheets.sort_sheet(9283173393803140, + sort_specifier) + /sheets/{sheetId}/version: + parameters: + - $ref: '#/components/parameters/sheetId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Get Sheet Version + description: | + Gets the sheet version without loading the entire sheet. + The following actions increment sheet version: + * add/modify cell value + * add/modify discussion/comment + * add/modify row + * add/remove/update version attachment + * cell updated via cell link + * change formatting + operationId: get-sheetVersion + tags: + - sheets + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SheetVersion' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Integer version = smartsheet.SheetResources.GetSheetVersion( + 1531988831168388 // sheetId + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sheets/{sheetId}/version \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Integer version = smartsheet.sheetResources().getSheetVersion( + 1531988831168388L // long sheetId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sheetId: 1531988831168388 + }; + + // Get sheet version + smartsheet.sheets.getSheetVersion(options) + .then(function(version) { + console.log(version); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + version = smartsheet_client.Sheets.get_sheet_version( + 1531988831168388) # sheet_id + /sights: + parameters: + - $ref: '#/components/parameters/Authorization' + get: + operationId: list-sights + summary: List Dashboards + description: Gets a list of all dashboards that the user has access to. + tags: + - dashboards + security: + - APIToken: [] + - OAuth2: + - READ_SIGHTS + parameters: + - $ref: '#/components/parameters/accessApiLevel' + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/modifiedSince' + - $ref: '#/components/parameters/numericDates' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: > + IndexResult object containing an array of Dashboard objects with a + subset of attributes. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: List of Dashboards + type: array + items: + $ref: '#/components/schemas/SightListItem' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + PaginatedResult sights = + smartsheet.SightResources.ListSights( + null, // PaginationParameters + null // Nullable modifiedSince + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sights \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + PagedResult sights = smartsheet.sightResources().listSights( + null, // PaginationParameters + null // Date modifiedSince + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.sights.listSights() + .then(function(sights) { + console.log(sights.data); + }) + .catch(function(error) { + console.log(error); + }) + /sights/{sightId}: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/sightId' + get: + summary: Get Dashboard + description: Gets the specified dashboard. + operationId: get-sight + parameters: + - $ref: '#/components/parameters/accessApiLevel' + - $ref: '#/components/parameters/sightInclude' + - $ref: '#/components/parameters/sightLevel' + - $ref: '#/components/parameters/numericDates' + tags: + - dashboards + security: + - APIToken: [] + - OAuth2: + - READ_SIGHTS + responses: + '200': + description: Dashboard object + content: + application/json: + schema: + $ref: '#/components/schemas/Sight' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Sight sight = smartsheet.SightResources.GetSight( + 6327127650920324 // long sightId + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sights/{sightId}?level=4 \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Sight sight = smartsheet.sightResources().getSight( + 6327127650920324L // long sightId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sightId: 6327127650920324 + }; + + // Get dashboard + smartsheet.sights.getSight(options) + .then(function(sight) { + console.log(sight); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + # Sample 1: Get dashboard + + sight = smartsheet_client.Sights.get_sight( + 6327127650920324) # sightId + + # Sample 2: Determine whether a user has Commenter permissions for a + dashboard + + response = smartsheet_client.Sights.get_sight( + 6327127650920324, # sightId + accessApiLevel=1) + put: + summary: Update Dashboard + description: Updates (renames) the specified dashboard. + operationId: update-sight + parameters: + - $ref: '#/components/parameters/numericDates' + - $ref: '#/components/parameters/Content-Type' + tags: + - dashboards + security: + - APIToken: [] + - OAuth2: + - ADMIN_SIGHTS + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SightName' + responses: + '200': + description: Result object containing the updated Dashboard object. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/ItemResult' + - type: object + properties: + result: + $ref: '#/components/schemas/Sight' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Sight sight = smartsheet.SightResources.UpdateSight( + new Sight { + Id = 5363568917931908, // sightId + Name = "New Dashboard Name" + } + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sights/{sightId} \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" \ + -X PUT \ + -d '{"name": "New Dashboard Name"}' + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Sight sight = new Sight(); + sight.setId(5363568917931908L); // long sightId + sight.setName("New Dashboard Name"); + Sight updatedSight = smartsheet.sightResources().updateSight(sight); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set property to change + var body = { + name: "New Dashboard Name" + }; + + // Set options + var options = { + sightId: 5363568917931908, + body: body + }; + + // Update Dashboard + smartsheet.sights.updateSight(options) + .then(function(updatedSight) { + console.log(updatedSight); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + updated_sight = smartsheet_client.Sights.update_sight( + 5363568917931908, # sight_id + smartsheet.models.Sight({ + 'name': 'New Dashboard Name' + }) + ) + delete: + summary: Delete Dashboard + description: Deletes the dashboard specified in the URL. + operationId: delete-sight + tags: + - dashboards + security: + - APIToken: [] + - OAuth2: + - DELETE_SIGHTS + responses: + '200': + description: Generic response result + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericResult' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.SightResources.DeleteSight( + 5077532685952900 // sightId + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sights/{sightId} \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.sightResources().deleteSight( + 3100061023397764L // long sightId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sightId: 5363568917931908 + }; + + // Delete Dashboard + smartsheet.sights.deleteSight(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: > + # Note: SDK object attribute names may differ from the REST API's. + + smartsheet_client.Sights.delete_sight(3404239197235076) # + sight_id + /sights/{sightId}/copy: + parameters: + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + post: + summary: Copy Dashboard + description: Creates a copy of the specified dashboard. + operationId: copy-sight + tags: + - dashboards + security: + - APIToken: [] + - OAuth2: + - CREATE_SIGHTS + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/Content-Type' + - $ref: '#/components/parameters/sightId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerDestinationForCopy' + responses: + '200': + description: > + Result object containing a dashboard with a subset of attributes for + the newly created dashboard. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/ItemResult' + - type: object + properties: + result: + $ref: '#/components/schemas/SightResult' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify destination + ContainerDestination destination = new ContainerDestination + { + DestinationId = 3791509922310020, // long destinationFolderId + DestinationType = DestinationType.FOLDER, + NewName = "newDashboardName" + }; + + // Copy Dashboard + Sight sight = smartsheet.SightResources.CopySight( + 6327127650920324, // long sightId + destination + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sights/{sightId}/copy \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" \ + -d '{ + "destinationType": "workspace", + "destinationId": 7960873114331012, + "newName": "newDashboardName" + }' \ + -X POST + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify destination + ContainerDestination destination = new ContainerDestination() + .setDestinationType(DestinationType.FOLDER) + .setDestinationId(3791509922310020L) + .setNewName("newDashboardName"); + + // Copy Dashboard + Sight sight = smartsheet.sightResources().copySight( + 6327127650920324L, // long sightId + destination + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify new dashboard properties + var body = { + destinationType: "home", + newName: "newDashboardName" + }; + + // Set options + var options = { + sightId: 6327127650920324, + body: body + }; + + // Copy Dashboard + smartsheet.sights.copySight(options) + .then(function(copiedSight) { + console.log(copiedSight); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + new_sight = smartsheet_client.Sights.copy_sight( + 6327127650920324, # sight_id + smartsheet.models.ContainerDestination({ + 'destination_type': 'folder', # folder, workspace, or home + 'destination_id': 3791509922310020, # folder_id + 'new_name': 'newDashboardName' + }) + ) + /sights/{sightId}/move: + parameters: + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + post: + summary: Move Dashboard + description: Moves the specified dashboard to a new location. + operationId: move-sight + tags: + - dashboards + security: + - APIToken: [] + - OAuth2: + - CREATE_SIGHTS + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/Content-Type' + - $ref: '#/components/parameters/sightId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ContainerDestinationForMove' + responses: + '200': + description: > + Result object containing a Dashboard object with a subset of + attributes for the moved dashboard. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/ItemResult' + - type: object + properties: + result: + $ref: '#/components/schemas/SightResult' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify destination + ContainerDestination destination = new ContainerDestination + { + DestinationId = 8460057768683396, // long destinationFolderId + DestinationType = DestinationType.FOLDER + }; + + // Move Dashboard + Sight sight = smartsheet.SightResources.MoveSight( + 5077532685952900, // long sightId + destination + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sights/{sightId}/move \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" \ + -d '{ + "destinationType": "folder", + "destinationId": workspace_or_folder_id + }' \ + -X POST + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify destination + ContainerDestination destination = new ContainerDestination() + .setDestinationType(DestinationType.FOLDER) + .setDestinationId(7960873114331012L); + + // Move Dashboard + Sight sight = smartsheet.sightResources().moveSight( + 4583173393803140L, // long sightId + destination + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set destination + var body = { + destinationType: "folder", + destinationId: 8460057768683396 + }; + + // Set options + var options = { + sightId: 5077532685952900, + body: body + }; + + // Move Dashboard + smartsheet.sights.moveSight(options) + .then(function(movedSight) { + console.log(movedSight); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + response = smartsheet_client.Sights.move_sight( + 5363568917931908, # sight_id + smartsheet.models.ContainerDestination({ + 'destination_type': 'folder', # folder, workspace, or home + 'destination_id': 8460057768683396 # destination folder_id + }) + ) + /sights/{sightId}/publish: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/sightId' + get: + summary: Get Dashboard Publish Status + description: Gets the dashboard 'publish' settings. + operationId: get-sight-publish-status + tags: + - dashboards + security: + - APIToken: [] + - OAuth2: + - READ_SIGHTS + responses: + '200': + description: SightPublish object + content: + application/json: + schema: + $ref: '#/components/schemas/SightPublish' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + SightPublish publish = smartsheet.SightResources.GetPublishStatus( + 5363568917931908 // sightId + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sights/{sightId}/publish \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + SightPublish publish = smartsheet.sightResources().getPublishStatus( + 5363568917931908L // long sightId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sightId: 5363568917931908 + }; + + // Get dashboard publish status + smartsheet.sights.getSightPublishStatus(options) + .then(function(status) { + console.log(status); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + status = smartsheet_client.Sights.get_publish_status( + 5363568917931908) # sight_id + put: + summary: Set Dashboard Publish Status + description: Publishes or unpublishes a dashboard. + operationId: set-sight-publish-status + tags: + - dashboards + security: + - APIToken: [] + - OAuth2: + - ADMIN_SIGHTS + parameters: + - $ref: '#/components/parameters/Content-Type' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SightPublish' + responses: + '200': + description: SightPublish object + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/ItemResult' + - type: object + properties: + result: + $ref: '#/components/schemas/SightPublish' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + SightPublish publish = new SightPublish(); + publish.ReadOnlyFullEnabled = true; + smartsheet.SightResources.SetPublishStatus( + 5363568917931908, // sightId + publish + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sights/{sightId}/publish \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + -H "Content-Type: application/json" \ + -X PUT \ + -d '{ + "readOnlyFullEnabled": true, + "readOnlyFullAccessibleBy": "ALL" + }' + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + SightPublish publish = new SightPublish(); + publish.setReadOnlyFullEnabled(true); + smartsheet.sightResources().setPublishStatus( + 5363568917931908L, // long sightId + publish + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify property to change + var body = { + readOnlyFullEnabled: false + }; + + // Set options + var options = { + sightId: 5363568917931908, + body: body + }; + + // Set dashboard publish status + smartsheet.sights.setSightPublishStatus(options) + .then(function(newStatus) { + console.log(newStatus); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + response = smartsheet_client.Sights.set_publish_status( + 5363568917931908, # sight_id + smartsheet.models.SightPublish({ + 'read_only_full_enabled': True + }) + ) + /sights/{sightId}/shares: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + - $ref: '#/components/parameters/accessApiLevel' + - $ref: '#/components/parameters/sightId' + post: + summary: Share dashboard + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** Please refer to the [Changelog + entry](/api/smartsheet/changelog#2025-08-04) for more details. + + + Shares a dashboard with the specified users and groups. + deprecated: true + operationId: share-sight + tags: + - dashboards + - sharing + security: + - APIToken: [] + - OAuth2: + - SHARE_SIGHTS + parameters: + - $ref: '#/components/parameters/sendEmail' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Share' + responses: + '200': + description: > + Result object containing either a single Share object or an array of + Share objects, corresponding to what was + + specified in the request. All shares have scope=ITEM. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + properties: + result: + oneOf: + - $ref: '#/components/schemas/Share' + - type: array + items: + $ref: '#/components/schemas/Share' + '400': + description: > + If called with a single Share object, and that user or group share + already exists, error code 1025 is returned. + + If called with an array of Share objects, and one or more user or + group shares in the array already exist, + + they are ignored and omitted from the response. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + Share share = new Share { + Type = ShareType.USER, + AccessLevel = AccessLevel.EDITOR, + Email = "jane.doe@smartsheet.com" + } + + List sightShares = + smartsheet.SightResources.ShareResources.ShareTo( + 6327127650920324, // sightId + new Share[] { share }, // IEnumerable shares + true // bool sendEmail + ); + - lang: cURL + label: cURL + source: > + curl + 'https://api.smartsheet.com/2.0/sights/{sightId}/shares?sendEmail=true' + \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X POST \ + + -d '[{"email": "jane.doe@smartsheet.com", "accessLevel": "VIEWER"}]' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Specify share (to one user as Viewer) + + Share shareSpecification = new Share() + .setEmail("jane.doe@smartsheet.com") + .setAccessLevel(AccessLevel.VIEWER); + + // Share dashboard + + List addressList = + smartsheet.sightResources().shareResources().shareTo( + 4583614634583940L, // long sightId + (Arrays.asList(shareSpecification)), + true // Boolean sendEmail + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Specify share (to one user as Viewer) + var share = [ + { + "email": "jane.doe@smartsheet.com", + "accessLevel": "VIEWER" + } + ]; + + // Set options + var options = { + sightId: 6327127650920324, + body: share + }; + + // Share dashboard + smartsheet.sights.share(options) + .then(function(addressList) { + console.log(addressList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + response = smartsheet_client.Sights.share_sight( + 6327127650920324, # sight_id + smartsheet.models.Share({ + 'access_level': 'VIEWER', + 'email': 'jane.doe@smartsheet.com' + }), + True # sendEmail + ) + get: + summary: List dashboard shares + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** Please refer to the [Changelog + entry](/api/smartsheet/changelog#2025-08-04) for more details. + + + Gets a list of all users and groups to whom the specified dashboard is + + shared, and their access level. + deprecated: true + operationId: list-sight-shares + tags: + - dashboards + - sharing + security: + - APIToken: [] + - OAuth2: + - READ_SIGHTS + parameters: + - $ref: '#/components/parameters/sharingInclude' + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: > + IndexResult object containing an array of Share objects. By default, + this operation returns only item-level + + shares (scope=ITEM). Use the sharingInclude parameter to request + that workspace-level shares (scope=WORKSPACE) + + also be returned. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + result: + type: array + items: + $ref: '#/components/schemas/Share' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + PaginatedResult shares = + smartsheet.SightResources.ShareResources.ListShares( + 6327127650920324, // sightId + null, // Pagination parameters + ShareScope.Item // ShareScope shareScope + ); + - lang: cURL + label: cURL + source: | + curl https://api.smartsheet.com/2.0/sights/{sightId}/shares \ + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + //Sample 1: List all + + smartsheet.sightResources().shareResources().listShares( + 6327127650920324L, // long sightId + null, // PaginationParameters + true // includeWorkspaceShares + ); + + //Sample 2: Paginate the list + + PaginationParameters paginationParameters = new + PaginationParameters( + false, // includeAll + 100, // pageSize + 1 // page + ); + smartsheet.sightResources().shareResources().listShares( + 6327127650920324L, // long sightId + paginationParameters, + true // includeWorkspaceShares + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sightId: 6327127650920324 + } + + // List dashboard shares + smartsheet.sights.listShares(options) + .then(function(shareList) { + console.log(shareList); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + # Sample 1: List all + response = smartsheet_client.Sights.list_shares( + 6327127650920324, # sight_id + include_all=True) + shares = response.data + + # Sample 2: Paginate the list + response = smartsheet_client.Sights.list_shares( + 6327127650920324, # sight_id + page_size=10, + page=1) + pages = response.total_pages + shares = response.data + /sights/{sightId}/shares/{shareId}: + parameters: + - $ref: '#/components/parameters/sightId' + - $ref: '#/components/parameters/shareId' + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: Get dashboard share + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** Please refer to the [Changelog + entry](/api/smartsheet/changelog#2025-08-04) for more details. + + + Gets a list of all users and groups to whom the specified dashboard is + + shared, and their access level. + deprecated: true + operationId: share-sight-get + parameters: + - $ref: '#/components/parameters/accessApiLevel' + tags: + - dashboards + - sharing + security: + - APIToken: [] + - OAuth2: + - READ_SIGHTS + responses: + '200': + description: Returns Share object. + content: + application/json: + schema: + $ref: '#/components/schemas/Share' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Share share = smartsheet.SightResources.ShareResources.GetShare( + 6327127650920324, // long sightId + "AAABbMomFOeE" // string shareId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sights/{sightId}/shares/{shareId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + Share share = smartsheet.sightResources().shareResources().getShare( + 6327127650920324L, // long sightId + "AAABbMomFOeE" // string shareId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sightId: 6327127650920324, + shareId: "AAABbMomFOeE" + } + + // Get dashboard share + smartsheet.sights.getShare(options) + .then(function(share) { + console.log(share); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + share = smartsheet_client.Sights.get_share( + 6327127650920324, # sight_id + 'AAACOqOmFOeE') # share_id + delete: + summary: Delete dashboard share + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** Please refer to the [Changelog + entry](/api/smartsheet/changelog#2025-08-04) for more details. + + + Deletes the share specified in the URL. + deprecated: true + operationId: delete-sight-share + tags: + - dashboards + - sharing + security: + - APIToken: [] + - OAuth2: + - SHARE_SIGHTS + responses: + '200': + description: Returns Result object. + content: + application/json: + schema: + $ref: '#/components/schemas/Result' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.SightResources.ShareResources.DeleteShare( + 6327127650920324, // sightId + "AAABbMomFOeE" // string shareId + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sights/{sightId}/shares/{shareId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -X DELETE + - lang: Java SDK + label: Java SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + smartsheet.sightResources().shareResources().deleteShare( + 6327127650920324L, // long sightId + "AAABbMomFOeE" // string shareId + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set options + var options = { + sightId: 6327127650920324, + shareId: "AAABbMomFOeE" + } + + // Delete dashboard share + smartsheet.sights.deleteShare(options) + .then(function(results) { + console.log(results); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + smartsheet_client.Sights.delete_share( + 6327127650920324, # sight_id + 'AAACOqOmFOeE') # share_id + put: + summary: Update dashboard share + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** Please refer to the [Changelog + entry](/api/smartsheet/changelog#2025-08-04) for more details. + + + Updates the access level of a user or group for the specified dashboard. + deprecated: true + operationId: update-sight-share + parameters: + - $ref: '#/components/parameters/accessApiLevel' + tags: + - dashboards + - sharing + security: + - APIToken: [] + - OAuth2: + - SHARE_SIGHTS + requestBody: + content: + application/json: + schema: + type: object + properties: + accessLevel: + $ref: '#/components/schemas/AccessLevel' + responses: + '200': + description: Returns Result object containing the modified Share object. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Result' + - type: object + properties: + result: + type: object + items: + $ref: '#/components/schemas/Share' + default: + description: Generic Error Payload + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + Share updatedShare = + smartsheet.SightResources.ShareResources.UpdateShare( + 6327127650920324, // sightId + new Share { // Share share + Id = "AAALRqomFOeE", // string shareId + AccessLevel = AccessLevel.VIEWER // AccessLevel accessLevel + } + ); + - lang: cURL + label: cURL + source: > + curl + https://api.smartsheet.com/2.0/sights/{sightId}/shares/{shareId} \ + + -H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \ + + -H "Content-Type: application/json" \ + + -X PUT \ + + -d '{"accessLevel": "VIEWER"}' + - lang: Java SDK + label: Java SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Set the access level to Viewer + + Share shareSpecification = new Share(); + shareSpecification.setAccessLevel(AccessLevel.VIEWER) + .setId("AAAFeF82FOeE"); // string shareId + + // Update dashboard share + + Share updatedShare = + smartsheet.sightResources().shareResources().updateShare( + 6327127650920324L, // long sightId + shareSpecification + ); + - lang: JavaScript SDK + label: JavaScript SDK + source: | + // Note: SDK object attribute names may differ from the REST API's. + // Set access level to Viewer + var shareSpecification = {"accessLevel": "VIEWER"}; + + // Set options + var options = { + sightId: 6327127650920324, + shareId: "AAALRqomFOeE", + body: shareSpecification + }; + + // Update dashboard share + smartsheet.sights.updateShare(options) + .then(function(updatedShare) { + console.log(updatedShare); + }) + .catch(function(error) { + console.log(error); + }); + - lang: Python SDK + label: Python SDK + source: | + # Note: SDK object attribute names may differ from the REST API's. + updated_share = smartsheet_client.Sights.update_share( + 6327127650920324, # sight_id + 'AAALRqomFOeE', # share_id + smartsheet.models.Share({ + 'access_level': 'VIEWER' + }) + ) + /templates: + parameters: + - $ref: '#/components/parameters/Authorization' + - $ref: '#/components/parameters/smartsheetIntegrationSourceHeader' + get: + summary: List user-created templates + deprecated: true + description: > + **DEPRECATED - As early as the sunset date specified in this [Changelog + entry](/api/smartsheet/changelog#2025-08-04), this endpoint will be + discontinued.** + + + Gets a list of user-created templates that the user has access to. + operationId: templates-list + tags: + - templates + security: + - APIToken: [] + - OAuth2: + - READ_SHEETS + parameters: + - $ref: '#/components/parameters/accessApiLevel' + - $ref: '#/components/parameters/includeAll' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: SUCCESS + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/IndexResult' + - type: object + properties: + data: + description: list of Templates + type: array + items: + $ref: '#/components/schemas/Template' + x-codeSamples: + - lang: C# SDK + label: C# SDK + source: > + // Note: SDK object attribute names may differ from the REST API's. + + // Omit pagination parameters + + PaginatedResult