Bridge list sheets shared with specific user across entire Smartsheet account
How would I go about creating an API Call to identify the list of sheets shared with a specific user (not me)?
Background: I am the system admin of our Smartsheet account, but we have a unique situation where we're sending data outbound via API to a system in which our company has developed internally. Their API is pulling data from Smartsheet → External system.
Because of the sensitivity of data that is included in their custom API, I'm trying to set up a Bridge workflow which will run on a schedule and feed data into a sheet of the sheet IDs / sheet names in which this user ID is shared, so I can be notified (via Smartsheet automation) if this user is shared to any sheets within our account beyond what is deemed in scope. I want to be able to query sheets I may not personally have access to, which is why I have the generic user's user Id and API token for use in this circumstance.
Credentials for this API are passed via a generic account with a Smartsheet license, so an API token can be generated for authentication purposes. I have both the generic user ID and API token.
What have I done so far?
Parent Workflow -
- I've tried creating an org sheet query using the following parameters, but I keep getting the following responses of "Not Found", even though I know they're shared with at least 1 sheet.
- https://api.smartsheet.com/2.0/users/6998392921450372/sheets?pageSize=100000&includeAll=true
Child Workflow -
- Once the sheets are listed, I'd then pass each Sheet ID into a child workflow where I can extract the sheet shares into an array
- sheets/{{runtime.data}}/shares
- Then run the following javascript to query the array for a specific email address, return "true" or "false"
function containsEmail(array) {
for (var i = 0; i < array.length; i++) {
if (array[i] === "inventory@biofourmis.org") {
return true;
}
}
return false;
}
return containsEmail(emails);
3. From there if set to "true", I'd then parse the sheet ID / name and push that data into a separate sheet for tracking / auditing.
PARENT
CHILD
Answers
-
Posting the solution to this, so others may benefit as well:
Because I have the API token of this other user, all I needed to do was updated the API call parameters by removing the "/users/6998392921450372" portion to the following:
/sheets?pageSize=100000&includeAll=true
From there I was able to obtain all sheets for that specific user since the API token associated already assumed I was acting as that individual.
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64K Get Help
- 410 Global Discussions
- 220 Industry Talk
- 459 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 138 Just for fun
- 57 Community Job Board
- 459 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 298 Events
- 37 Webinars
- 7.3K Forum Archives