HTTP POST request gives error but i can run the same request successfully in Python without issue. What am I doing wrong?

I can run the following Python code locally:

import requests
import json

url = "https://api.logsnag.com/v1/log"

payload = json.dumps({
  "project": "facebook-ads-alert",
  "event": "Successful Payment",
  "user_id": "user-123",
  "description": "2x 1TB SSD - Overnight Shipping",
  "icon": "💰",
  "tags": {
    "shipping": "overnight",
    "quantity": 2
  },
  "notify": True,
  "channel": "cpc-high"
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer **OMITTED**'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

and I am trying to replicate this request in an HTTP node in n8n (cloud) but keep getting an error that states “Bad request - please check your parameters”. This is how I have the node configured. What am i doing wrong?

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

Hey @Vyrus_M,

The URL you are using in n8n has a / at the end and the API fails if you have that, Other than that what you have seems to work with my test account once I updated the Project to my own.

I would also recommend using a generic credential rather than having it in the node like that.

Hey Jon,
Removing the / does not make a difference. Can you elaborate on what you mean by using a generic credential? Are you saying not use the header in the request and instead enter the information in a different field in the node?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.