通过API链接NocoDB记录🔗
这是一个Engineering领域的自动化工作流,包含 12 个节点。主要使用 Set, NocoDb, HttpRequest, ManualTrigger 等节点。 通过API链接NocoDB记录🔗
- •可能需要目标 API 的认证凭证
分类
{
"id": "2Pm4HYVtOrq8H0EK",
"meta": {
"instanceId": "bcc0fe85b176c2837affb21bb7d7397fad2549880e73dc1f7a42e76ae94fd996",
"templateCredsSetupCompleted": true
},
"name": "Linking NocoDB Records via API 🔗",
"tags": [
{
"id": "8AEG2zFZndeg1imh",
"name": "nocodb",
"createdAt": "2025-05-14T02:58:20.883Z",
"updatedAt": "2025-05-14T02:58:20.883Z"
},
{
"id": "Y3u7fuGgTL5xyaVG",
"name": "database db",
"createdAt": "2025-03-13T10:14:54.572Z",
"updatedAt": "2025-04-07T06:12:25.593Z"
}
],
"nodes": [
{
"id": "1285cb8b-45ab-4a87-9155-af8e06a195aa",
"name": "When clicking ‘Test workflow’",
"type": "n8n-nodes-base.manualTrigger",
"position": [
0,
0
],
"parameters": {},
"typeVersion": 1
},
{
"id": "1888e045-284f-4b1d-b3fd-8ddecc2d5bc2",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-320,
-140
],
"parameters": {
"color": 3,
"width": 260,
"height": 580,
"content": "# NocoDB Many to Many Link Record\n\n## API POST to Link Records\nhttp://localhost:8080/api/v2/tables/{tableId}/links/{linkFieldId}/records/{recordId}\n\n## NocoDB Data API\nhttps://data-apis-v2.nocodb.com/#tag/Table-Records/operation/db-data-table-row-nested-list\n\n## NocoDB Meta API\nhttps://meta-apis-v2.nocodb.com/\n\n"
},
"typeVersion": 1
},
{
"id": "6f9aac5b-e767-44bc-aba9-12b80500da78",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
380,
-460
],
"parameters": {
"width": 220,
"height": 620,
"content": "### Target Table\n\nThis is the table you are linking to — the \"destination\"\n\n#### Example I Show:\nONE Video Production (Target) is linked to MANY Scenes (Source)\n\n#### Many to Many - Target and Source are insignificant\nExample: MANY Video Productions have MANY Scenes - i.e. You can use scenes in various productions, and you want to keep records where those scenes are being used"
},
"typeVersion": 1
},
{
"id": "6adaeec0-ab7b-4dca-8147-0801f0a215f8",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
600,
-120
],
"parameters": {
"width": 220,
"height": 280,
"content": "### Source Table (Many)\n\nThis is where the link field lives — the \"starting point\" for the link\n\n"
},
"typeVersion": 1
},
{
"id": "8c028f2f-840c-4287-b6cc-fc6123eff6a7",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1340,
-140
],
"parameters": {
"color": 3,
"width": 440,
"height": 440,
"content": "## In Other Words\n\nPOST:\nhttps://<YOUR NOCODB URL -- see 'Set Variables' node>/api/v2/tables/<TARGET TABLE ID -- see 'Set Variables' node>/links/<TARGET TABLE COLUMN ID -- see 'Get Target Table Meta Data' node>/records/<TARGET TABLE RECORD ID -- see 'Get Target Table Row' node, 'Formula' Column using RECORD_ID()>\n\nBODY (single record):\n[ { \"Id\": <SOURCE TABLE RECORD ID -- see 'Get Source Table Row' node, 'Formula' Column using RECORD_ID()> } ]\n\nBODY (many records from source):\n[\n { \"Id\": <1st Record ID> },\n { \"Id\": <2nd Record ID> },\n ...{ \"Id\": <X Record IDs> },...\n { \"Id\": <Last Record ID> }\n]\n"
},
"typeVersion": 1
},
{
"id": "2d86e7fb-936d-4f4c-8d1d-c6e50fa90a38",
"name": "Grab Target Table Row",
"type": "n8n-nodes-base.nocoDb",
"position": [
440,
0
],
"parameters": {
"id": "={{ $json.target_table_row_id }}",
"table": "mc5ihmltcqfco2v",
"projectId": "p82se8ug6ui5lt0",
"authentication": "nocoDbApiToken"
},
"credentials": {
"nocoDbApiToken": {
"id": "Lrr0RsBkym1lNmzu",
"name": "NocoDB Token account"
}
},
"typeVersion": 3
},
{
"id": "699ea454-8841-465b-90d7-d093c4086cff",
"name": "Set Variables",
"type": "n8n-nodes-base.set",
"position": [
220,
0
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "9dd187fd-3957-4549-81ff-1d2190efd711",
"name": "my_nocodb",
"type": "string",
"value": "<Your NocoDB URL, example: nocodb.myserver.com>"
},
{
"id": "cc3e739a-d2ed-498c-bbc4-0f24b1134a87",
"name": "target_table_id",
"type": "string",
"value": "<the ID of TARGET Table, see Video>"
},
{
"id": "dcfdd5d4-4114-46b2-988a-2c10676ceae2",
"name": "target_table_row_id",
"type": "string",
"value": "<the Record-ID of TARGET Table that you want to link to, see Video, example: 5>"
},
{
"id": "e4962b5b-9c62-4c98-ab01-44f7142bf7e3",
"name": "source_table_row_id",
"type": "string",
"value": "<the Record-ID of SOURCE Table that you want to link from, see Video, example: 23>"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "a2c900e3-4515-4e9b-a99c-d62014f70c6c",
"name": "Get Target Table Meta Data",
"type": "n8n-nodes-base.httpRequest",
"position": [
880,
0
],
"parameters": {
"url": "=https://{{ $('Set Variables').item.json.my_nocodb }}/api/v2/meta/tables/{{ $('Set Variables').item.json.target_table_id }}",
"options": {},
"sendHeaders": true,
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
}
]
},
"nodeCredentialType": "nocoDbApiToken"
},
"credentials": {
"nocoDbApiToken": {
"id": "Lrr0RsBkym1lNmzu",
"name": "NocoDB Token account"
}
},
"typeVersion": 4.2
},
{
"id": "ece698e5-29d1-493a-97d3-4ea66ef36e15",
"name": "Get Source Table Row",
"type": "n8n-nodes-base.nocoDb",
"position": [
660,
0
],
"parameters": {
"id": "={{ $('Set Variables').item.json.source_table_row_id }}",
"table": "mm94d1xdbfrn1oe",
"projectId": "p82se8ug6ui5lt0",
"authentication": "nocoDbApiToken"
},
"credentials": {
"nocoDbApiToken": {
"id": "Lrr0RsBkym1lNmzu",
"name": "NocoDB Token account"
}
},
"typeVersion": 3
},
{
"id": "bf318290-c151-4eb0-944e-37b66cb69d8e",
"name": "Link Record from Source to Target",
"type": "n8n-nodes-base.httpRequest",
"position": [
1100,
0
],
"parameters": {
"url": "=https://{{ $('Set Variables').item.json.my_nocodb }}/api/v2/tables/{{ $('Set Variables').item.json.target_table_id }}/links/{{ $('Get Target Table Meta Data').item.json.columns[11].id }}/records/{{ $('Grab Target Table Row').item.json['Record ID'] }}",
"method": "POST",
"options": {},
"jsonBody": "=[ { \"Id\": {{ $('Get Source Table Row').item.json['Record ID'] }} } ]",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
},
{
"name": "content-type",
"value": "application/json"
}
]
},
"nodeCredentialType": "nocoDbApiToken"
},
"credentials": {
"nocoDbApiToken": {
"id": "Lrr0RsBkym1lNmzu",
"name": "NocoDB Token account"
}
},
"typeVersion": 4.2
},
{
"id": "993d1c7c-c7fc-49af-b046-4a9a87351799",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
360,
280
],
"parameters": {
"color": 5,
"width": 560,
"height": 80,
"content": "## Video Guide: https://youtu.be/-srzNushUsk"
},
"typeVersion": 1
},
{
"id": "3eaf41c0-235f-4f29-82a4-d875d1dcb9d0",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
190,
-40
],
"parameters": {
"color": 2,
"width": 160,
"height": 200,
"content": "### Set These!\n\n\n"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "0c26a980-72d0-4c49-941a-8c555ca94b08",
"connections": {
"699ea454-8841-465b-90d7-d093c4086cff": {
"main": [
[
{
"node": "2d86e7fb-936d-4f4c-8d1d-c6e50fa90a38",
"type": "main",
"index": 0
}
]
]
},
"ece698e5-29d1-493a-97d3-4ea66ef36e15": {
"main": [
[
{
"node": "a2c900e3-4515-4e9b-a99c-d62014f70c6c",
"type": "main",
"index": 0
}
]
]
},
"2d86e7fb-936d-4f4c-8d1d-c6e50fa90a38": {
"main": [
[
{
"node": "ece698e5-29d1-493a-97d3-4ea66ef36e15",
"type": "main",
"index": 0
}
]
]
},
"a2c900e3-4515-4e9b-a99c-d62014f70c6c": {
"main": [
[
{
"node": "bf318290-c151-4eb0-944e-37b66cb69d8e",
"type": "main",
"index": 0
}
]
]
},
"1285cb8b-45ab-4a87-9155-af8e06a195aa": {
"main": [
[
{
"node": "699ea454-8841-465b-90d7-d093c4086cff",
"type": "main",
"index": 0
}
]
]
}
}
}如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 工程
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Max aka Mosheh
@aiwithapexMax is an IBM-certified AI developer with a BS in Computer Science and 20+ years in software, AI consulting, and leadership. He founded several modest ventures and serves as Board President of RedeemTheOppressed.org. Married with five children, he’s raised over $3.5M for persecuted minorities. Ventures: Motivate-Mate.com | | MusicWithMax.com | VoiceAIBonanza.com | ApexWebServices.com | HeimishGiving.org | ForAfricanJews.org | AI Automation community - https://www.skool.com/ai-with-apex/about
分享此工作流