Posted json has missing root node: payload : HTTP Request :

NEWBIE
I am using the HTTP request node to execute a “Bank_GetAccounts Schema” from my book keeping SW.

I am new to n8n and API’s etc but have so far used n8n to generate random numbers for the submission key and an MD5 Crypto; all matching the APIs authentication needs but …

The API Doc kindly shows the exact JSON construct to send as a request.

{
  "payload": {
    "Header": {
      "MessageType": "Request",
      "SubmissionNumber": "61601e61-c346-4348-bd22-25214b5ef06a",
      "Authentication": {
        "AccNumber": "6131603418",
        "MD5Value": "90a2c38c9d2ca1ad5c40abe276544563",
        "ApplicationID": "9fe39528-d7c0-43f7-8575-83fd589413be"
      }
    },
    "Body": {
      "SearchParameters": {
        "OrderResultsBy": "Position",
        "AccountTypes": {
          "AccountType": [
            "CURRENT",
            "CREDITCARD"
          ]
        },
        "ShowHidden": "false",
        "GetOpenBankingConsents": "false"
      }
    }
  }
}

What is the error message (if any)?

400 - "{\"Errors\":{\"Error\":[\"Posted json has missing root node: payload\"]}}"

I found a post relating to “JSON/RAW Parameters” but I don’t have this option. Is there a config I have to set, the help docs don’t mention it.

Please share your workflow


My HEADER JSON appears to be grabbing all the correct input as the Result window shows the output matches the API Doc example.

I then use JSON as my BODY content as follows.

So far to me anyway the Header and Body look like the given API Doc example.

EXCEPT for one thing. The Example shows { “payload” : { etc
I TEST the execution of the node and receive a response from the endpoint of 400 - “{"Errors":{"Error":["Posted json has missing root node: payload"]}}”

(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.)

Information on your n8n setup

  • n8n cloud:
  • Windows 11

Can anyone guide me on getting my first API working :slight_smile: I feel once I crack this I’ll be off… I tried using the Chrome Developer Console but it’s not clear what I am looking for. I kind of need to know how n8n constructs the JSON request to the API endpoint but the final result of the “node” config is hidden…

This is the whole workflow so far. (API keys are fake)

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:

So the only way I was able to rectify this was to find an OLD HTTP Request that had the JSON/RAW switch. and cut and past the whole of the JSON into the BODY.
It seems a complete bodge but for now it works.

Hey @Peter_Betts , as the API doc states the JSON body has to be in the format (including payload.Header and payload.Body)

{
  "payload": {
    "Header": {
      "MessageType": "Request",
      "SubmissionNumber": "00000001",
      "Authentication": {
        "AccNumber": "123456",
        "MD5Value": "7dd259dea3393880406d292e3f6f5830",
        "ApplicationID": "appID"
      }
    },
    "Body": {
      "SearchParameters": {
        "OrderResultsBy": "Position",
        "AccountTypes": {
          "AccountType": [
            "CURRENT",
            "CREDITCARD"
          ]
        },
        "ShowHidden": "false",
        "GetOpenBankingConsents": "false"
      }
    }
  }
}

However, you initially separated the parts of that payload thinking that headers are not part of the body but just part of headers. It is an odd API but that is the requirements if demands. Thus, the last example you provided is correct indeed.