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
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives