-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPI Workflow .json
More file actions
904 lines (904 loc) · 30.2 KB
/
API Workflow .json
File metadata and controls
904 lines (904 loc) · 30.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
{
"name": "🎓 Learn API Fundamentals with an Interactive Hands-On Tutorial Workflow",
"nodes": [
{
"parameters": {},
"id": "52e84ac4-6495-443e-b3d6-16d3291a6261",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Start Tutorial",
"type": "n8n-nodes-base.manualTrigger",
"creator": "Lucas Peyrin",
"position": [
1008,
800
],
"typeVersion": 1,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"path": "/tutorial/api/menu",
"responseMode": "lastNode",
"options": {}
},
"id": "5aab442c-2fd7-4b41-ae0f-eeaf9e722213",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "1. The Kitchen (GET /menu)",
"type": "n8n-nodes-base.webhook",
"creator": "Lucas Peyrin",
"position": [
2320,
800
],
"webhookId": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"typeVersion": 2,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "12345",
"name": "item",
"type": "string",
"value": "Pizza"
},
{
"id": "67890",
"name": "price",
"type": "number",
"value": 12
}
]
},
"options": {}
},
"id": "cee20f21-eb2e-4ea6-947f-acbc7f27a437",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Prepare Menu Data",
"type": "n8n-nodes-base.set",
"creator": "Lucas Peyrin",
"position": [
2544,
800
],
"typeVersion": 3.4,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"url": "={{ $json.base_url }}/tutorial/api/menu",
"options": {}
},
"id": "4af53e2a-0d5a-4b2e-8e65-fbc19d138abb",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "1. The Customer (GET Menu Item)",
"type": "n8n-nodes-base.httpRequest",
"creator": "Lucas Peyrin",
"position": [
2000,
800
],
"typeVersion": 4.1,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"content": "## Tutorial - What is an API?\n\nWelcome! This workflow will teach you the basics of APIs (Application Programming Interfaces).\n\n**What is an API?**\nThink of it like ordering food at a restaurant.\n- **You** are the \"Client\" (the **HTTP Request** node). You want something.\n- The **Kitchen** is the \"Server\" (the **Webhook** node). It has the data/service you want.\n- The **API** is the **Waiter and the Menu**. It's the set of rules and options for making a request and getting a response.\n\n\n**What is an Endpoint?**\nAn endpoint is a specific address for a specific action. For example, `GET /menu` is one endpoint to get the menu, and `POST /review` is another to submit a review. Each webhook in this tutorial represents one endpoint.\n\n**How to use this tutorial:**\n1. **Activate** the workflow (toggle on the top right).\n2. **Configure the Base URL** (see the yellow note to the left).\n3. Click **\"Execute Workflow\"**. The workflow will run from top to bottom.\n4. Explore each \"Lesson\" by clicking on the **HTTP Request** node (the Customer) and its corresponding **Webhook** node (the Kitchen).\n\n\n**➡️ How to See the Data:**\nWhen you run this, the Webhook nodes run in the background. To see the data they received, go to the **\"Executions\"** tab of this workflow. You will see a separate execution for each API call!",
"height": 768,
"width": 800
},
"id": "a1f76b04-daf5-41b9-b300-332b61d69cda",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"creator": "Lucas Peyrin",
"position": [
368,
240
],
"typeVersion": 1,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"content": "#### Lesson 1: The Basics (Method & URL)\n\nThis is the simplest possible request.\n\n- **URL (Uniform Resource Locator):** This is the **address of the restaurant's kitchen**. The HTTP Request node needs to know exactly where to send the order. We use an expression to get the Webhook's address automatically from our configuration.\n\n- **Method: `GET`**: This is **what you want to do**. `GET` is used to **retrieve** or **get** information. It's like asking the waiter, \"What's on the menu today?\" `GET` requests are simple and don't contain a \"body\" payload.\n\n\n**➡️ Look at the output of the HTTP Request node. It received exactly what the `Respond to Webhook` node sent back!**",
"height": 512,
"width": 864,
"color": 7
},
"id": "d37a6305-25ff-412d-8763-06e4c0a6b8ae",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"creator": "Lucas Peyrin",
"position": [
1936,
496
],
"typeVersion": 1,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"url": "={{ $json.base_url }}/tutorial/api/order",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "extra_cheese",
"value": "true"
}
]
},
"options": {}
},
"id": "edef5d0b-f0a4-4651-9ee4-84ecbe9e8062",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "2. The Customer (GET with Query Params)",
"type": "n8n-nodes-base.httpRequest",
"creator": "Lucas Peyrin",
"position": [
2000,
1472
],
"typeVersion": 4.1,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"path": "/tutorial/api/order",
"responseMode": "lastNode",
"options": {}
},
"id": "a2b5422d-fb46-4737-8182-dbbb50293fa1",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "2. The Kitchen (GET /order)",
"type": "n8n-nodes-base.webhook",
"creator": "Lucas Peyrin",
"position": [
2320,
1472
],
"webhookId": "b2c3d4e5-f6a7-8901-2345-67890abcdef1",
"typeVersion": 2,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "12345",
"name": "order",
"type": "string",
"value": "Pizza with extra cheese"
}
]
},
"options": {}
},
"id": "91d5b241-64c9-48cf-bf79-fff121d0febf",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Prepare Cheese Pizza",
"type": "n8n-nodes-base.set",
"creator": "Lucas Peyrin",
"position": [
2752,
1376
],
"typeVersion": 3.4,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "12345",
"name": "order",
"type": "string",
"value": "Plain Pizza"
}
]
},
"options": {}
},
"id": "bee0bce4-f854-4c1d-9ad1-b526f02e1925",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Prepare Plain Pizza",
"type": "n8n-nodes-base.set",
"creator": "Lucas Peyrin",
"position": [
2752,
1568
],
"typeVersion": 3.4,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"content": "#### Lesson 2: Customizing a Request (Query Parameters)\n\nWhat if you want to customize your order? That's what Query Parameters are for.\n\n**Query Parameters:** These are simple `key=value` options added to the end of the URL after a `?`. They are used to filter, sort, or specify what you want.\n\nIt's like telling the waiter, \"I'll have the pizza... **and can you add extra cheese?**\"\n\nThe full URL sent by the HTTP Request node looks like this:\n`.../tutorial/api/order?extra_cheese=true`\n\n**⚠️ Important:** Because they are part of the URL, **all query parameter values are treated as strings!** The webhook receives `\"true\"` (a string), not `true` (a boolean). The IF node is set to a \"loose\" comparison to handle this correctly.\n\n**➡️ The Webhook node uses an IF node to check for this parameter and changes its response. Try setting the value to `false` in the HTTP Request node and run it again!**",
"height": 720,
"width": 1056,
"color": 7
},
"id": "d6862155-ea76-4357-bae7-c4329ec1a612",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"creator": "Lucas Peyrin",
"position": [
1936,
1040
],
"typeVersion": 1,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"method": "POST",
"url": "={{ $json.base_url }}/tutorial/api/review",
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "comment",
"value": "The pizza was amazing!"
},
{
"name": "rating",
"value": 5
}
]
},
"options": {}
},
"id": "c568bc8c-822d-42b9-ab9b-2d91ae4e4fed",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "3. The Customer (POST with Body)",
"type": "n8n-nodes-base.httpRequest",
"creator": "Lucas Peyrin",
"position": [
2000,
2080
],
"typeVersion": 4.1,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"httpMethod": "POST",
"path": "/tutorial/api/review",
"responseMode": "lastNode",
"options": {}
},
"id": "0f0dae83-3290-4a5f-a039-3b54d87bcf7d",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "3. The Kitchen (POST /review)",
"type": "n8n-nodes-base.webhook",
"creator": "Lucas Peyrin",
"position": [
2320,
2080
],
"webhookId": "c3d4e5f6-a7b8-9012-3456-7890abcdef12",
"typeVersion": 2,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "12345",
"name": "status",
"type": "string",
"value": "review_received"
},
{
"id": "67890",
"name": "your_comment",
"type": "string",
"value": "={{ $json.body.comment }}"
},
{
"id": "91011",
"name": "your_rating",
"type": "number",
"value": "={{ $json.body.rating }}"
}
]
},
"options": {}
},
"id": "c5aa4f94-eca3-4321-b961-084917b93b81",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Process Review Data",
"type": "n8n-nodes-base.set",
"creator": "Lucas Peyrin",
"position": [
2544,
2080
],
"typeVersion": 3.4,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"content": "#### Lesson 3: Sending Data (POST & Body)\n\nSometimes, you don't want to *get* data, you want to *send* it.\n\n- **Method: `POST`**: This method is used to **send new data** to the server to create or update a resource. It's like handing the waiter a completed customer feedback card.\n\n- **Body:** This is the **actual data you are sending**. Unlike a `GET` request, a `POST` request has a \"body\" where you can put complex data, like a JSON object. This is much more powerful than query parameters for sending information.\n\n\n**➡️ The HTTP Request sends a JSON object in its body. The Webhook receives it and includes your comment in its response. Check the \"Executions\" panel to see the full body the webhook received!**",
"height": 476,
"width": 1056,
"color": 7
},
"id": "4020d264-7c01-4cf2-b51e-b8b3f2bc382b",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"creator": "Lucas Peyrin",
"position": [
1936,
1792
],
"typeVersion": 1,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"url": "={{ $json.base_url }}/tutorial/api/secret-dish",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "super-secret-key"
}
]
},
"options": {}
},
"id": "0fec2702-e2c9-4090-a327-f1d723b144b6",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "4. The Customer (GET with Headers/Auth)",
"type": "n8n-nodes-base.httpRequest",
"creator": "Lucas Peyrin",
"position": [
2000,
2944
],
"typeVersion": 4.1,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"path": "/tutorial/api/secret-dish",
"responseMode": "responseNode",
"options": {}
},
"id": "a35c1fc1-65a3-4d84-b29e-22939d334005",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "4. The Kitchen (GET /secret-dish)",
"type": "n8n-nodes-base.webhook",
"creator": "Lucas Peyrin",
"position": [
2320,
2944
],
"webhookId": "d4e5f6a7-b8c9-0123-4567-890abcdef123",
"typeVersion": 2,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"content": "#### Lesson 4: Identification (Headers & Auth)\n\nHeaders contain meta-information *about* your request. They're not part of the data itself, but they provide important context. Authentication is a common use case.\n\n- **Headers:** Think of this as **showing your VIP membership card** or whispering a secret password to the waiter. It's information that proves who you are or what your request's properties are.\n\n- **Authentication (Auth):** This is the process of proving your identity. Here, we use a custom header (`x-api-key`) as a \"secret key\". In the real world, this is how most APIs control access.\n\n\n**➡️ The Webhook checks for the correct secret key in the headers. If it's wrong or missing, it denies the request with a `401 Unauthorized` status code. Try changing the key in the HTTP Request node!**",
"height": 908,
"width": 1056,
"color": 7
},
"id": "8cb4d6d3-c29f-4562-a966-d13beafd8f40",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"creator": "Lucas Peyrin",
"position": [
1936,
2304
],
"typeVersion": 1,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"url": "={{ $json.base_url }}/tutorial/api/slow-service",
"options": {
"timeout": 2000
}
},
"id": "3ab5e611-71d2-4ff3-9462-fb69d60b48aa",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "5. The Customer (Request with Timeout)",
"type": "n8n-nodes-base.httpRequest",
"creator": "Lucas Peyrin",
"position": [
2000,
3664
],
"typeVersion": 4.1,
"onError": "continueErrorOutput",
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"path": "/tutorial/api/slow-service",
"responseMode": "lastNode",
"options": {}
},
"id": "5545e004-b8c3-4c47-91ee-31a2efa4c833",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "5. The Kitchen (GET /slow-service)",
"type": "n8n-nodes-base.webhook",
"creator": "Lucas Peyrin",
"position": [
2320,
3664
],
"webhookId": "e5f6a7b8-c9d0-1234-5678-90abcdef1234",
"typeVersion": 2,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "12345",
"name": "status",
"type": "string",
"value": "Finally, your food is here!"
}
]
},
"options": {}
},
"id": "237f65ad-3f1d-4afe-8541-89108afd57de",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Prepare Slow Response",
"type": "n8n-nodes-base.set",
"creator": "Lucas Peyrin",
"position": [
2752,
3664
],
"typeVersion": 3.4,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"content": "#### Lesson 5: Being Patient (Timeout & Error Handling)\n\nAn API request isn't instant. What if the kitchen is really busy?\n\n- **Timeout:** This is the **maximum amount of time (in milliseconds) you are willing to wait** for a response before you give up.\n\n- **On Error Output:** Notice the HTTP Request node has two outputs. The bottom one is the **error path**. If the request fails for any reason (like a timeout), the workflow will continue down this path instead of stopping.\n\n\nIn this example:\n- The **Kitchen (Webhook)** has a 3-second delay.\n- The **Customer (HTTP Request)** is only willing to wait for 2 seconds (2000 ms).\n\n\n**➡️ This request is designed to FAIL! The customer gives up before the kitchen can finish. The error output of the HTTP Request node will light up. This is crucial for building robust workflows that can handle API failures.**",
"height": 624,
"width": 1056,
"color": 7
},
"id": "dbe83810-b95f-46dd-bc2d-bf456fe11f94",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"creator": "Lucas Peyrin",
"position": [
1936,
3248
],
"typeVersion": 1,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"amount": 3
},
"id": "4e74c301-06e2-4b19-8101-3c63816ea615",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Wait 3 seconds",
"type": "n8n-nodes-base.wait",
"creator": "Lucas Peyrin",
"position": [
2544,
3664
],
"webhookId": "86b44ff3-7d31-4027-a1cd-df67f9ab974a",
"typeVersion": 1.1,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "ca861c2d-78d9-403b-8bab-28d8e7dcf39c",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.headers['x-api-key'] }}",
"rightValue": "super-secret-key"
}
]
},
"options": {}
},
"id": "42619763-955e-40d6-bbdb-23eea3c0bd85",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "IF Authorized",
"type": "n8n-nodes-base.if",
"creator": "Lucas Peyrin",
"position": [
2544,
2944
],
"typeVersion": 2.2,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "ca861c2d-78d9-403b-8bab-28d8e7dcf39c",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.query.extra_cheese }}",
"rightValue": "your-api-key-for-example"
}
]
},
"looseTypeValidation": true,
"options": {}
},
"id": "562d4436-df8c-47bf-b259-eea95ea88147",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "IF extra cheese",
"type": "n8n-nodes-base.if",
"creator": "Lucas Peyrin",
"position": [
2528,
1472
],
"typeVersion": 2.2,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"content": "## ✨ **CONFIGURATION REQUIRED** ✨\n\nTo use this interactive tutorial, you need to tell the \"Customer\" nodes where to find the \"Kitchen\" nodes.\n\n### **1. Get your Webhook URL**\n\n* **Activate** this workflow using the toggle switch at the top right of the screen.\n* Open any Webhook node in this workflow (e.g., `1. The Kitchen (GET /menu)`).\n* Go to the **Production URL** field and click the copy button.\n\n### **2. Update the CONFIGURATION Node**\n\n* Open the `CONFIGURATION` node (the one this note is pointing to).\n* In the **Value** field, **paste the full URL** you just copied.\n\n\nThat's it! Now you can run the workflow, and all the HTTP Request nodes will know how to call your webhooks.",
"height": 764,
"width": 700,
"color": 3
},
"id": "df8ea622-c2a5-4f6b-9a09-5d35b1dea0aa",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"creator": "Lucas Peyrin",
"position": [
1200,
240
],
"typeVersion": 1,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "7edededc-2f40-4b8e-b8db-ab4816f1a28e",
"name": "base_url",
"type": "string",
"value": "={{ $json.your_n8n_webhook_url.match(/^(https?:\\/\\/[^\\/]+)\\/(webhook-test|webhook|v1|[^\\/]+)/)[1] + '/' + $json.your_n8n_webhook_url.match(/^(https?:\\/\\/[^\\/]+)\\/(webhook-test|webhook|v1|[^\\/]+)/)[2].replace('webhook-test','webhook') }}"
}
]
},
"options": {}
},
"id": "c0c76d70-c630-4630-a22e-1909a410c527",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Base URL",
"type": "n8n-nodes-base.set",
"creator": "Lucas Peyrin",
"position": [
1600,
800
],
"typeVersion": 3.4,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"content": "### ⚠️ **Security Best Practice**\n\nFor this tutorial, we are putting the API key directly in the header. \n\n**In a real project, NEVER do this!**\n\nAlways use n8n's built-in **Credentials** system to store and manage secret keys. You would create a \"Header Auth\" credential and select it in the HTTP Request node's \"Authentication\" parameter. This keeps your secrets safe and out of your workflow JSON.",
"height": 496,
"width": 304,
"color": 3
},
"id": "e5f25f10-a1f0-4d67-b0fb-c3a2b8abf786",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"creator": "Lucas Peyrin",
"position": [
1952,
2624
],
"typeVersion": 1,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"respondWith": "json",
"responseBody": "{\n \"dish\": \"The Chef's Special Truffle Pasta\"\n}",
"options": {}
},
"id": "e908261b-cced-4539-9ea0-f40fb9e009e5",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Respond with Secret",
"type": "n8n-nodes-base.respondToWebhook",
"creator": "Lucas Peyrin",
"position": [
2752,
2832
],
"typeVersion": 1.4,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"respondWith": "text",
"responseBody": "You are not authorized to see the secret dish.",
"options": {
"responseCode": 401
}
},
"id": "52d54052-eab2-45b8-ac9a-389b7fdf40d3",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "Respond: Unauthorized (401)",
"type": "n8n-nodes-base.respondToWebhook",
"creator": "Lucas Peyrin",
"position": [
2752,
3040
],
"typeVersion": 1.4,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"content": "# What other services give you\n\nReal-world APIs have documentation that tells developers how to use them. This is what the documentation for our little tutorial API would look like. To put you in context, you would see this documentation and create http request nodes accordingly.\n\n**Remember**, AI can help you !\n\n\n# API Documentation Example\n\nA simple API to demonstrate http requests in n8n.\n\n## API Endpoints\n\n### GET /tutorial/api/menu\n\n**Summary:** Get the menu\n\n**Responses:**\n* `200 OK`: The restaurant menu.\n\n---\n\n### GET /tutorial/api/order\n\n**Summary:** Get a customized order\n\n**Parameters:**\n* `extra_cheese` (query, string, example: `true`): Whether to add extra cheese.\n\n\n**Responses:**\n* `200 OK`: Your customized pizza order.\n\n---\n\n### POST /tutorial/api/review\n\n**Summary:** Submit a review\n\n**Request Body (application/json):**\n```json\n{\n \"comment\": \"string\",\n \"rating\": 0\n}\n```\n* `comment` (string): The review comment.\n* `rating` (integer): The rating given (e.g., 1-5).\n\n\n**Responses:**\n* `200 OK`: Confirmation of review receipt.\n\n---\n\n### GET /tutorial/api/secret-dish\n\n**Summary:** Get the secret dish (Auth Required)\n\n**Authentication:** Requires API Key. See [Authentication](https://docs.n8n.io/integrations/builtin/credentials/httprequest/) section for details.\n\n**Responses:**\n* `200 OK`: The secret dish.\n* `401 Unauthorized`: Authentication is required or invalid.\n\n---\n\n### GET /tutorial/api/slow-service\n\n**Summary:** A slow endpoint to test timeouts\n\n**Responses:**\n* `200 OK`: A delayed response.\n\n---\n\n## Authentication\n\nThis API uses an API Key for authentication on certain endpoints.\n\n### API Key Authentication (`ApiKeyAuth`)\n\n* **Type:** API Key\n* **Location:** Header\n* **Header Name:** `x-api-key`\n\n\nTo authenticate, include your API key in the `x-api-key` header of your request.\n\n**Example:**\n```\nGET /tutorial/api/secret-dish\nHost: your-api-domain.com\nx-api-key: YOUR_API_KEY_HERE\n```",
"height": 2096,
"width": 696,
"color": 6
},
"id": "f9d72d6c-47b8-4f51-8a69-ce4d557ae90f",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "OpenAPI Spec",
"type": "n8n-nodes-base.stickyNote",
"creator": "Lucas Peyrin",
"position": [
3024,
1040
],
"typeVersion": 1,
"notes": "© 2025 Lucas Peyrin"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "7edededc-2f40-4b8e-b8db-ab4816f1a28e",
"name": "your_n8n_webhook_url",
"type": "string",
"value": "PASTE_YOUR_WEBHOOK_URL_HERE"
}
]
},
"options": {}
},
"id": "adacc21c-801a-49bb-a6da-630fc8b4272c",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "⚙️CONFIGURATION⚙️",
"type": "n8n-nodes-base.set",
"creator": "Lucas Peyrin",
"position": [
1376,
800
],
"typeVersion": 3.4,
"notes": "© 2025 Lucas Peyrin"
}
],
"pinData": {},
"connections": {
"Base URL": {
"main": [
[
{
"node": "1. The Customer (GET Menu Item)",
"type": "main",
"index": 0
},
{
"node": "2. The Customer (GET with Query Params)",
"type": "main",
"index": 0
},
{
"node": "3. The Customer (POST with Body)",
"type": "main",
"index": 0
},
{
"node": "4. The Customer (GET with Headers/Auth)",
"type": "main",
"index": 0
},
{
"node": "5. The Customer (Request with Timeout)",
"type": "main",
"index": 0
}
]
]
},
"IF Authorized": {
"main": [
[
{
"node": "Respond with Secret",
"type": "main",
"index": 0
}
],
[
{
"node": "Respond: Unauthorized (401)",
"type": "main",
"index": 0
}
]
]
},
"Start Tutorial": {
"main": [
[
{
"node": "⚙️CONFIGURATION⚙️",
"type": "main",
"index": 0
}
]
]
},
"Wait 3 seconds": {
"main": [
[
{
"node": "Prepare Slow Response",
"type": "main",
"index": 0
}
]
]
},
"IF extra cheese": {
"main": [
[
{
"node": "Prepare Cheese Pizza",
"type": "main",
"index": 0
}
],
[
{
"node": "Prepare Plain Pizza",
"type": "main",
"index": 0
}
]
]
},
"⚙️CONFIGURATION⚙️": {
"main": [
[
{
"node": "Base URL",
"type": "main",
"index": 0
}
]
]
},
"1. The Kitchen (GET /menu)": {
"main": [
[
{
"node": "Prepare Menu Data",
"type": "main",
"index": 0
}
]
]
},
"2. The Kitchen (GET /order)": {
"main": [
[
{
"node": "IF extra cheese",
"type": "main",
"index": 0
}
]
]
},
"3. The Kitchen (POST /review)": {
"main": [
[
{
"node": "Process Review Data",
"type": "main",
"index": 0
}
]
]
},
"4. The Kitchen (GET /secret-dish)": {
"main": [
[
{
"node": "IF Authorized",
"type": "main",
"index": 0
}
]
]
},
"5. The Kitchen (GET /slow-service)": {
"main": [
[
{
"node": "Wait 3 seconds",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "71dfcf4e-ddff-4334-96b0-7c6e807ab1a7",
"meta": {
"templateId": "5171",
"instanceId": "f8d1adab0f0b187463975e22550f4270e01999980d8602745b4b4750b4b5fdfb"
},
"id": "0alrrST7BoJkVab9",
"tags": []
}