What is proper structure for HTTP Request node?

Describe the problem/error/question

I have been trying to use the http request node unsuccefullyfor three dys now trying to pull data from Supabase hat is storing data pulled from reddit

What is the error message (if any)?

json parameter needs to be valid JSON [item 0]

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

{
“nodes”: [
{
“parameters”: {
“rule”: {
“interval”: [
{
“triggerAtHour”: 8
}
]
}
},
“type”: “n8n-nodes-base.scheduleTrigger”,
“typeVersion”: 1.2,
“position”: [
-140,
-140
],
“id”: “88f53f6b-59cc-4c67-87d5-8ee85fa83056”,
“name”: “Schedule Trigger”
},
{
“parameters”: {
“mode”: “raw”,
“jsonOutput”: “{\n "subreddits": ["CryptoCurrency", "NFT", "stocks"],\n "limit": 10,\n "timeframe": "day"\n}\n\n”,
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
20,
-140
],
“id”: “703b0509-52fd-4b04-b02a-f4759e96c7f3”,
“name”: “Edit Fields”
},
{
“parameters”: {
“fieldToSplitOut”: “subreddits”,
“options”: {}
},
“type”: “n8n-nodes-base.splitOut”,
“typeVersion”: 1,
“position”: [
180,
-140
],
“id”: “e04f0bd0-3e27-4911-a6ac-46296f623e65”,
“name”: “Split Out”
},
{
“parameters”: {
“jsCode”: “return items.map(item => {\n return {\n json: {\n subreddit: item.json.subreddits,\n sort: ‘top’,\n time: ‘day’,\n limit: 5\n }\n };\n});\n”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
340,
-140
],
“id”: “de7659e4-425b-4756-86ce-b13543246f9d”,
“name”: “Code”
},
{
“parameters”: {
“operation”: “getAll”,
“subreddit”: “={{ $json["subreddit"] }}”,
“filters”: {}
},
“type”: “n8n-nodes-base.reddit”,
“typeVersion”: 1,
“position”: [
500,
-140
],
“id”: “dc831489-e26c-462d-9964-a7c573ddac1d”,
“name”: “Reddit”,
“credentials”: {
“redditOAuth2Api”: {
“id”: “xsc4gpW5s5Fvr2SC”,
“name”: “Reddit account”
}
}
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “b5892dac-c36c-47e1-aa03-d5b783561646”,
“leftValue”: “stickied”,
“rightValue”: “false”,
“operator”: {
“type”: “string”,
“operation”: “notEquals”
}
},
{
“id”: “6978ecd3-4ef4-4f5a-8c11-b2bdfce18b5b”,
“leftValue”: null,
“rightValue”: 10,
“operator”: {
“type”: “number”,
“operation”: “gt”
}
},
{
“id”: “df925285-023f-4183-94b9-9a82b6207cd4”,
“leftValue”: null,
“rightValue”: 5,
“operator”: {
“type”: “number”,
“operation”: “gt”
}
}
],
“combinator”: “and”
},
“options”: {}
},
“type”: “n8n-nodes-base.if”,
“typeVersion”: 2.2,
“position”: [
660,
-140
],
“id”: “ac7a2715-b584-4809-961c-4428ce2548f7”,
“name”: “If”
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “f57f8331-c603-4f66-bbed-5838d12b79fd”,
“name”: “=title”,
“value”: “={{$json["title"]}}”,
“type”: “string”
},
{
“id”: “4306a81f-8834-4267-bdd2-32f71ffe15bd”,
“name”: “url”,
“value”: “=https://reddit.com{{$json["permalink"]}}”,
“type”: “string”
},
{
“id”: “13d52a1b-9bce-42d8-a44e-dafdb75564f3”,
“name”: “score”,
“value”: “={{$json["score"]}}”,
“type”: “string”
},
{
“id”: “0fb9054c-ec25-4ad8-aed8-bb2476ca787e”,
“name”: “comments”,
“value”: “={{$json["num_comments"]}}”,
“type”: “string”
},
{
“id”: “ebed64c0-daf3-4fcc-93d6-752c07d4fc61”,
“name”: “subreddit”,
“value”: “={{$json["subreddit"]}}”,
“type”: “string”
},
{
“id”: “ca9bc38a-bf6f-46e1-ba1b-cc666c57b29d”,
“name”: “author”,
“value”: “=u/{{$json["author"] || $json["author_fullname"]}}\n”,
“type”: “string”
},
{
“id”: “afb4a999-6714-4408-820d-f3a4bc5c894a”,
“name”: “summary”,
“value”: “={{$json["title"]}} \n:link: View Post \n​:+1: {{$json["score"]}} | :speech_balloon: {{$json["num_comments"]}} \nSubreddit: r/{{$json["subreddit"]}} | Author: u/{{$json["author"] || $json["author_fullname"]}}\n”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
820,
-40
],
“id”: “b5e44f4c-630c-4522-a5bb-51ed127d7c32”,
“name”: “Edit Fields1”
},
{
“parameters”: {
“method”: “POST”,
“url”: “https://jnbrxsqvooppvzphertt.supabase.co/rest/v1/reddit_posts”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “Authorization”,
“value”: “Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpuYnJ4c3F2b29wcHZ6cGhlcnR0Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc1MDc4NjM1MCwiZXhwIjoyMDY2MzYyMzUwfQ.Affk5TuwoslFgv4_Esx_KgKrjWQJxUJ9XfX35-HQLJ0”
},
{
“name”: “apikey”,
“value”: “eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpuYnJ4c3F2b29wcHZ6cGhlcnR0Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc1MDc4NjM1MCwiZXhwIjoyMDY2MzYyMzUwfQ.Affk5TuwoslFgv4_Esx_KgKrjWQJxUJ9XfX35-HQLJ0”
},
{
“name”: “Content-Type”,
“value”: “application/json”
}
]
},
“sendBody”: true,
“specifyBody”: “json”,
“jsonBody”: “={\n "title": "={{$json["title"]}}",\n "author": "={{$json["author"]}}",\n "score": ={{$json["score"]}},\n "num_comments": ={{$json["comments"]}},\n "subreddit": "={{$json["subreddit"]}}",\n "permalink": "={{$json["url"]}}"\n}”,
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
1020,
-40
],
“id”: “5e4d2329-9ce5-452e-8c82-73f5c3823c45”,
“name”: “HTTP Request”,
“alwaysOutputData”: true
}
],
“connections”: {
“Schedule Trigger”: {
“main”: [
[
{
“node”: “Edit Fields”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields”: {
“main”: [
[
{
“node”: “Split Out”,
“type”: “main”,
“index”: 0
}
]
]
},
“Split Out”: {
“main”: [
[
{
“node”: “Code”,
“type”: “main”,
“index”: 0
}
]
]
},
“Code”: {
“main”: [
[
{
“node”: “Reddit”,
“type”: “main”,
“index”: 0
}
]
]
},
“Reddit”: {
“main”: [
[
{
“node”: “If”,
“type”: “main”,
“index”: 0
}
]
]
},
“If”: {
“main”: [
,
[
{
“node”: “Edit Fields1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields1”: {
“main”: [
[
{
“node”: “HTTP Request”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “d85a744ae4fdd3c25cd72b7a2a632ca248d9aae16bc4a9a33f784325a6d146f5”
}
}

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @Seven1 hope all is well, welcome to the community.

Could use embed your workflow instead of pasting the json, please?

1 Like

And when you say “unsuccessfully”, what do you mean? An error of some sort or it just doesn’t return anything? Is there a reason you don’t use the supabase node?

Oh I have gone through several errors but the most recent error is the JSON format. this is the return message below:

“JSON parameter needs to be valid JSON”

1 Like

Well, is it valid? Can you share the input data or a workflow with pinned data?