Files
n8n-workspace/paperless_get_component.json

347 lines
12 KiB
JSON

{
"updatedAt": "2026-01-04T14:54:00.000Z",
"createdAt": "2026-01-04T09:23:16.248Z",
"id": "yvSB21lQNL04DH2l",
"name": "paperless_get_component",
"active": false,
"isArchived": false,
"nodes": [
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "abfbb141-819d-4df5-abcb-3facf527e19e",
"leftValue": "={{ $json.next }}",
"rightValue": "={{ $('get_correspondents').last().json.next }}",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
400,
-448
],
"id": "6a14c36a-56d2-4b04-9c32-de7bc4efa1ec",
"name": "weitere Seiten vorhanden",
"alwaysOutputData": false
},
{
"parameters": {
"jsCode": "const allData = []\nvar json_lst = []\n\nlet counter = 0;\ndo {\n try {\n const response = $items(\"get_correspondents\", 0, counter)[0].json;\n \n const filtered = response.results.map(item => {\n return {\n id: item.id,\n slug: item.slug,\n name: item.name\n };\n });\n allData.push(...filtered);\n } catch (error) {\n return [{json: {allData}}]; \n }\n\n counter++;\n} while(true);\n\n\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
624,
-448
],
"id": "72256153-a6e3-4fd7-9ca9-6daf01711531",
"name": "Code in JavaScript"
},
{
"parameters": {
"url": "={{ \n $('weitere Seiten vorhanden').isExecuted == false ? $('global_variables').item.json.component_url: $node['weitere Seiten vorhanden'].json.next\n}}",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {
"response": {
"response": {}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
176,
-448
],
"id": "aa753efb-2704-4578-902a-847c15317a36",
"name": "get_correspondents",
"credentials": {
"httpHeaderAuth": {
"id": "zyL5PgYOGlAptjwA",
"name": "paperless_api_token"
}
}
},
{
"parameters": {
"operation": "upsert",
"dataTableId": {
"__rl": true,
"value": "={{\n$('global_variables').item.json.component_name == \"tags\" \n?\n$('global_variables').item.json.paperless_tag_db_id\n:\n$('global_variables').item.json.component_name == \"correspondents\" \n?\n$('global_variables').item.json.paperless_correspondent_db_id\n:\n$('global_variables').item.json.component_name == \"document_types\" \n?\n$('global_variables').item.json.paperless_document_type_db_id\n:null\n}}",
"mode": "id"
},
"filters": {
"conditions": [
{
"keyName": "paperless_id",
"keyValue": "={{ $json.id }}"
}
]
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"paperless_id": "={{ $json.id }}",
"slug": "={{ $json.slug }}",
"name": "={{ $json.name }}"
},
"matchingColumns": [],
"schema": [
{
"id": "paperless_id",
"displayName": "paperless_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "slug",
"displayName": "slug",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "name",
"displayName": "name",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {
"dryRun": false
}
},
"type": "n8n-nodes-base.dataTable",
"typeVersion": 1,
"position": [
1072,
-448
],
"id": "5ff57627-d129-48f4-a353-ad2f87b34f18",
"name": "Upsert row(s)",
"executeOnce": false
},
{
"parameters": {
"fieldToSplitOut": "allData",
"options": {}
},
"type": "n8n-nodes-base.splitOut",
"typeVersion": 1,
"position": [
848,
-448
],
"id": "a9784b72-a0ae-4653-9195-dfdfbdcc670a",
"name": "Split Out1"
},
{
"parameters": {
"workflowInputs": {
"values": [
{
"name": "component_name"
},
{
"name": "component_url"
}
]
}
},
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1.1,
"position": [
-272,
-448
],
"id": "b3a4302b-fb6c-4719-b3f7-9f9dbeee893f",
"name": "When Executed by Another Workflow"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "653145bb-ff78-4a14-a90a-c20f890f0889",
"name": "component_name",
"value": "={{ \n$('When Executed by Another Workflow').item.json.component_name || \"tags\"\n}}",
"type": "string"
},
{
"id": "c84e488d-1891-4a18-98be-21c4c5a9f0ae",
"name": "component_url",
"value": "={{ \n$('When Executed by Another Workflow').item.json.component_url\n||\n\"http://192.168.178.101:8000/api/tags/\"\n}}",
"type": "string"
},
{
"id": "40329995-bcdb-4546-b2dc-d8b33d020198",
"name": "paperless_correspondent_db_id",
"value": "WmMZJjFqs1LTGlxy",
"type": "string"
},
{
"id": "ff02936f-ddb3-40e4-9255-54cdfff6c291",
"name": "paperless_tag_db_id",
"value": "O8FtQxHCgJRAtOy1",
"type": "string"
},
{
"id": "ab142cd3-e7bb-4fd6-9871-d15f57cee573",
"name": "paperless_document_type_db_id",
"value": "9CYGbOQ8zjL0gRTE",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-48,
-448
],
"id": "ee95c281-caeb-4e2d-87a4-f45c426e5565",
"name": "global_variables"
}
],
"connections": {
"weitere Seiten vorhanden": {
"main": [
[
{
"node": "get_correspondents",
"type": "main",
"index": 0
}
],
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"get_correspondents": {
"main": [
[
{
"node": "weitere Seiten vorhanden",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "Split Out1",
"type": "main",
"index": 0
}
]
]
},
"Upsert row(s)": {
"main": [
[]
]
},
"Split Out1": {
"main": [
[
{
"node": "Upsert row(s)",
"type": "main",
"index": 0
}
]
]
},
"When Executed by Another Workflow": {
"main": [
[
{
"node": "global_variables",
"type": "main",
"index": 0
}
]
]
},
"global_variables": {
"main": [
[
{
"node": "get_correspondents",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"meta": {
"templateCredsSetupCompleted": true
},
"pinData": {},
"versionId": "6d5c26d0-cb68-422a-978b-be63886a0a64",
"triggerCount": 0,
"shared": [
{
"updatedAt": "2026-01-04T09:23:16.252Z",
"createdAt": "2026-01-04T09:23:16.252Z",
"role": "workflow:owner",
"workflowId": "yvSB21lQNL04DH2l",
"projectId": "S4tmpzSj6JlGFOze"
}
],
"tags": [
{
"updatedAt": "2026-01-04T09:23:14.869Z",
"createdAt": "2026-01-04T09:23:14.869Z",
"id": "7ZDCcNolVMDFEdmE",
"name": "ollama_paperless"
}
]
}