Search Nodes
This text provides an example of how to call Search Nodes interface.
Example: Search nodes by conditions
Assuming you have a Space with many files (such as Datasheets, Folders, Forms, Mirrors, and Dashboards and Automations) , you want to retrieve all datasheets for which you have "Manager" or "Editor" permissions.
Your action steps below:
Get your API Token.(How to get it)
Get your Space ID.(How to get it)
Open the terminal on your computer, execute the following code and send the query request to the server (e.g.
spaceId
isspcX9P2xUcKst
):- cURL
- Javascript SDK
- Python SDK
curl -X GET \
"https://aitable.ai/fusion/v2/spaces/spcX9P2xUcKst/nodes?type=Datasheet&permissions=0,1" \
-H "Authorization: Bearer {Your API Token}"import { APITable } from "apitable";
const apitable = new APITable({
token: "Your API Token",
});
const result = await apitable.nodes.search({spaceId: "spcxxxxxx", type: "Datasheet", query: "query string"});
if (result.success) {
for (const node of result.data.nodes) {
console.log(node.name);
}
}from apitable import Apitable
apitable = Apitable("API_TOKEN")
nodes = apitable.nodes.search(spaceId="spcxxxxxx", type='Folder')
for node in nodes:
print(node.name)
print(node.id)The server returns the following JSON data, with a list of nodes with specific types and permissions in the working directory returned under
"nodes"
.
For the meaning of each parameter in the response, please check the API Reference
{
"code": 200,
"success": true,
"data": {
"nodes": [
{
"id": "dstXxx",
"name": "Test",
"type": "Datasheet",
"icon": "",
"isFav": false,
"parentId": "fodXxx",
"permission": 0
}
]
},
"message": "SUCCESS"
}