Need help to connect neo4j aura instance with n8n http request

hello here, I am trying to connect my online neo4j instance on n8n, so I try to connect neo4j instance through http request, I try to do it in python first, however, as I followed the, but I always get: Error occurred: 405 Client Error: Method Not Allowed for url:

my url is neo4j_url = "http://fc009e6d.databases.neo4j.io/db/neo4j/query/v2"
and my connection setting is

auth_string = base64.b64encode(f"{username}:{password}".encode()).decode()
    
    headers = {
        "Content-Type": "application/json",
        "Accept": "application/json;charset=UTF-8",
        "Authorization": f"Basic {auth_string}"
    }
    
    # Prepare the query payload
    payload = {
        "statements": [{
            "statement": query,
            "parameters": params or {}
        }]
    }
    
    response = requests.post(
        url,
        headers=headers,
        json=payload
    )

please help me understand what is causing the problem, thanks

There's a couple of items that need attention

URL
http://fc009e6d.databases.neo4j.io/db/neo4j/query/v2 should be https://fc009e6d.databases.neo4j.io/db/neo4j/query/v2 as Aura only supports HTTPS

Payload

This is the payload structure used by the old HTTP API.

 payload = {
        "statements": [{
            "statement": query,
            "parameters": params or {}
        }]
    }

The Query API payload structure is

 payload = {
            "statement": "",
            "parameters":  {}
        }

The Query API documentation is here:- https://neo4j.com/docs/query-api/current/

You may also want to consider using BasicAuth from requests module as it makes handling username / password easier.

You code then looks like this

from requests.auth import HTTPBasicAuth
import requests

url = "https://fc009e6d.databases.neo4j.io/db/neo4j/query/v2"

user="neo4j"
password="YOUR_PASSWORD"

my_auth = HTTPBasicAuth(user, password)

headers = {
    "Content-Type": "application/json",
    "Accept": "application/json"
}

# Prepare the query payload
query = "MATCH (n) RETURN n LIMIT 1"
params = {}

payload = {
    "statement": query,
    "parameters": params
}

response = requests.post(
    url,
    headers=headers,
    json=payload,
    auth=my_auth
)

print(f"Response from Neo4j: {response.json()}")