Smartsheet API parentId location specifier doesn't work?
I have a function used to make parent-child relationships in smartsheet.
The child_df contains the row and parent info, when I call update rows, it reads my row ID to update (row.id) and if I pass in the argument row.to_bottom = True it also works, but it stubbornly doesn't assign a parent ID when I pass parentId into the row.
When I removed the row and added the row with only a parentId specified, it gave me an error that it required at least one location specifier (which parentId should be one).
Code below:
for i in range(0,len(child_df)):
row = smartsheet_API.models.Row()
row.parentId = child_df.iloc[i]['Parent']
row.id = child_df.iloc[i]['Row']
row.cells = [{'column_id': column_map[source_column],
'value': self.convert(source_df.loc[i, source_column],source_column)}
for source_column in source_df.columns.values]
new_rows.append(row)
response = self.ss_API.Sheets.update_rows(sheet_id,new_rows)
Answers
-
Hello @Jason R Dong
Upon reviewing your post, I recommend visiting the link here. There's some pretty well-defined notes regarding parent and location for the specifics you are encountering such as:
- Use only one location-specifier attribute per request, unless you use parentId and toBottom or siblingId and above.
- If you specify multiple rows in the request, all rows must have the same location-specifier attributes.
- If you specify the parentId attribute, you cannot also specify the siblingId attribute.
- If you specify the siblingId attribute, you cannot also specify the parentId, toTop, or toBottom attributes.
- If you want to indent or outdent multiple rows, use the parentId attribute.
Hope this helps!
Cheers,
Krissia
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 142 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives