[英]Using the Quip API, how can you get a list of all threads?
I need to get a list of all publicly-visible Quip documents in my company using the Quip API.我需要使用 Quip API 获取我公司中所有公开可见的 Quip 文档的列表。 I have a service worker account that will make the API calls.
我有一个可以进行 API 调用的服务工作者帐户。
My question: how do I find the root folder to start from?我的问题:我如何找到根文件夹开始?
Quip's API docs tell you how to get info about one or more folders using Get Folders by passing in the folder ids. Quip 的 API 文档告诉您如何使用Get Folders通过传入文件夹 ID 来获取有关一个或多个文件夹的信息。 You can call this again for nested folders, and you can call Get Threads to get information about each document.
您可以为嵌套文件夹再次调用此方法,并且可以调用Get Threads以获取有关每个文档的信息。 (Quip uses the terminology "threads," not "documents.")
(Quip 使用术语“线程”,而不是“文档”。)
But where do I start?但是我从哪里开始呢? I need a root folder to start recursing from, right.
我需要一个根文件夹来开始递归,对。
Here's what I've tried:这是我尝试过的:
The Get Folders docs say "To find your desktop or archive folder ID, see Get Authenticated User ."获取文件夹文档说“要查找您的桌面或存档文件夹 ID,请参阅获取经过身份验证的用户” 。 I've tried that but it returns folders called Desktop, Archive, Starred, Private, Shared, and Group.
我已经尝试过,但它返回名为 Desktop、Archive、Starred、Private、Shared 和 Group 的文件夹。
Desktop
seemed like a good place to start but its only child is Archive, and... Desktop
似乎是一个不错的起点,但它唯一的孩子是存档,而且...Archive
only contains a couple dozen docs. Archive
仅包含几十个文档。 The meaning of the Archive folder is not documented. Starred
is docs you've favorited. Starred
是您收藏的文档。Private
is your private docs. Private
是您的私人文档。Shared
is docs that have been shared with you. Shared
是已与您Shared
的文档。Group
seemed promising because the Folders UI at quip.com/browse shows the word "Group Folders" at the top. Group
看起来很有希望,因为 quip.com/browse 上的文件夹 UI 在顶部显示了“Group Folders”这个词。 But my account's Group Folder list is empty.A bit late to this, but since the QUIP API is poorly maintained and not well documented, for those looking to solve the same problem, here is one way:这有点晚了,但由于 QUIP API 维护不善且没有很好的文档记录,对于那些希望解决相同问题的人,这里有一种方法:
Step 1: Add your company's root folder to your favorite (Starred folder), and drag it to the top of the favorite list.第1步:将您公司的根文件夹添加到您的收藏夹(Starred文件夹),并将其拖到收藏夹列表的顶部。
Step 2: Get you authenticated instance:第 2 步:获取经过身份验证的实例:
quip_client = quip.QuipClient(access_token=login_token)
user = quip_client.get_authenticated_user()
print (user)
You will retrieve a json result with basic information like name, id... and most importantly the starred_folder_id
for the user.您将检索带有基本信息的 json 结果,例如名称、ID...以及最重要的用户的
starred_folder_id
。
Step 3: Pass the starred_folder_id
to the get_folder
method:第 3 步:将
starred_folder_id
传递给get_folder
方法:
print (quip_client.get_folder("starred_folder_id"))
You will receive yet another json with a key named as children
which contains values of your starred folders/files in the order it appears on your quip
app.您将收到另一个带有名为
children
的键的 json,其中包含您已加星标的文件夹/文件的值,这些值按照它在您的quip
应用程序中出现的顺序排列。 The first folder_id
will be your company folder id.第一个
folder_id
将是您的公司文件夹 ID。
You can now use the folder_id
to retrieve the rest of your company documents by more get_folder
.您现在可以使用
folder_id
通过 more get_folder
检索公司文档的其余部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.