# Wiki API FAQs

## 1. How to read the content of the wiki document? How to edit?

Wiki nodes support a variety of document types, including documents, spreadsheets, multidimensional tables, thought notes, files, Follow the steps below to get read and edit these Docs:<br>1. Obtain the **space_id** of the current knowledge space through [Get Knowledge Space List](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space/list).<br>2. Obtain the **node_token** of the current knowledge space node through [Get Sub-node List](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-node/list).<br>3. Obtain the **obj_token** and **obj_type** of the cloud resources mounted under this node through [Get Knowledge Space Node Information](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space/get_node). At this time, the **obj_token** is the token of the cloud document.<br>4. To read and write operations on these cloud document resources, you can further refer to [Document](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/document-docx/docx-overview), [Spreadsheet Overview](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview), [Bitable Overview](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/bitable-overview) to use the corresponding resource APIs.
---

## 2. How to authorize an app to access Wiki Space resources?

In the Wiki API, except for [Create Wiki](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space/create) 和[Search Wiki](https://open.feishu.cn/document/ukTMukTMukTM/uEzN0YjLxcDN24SM3QjN/search_wiki), all interfaces support the use of **tenant_access_token** to call.<br>The application needs to obtain the authorization of the wiki administrator or the access permission of a certain node before accessing the wiki. There are currently two ways:<br>1. Add the app as a node collaborator(**easier**)<br>Users with wiki sharing collaborator permissions, open the wiki web, find the corresponding node document, and add the application as a document collaborator.<br>1. Enable [Bot Capabilities](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bot-v3/bot-overview) for the application.<br>2. The cloud document owner, knowledge base administrator, or other collaborators can add the application through the cloud document webpage by navigating to the top right corner, selecting "**...**" -> "**...More**" -> "**Add Application**."<br>![](//sf3-cn.feishucdn.com/obj/open-platform-opendoc/bb60f97ebb402475f2af1d3131d4914f_sLOzoqYRXX.png?height=1992&lazyload=true&maxWidth=583&width=3278)<br>2. The method of [Adding Wiki Space Member](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-member/create) will be applied(**more complicated**)<br>- The wiki administrator credentials (user_access_token) need to be obtained.<br>- You need to get the **open_id** of the application (refer to [Cloud Documentation FAQ](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN) **Question 10 How to get the open_id of the application?**).<br>- Apply **open_id** [add as wiki space member](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-member/create) with admin identity (user_access_token). The role type **admin or member** is controlled via the `member_role` parameter.
---

## 3. How to add an app as a Wiki Space administrator (member)?

There are currently two ways to add an application as a Wiki administrator (member):<br>- By adding a group as a knowledge base administrator (member) (**easier**)<br>1. Create a new group in Feishu client and add the app as a robot in the group, <br>2. The knowledge base administrator can go to "**Wiki space settings**" -> "**Members**" -> "**Add Administrator**" <br>![image.png](//sf3-cn.feishucdn.com/obj/open-platform-opendoc/927f5083d12a7575134685c46d08544a_OSgAi8JCfn.png?height=878&lazyload=true&maxWidth=583&width=1920)<br>3. Search the group name where the bot belongs to and add it as an administrator.<br>![image.png](//sf3-cn.feishucdn.com/obj/open-platform-opendoc/bff2d2a2bd7aeb569debdad160447b3a_aGISuDp1jm.png?height=786&lazyload=true&maxWidth=583&width=1096)<br>2. Through API interface (**more complicated**)<br>- Refer to this page **How to authorize an app to access Wiki Space resources in question 2**
---
## 4. How to migrate documents in my space to wiki?<br>1. Determine if the current access credential is **user_access_token** or **tenant_access_token**.<br>2. Verify that the current identity is the owner of the migration document.<br>3. Confirm whether the current identity has the authority to migrate the wiki to the node. Refer to this page **Question 2**.<br>4. Call [Add Existing Cloud Documents to Wiki<br>](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-node/move_docs_to_wiki) interface to migrate.<br>- This interface is an asynchronous interface. If the move is complete (or the node is already in the wiki), the result (Wiki token) is returned directly.<br>- If not completed, return the **task id**. Please use the [Get task result](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/task/get) interface to query.

## 5. How to import file into Wiki?

1. First, import the local file into the my space through the [Import Guide](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/import_task/import-user-guide).<br>2. Then go through this page **Question 4 How to migrate documents in my space to wiki** to migrate the imported documents to the Wiki.
---

## 6. How to export the Docs in the Wiki?

1. By calling the [Get Node Information](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space/get_node) interface, you can get `obj_type` and `obj_token` from the return value.<br>2. Then download the file corresponding to `obj_token` to the local through [Export Guide](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/export_task/export-user-guide).
---

