列表讨论功能限制字符
你好,
我试图拉与表ID相关的所有讨论和评论。
我能够通过python使用API拉,如下所示。
然而,评论只有有限的字符,换句话说,我只能看到前100个字符。请建议
下面的Python代码
"
导入内容
以pd方式导入熊猫
#设置访问令牌
SMARTSHEET_ACCESS_TOKEN = "xxxxxxxx"
初始化客户端
smartsheet_client = smartsheet.Smartsheet(SMARTSHEET_ACCESS_TOKEN)
#设置Sheet_id
Sheet_id = XXXXXXXX
sheet = smartsheet_client.Sheets.get_sheet(sheet_id)
打印(“已加载的纸张:”+纸张名称)
#调用指定表的讨论
response = smartsheet_client. discussion .get_all_discussion (sheet_id,include_all=True)
讨论= response.data
#将讨论数据转换为字典格式
discussionsDict = response.to_dict()
#从讨论字典中创建评论数据框架
commentsdf = pd.DataFrame.from_dict(discussionsDict['data'])
#将注释数据框保存为csv文件
commentsdf.to_csv(“comments.csv”)
"
最佳答案
-
我认为你看到的不是评论,而是讨论标题,它是通过“复制顶级评论的前100个字符”创建的。(https://smartsheet.redoc.ly/#operation/discussions-list、回应、数据、标题)
要将注释包含到数据响应中,您应该添加Include = 'comments'听你的召唤:
response = smartsheet_client. discussion。get_all_discussions (sheet_id include_all = True,包括=“评论”)
希望这对你有帮助!
答案
-
我认为你看到的不是评论,而是讨论标题,它是通过“复制顶级评论的前100个字符”创建的。(https://smartsheet.redoc.ly/#operation/discussions-list、回应、数据、标题)
要将注释包含到数据响应中,您应该添加Include = 'comments'听你的召唤:
response = smartsheet_client. discussion。get_all_discussions (sheet_id include_all = True,包括=“评论”)
希望这对你有帮助!
-
非常感谢@JKrombeenASK就是这个参数!
感谢!
类别
See below link:<\/p>
https:\/\/smartsheet.redoc.ly\/tag\/groups#operation\/add-group<\/a><\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":320,"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":227,"urlcode":"api-and-developers","name":"API and Developers"},{"tagID":442,"urlcode":"groups-and-group-management","name":"Groups and Group Management"}]},{"discussionID":106741,"type":"question","name":"Using the API to get attachment URLs","excerpt":"I have PDF row attachments in a sheet. I need to get a direct URL to the attachment but I can't see a way to do this in the API. Using the GUI to \"send\" the file provides a link - so I'm trying to get something similar through the API. I'm aware that the the URL using the GUI method expires after 30 days. I would prefer…","categoryID":320,"dateInserted":"2023-06-21T22:40:34+00:00","dateUpdated":null,"dateLastComment":"2023-06-22T20:21:40+00:00","insertUserID":150432,"insertUser":{"userID":150432,"name":"jzadra","url":"https:\/\/community.smartsheet.com\/profile\/jzadra","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-23T19:55:05+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":150432,"lastUser":{"userID":150432,"name":"jzadra","url":"https:\/\/community.smartsheet.com\/profile\/jzadra","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-23T19:55:05+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":26,"score":null,"hot":3374853734,"url":"https:\/\/community.smartsheet.com\/discussion\/106741\/using-the-api-to-get-attachment-urls","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/106741\/using-the-api-to-get-attachment-urls","format":"Rich","tagIDs":[227,268],"lastPost":{"discussionID":106741,"commentID":381846,"name":"Re: Using the API to get attachment URLs","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/381846#Comment_381846","dateInserted":"2023-06-22T20:21:40+00:00","insertUserID":150432,"insertUser":{"userID":150432,"name":"jzadra","url":"https:\/\/community.smartsheet.com\/profile\/jzadra","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-23T19:55:05+00:00","banned":0,"punished":0,"private":false,"label":"✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-06-22T20:20:13+00:00","dateAnswered":"2023-06-22T00:36:56+00:00","acceptedAnswers":[{"commentID":381653,"body":" You make a call to<\/p> https:\/\/api.smartsheet.com\/2.0\/sheets\/$Sheet_ID?include=attachments<\/a><\/p> substituting $Sheet_ID for the sheet ID and get the attachment id for each row<\/p> Then call<\/p>