185 lines
4.8 KiB
JSON
185 lines
4.8 KiB
JSON
{
|
|
"id": "NChjOd3ILEmt0FdyAt8qA",
|
|
"name": "Transmission: Get Session",
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "=http://{{ $json.server_id }}:9091/transmission/rpc",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpBasicAuth",
|
|
"sendBody": true,
|
|
"specifyBody": "json",
|
|
"jsonBody": "={{ { method: 'session-get' } }}",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"fullResponse": true,
|
|
"neverError": true
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"id": "4c14375e-3d69-46eb-b263-d333a775dc02",
|
|
"name": "Request Transmission Session",
|
|
"position": [
|
|
-176,
|
|
16
|
|
],
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"credentials": {
|
|
"httpBasicAuth": {
|
|
"id": "iymUPilnVhfL3h5D",
|
|
"name": "transmission"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"language": "pythonNative",
|
|
"pythonCode": "# Access the first item's JSON data\n# In n8n Python nodes, '_items' is the global list of input items\nfirst_item = _items[0]['json']\n\n# Get headers safely\nheaders = first_item.get('headers', {})\n\n# Extract session ID (check both lowercase and capitalized keys)\nsession_id = headers.get('x-transmission-session-id') or headers.get('X-Transmission-Session-Id')\n\nif not session_id:\n raise Exception('Transmission session header missing')\n\n# Return the formatted list with 'json' key\nreturn [{'json': {'session_id': session_id}}]"
|
|
},
|
|
"id": "7880edb1-b575-4f9f-b744-987d22cd18a6",
|
|
"name": "Extract Session Header",
|
|
"position": [
|
|
48,
|
|
16
|
|
],
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2
|
|
},
|
|
{
|
|
"parameters": {
|
|
"workflowInputs": {
|
|
"values": [
|
|
{
|
|
"name": "server_id"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.executeWorkflowTrigger",
|
|
"typeVersion": 1.1,
|
|
"position": [
|
|
-624,
|
|
112
|
|
],
|
|
"id": "f39637d4-bd93-470a-a704-7947450edfb5",
|
|
"name": "When Executed by Another Workflow"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"errorMessage": "Invalid server_name, must be a seed server."
|
|
},
|
|
"type": "n8n-nodes-base.stopAndError",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
-176,
|
|
208
|
|
],
|
|
"id": "1299a1c0-5147-4da1-8fab-1eb0fb696e68",
|
|
"name": "Stop and Error"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": false,
|
|
"leftValue": "",
|
|
"typeValidation": "strict",
|
|
"version": 3
|
|
},
|
|
"conditions": [
|
|
{
|
|
"id": "d1351268-ab96-4a81-905a-336fd784da32",
|
|
"leftValue": "={{ $json.server_id }}",
|
|
"rightValue": "seed",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "startsWith"
|
|
}
|
|
},
|
|
{
|
|
"id": "c3d2d00a-ce5c-49cc-b468-4088623a773b",
|
|
"leftValue": "={{ $json.server_id }}",
|
|
"rightValue": "ben.io",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "endsWith"
|
|
}
|
|
}
|
|
],
|
|
"combinator": "and"
|
|
},
|
|
"options": {
|
|
"ignoreCase": true
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.if",
|
|
"typeVersion": 2.3,
|
|
"position": [
|
|
-400,
|
|
112
|
|
],
|
|
"id": "c31c8c1a-bba5-47b2-a7b8-e30b53ccb38d",
|
|
"name": "server name check"
|
|
}
|
|
],
|
|
"connections": {
|
|
"Request Transmission Session": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Extract Session Header",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"When Executed by Another Workflow": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "server name check",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"server name check": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Request Transmission Session",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Stop and Error",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"settings": {
|
|
"executionOrder": "v1",
|
|
"availableInMCP": false
|
|
},
|
|
"triggerCount": 0,
|
|
"versionId": "b1a4dc71-5217-4bc9-8f23-ec7b92a7d23a",
|
|
"owner": {
|
|
"type": "personal",
|
|
"projectId": "FeLO36wNUAcn61Wj",
|
|
"projectName": "Ben W <admin@ben.io>",
|
|
"personalEmail": "admin@ben.io"
|
|
},
|
|
"parentFolderId": "6tDyZCwqELStb6Ik",
|
|
"isArchived": false
|
|
} |