SharpSpring API via HTTP Request Node

Describe the issue/error/question

Newbie trying to use HTTP Request Node to pull info from SharpSpring.com

Example Code:

What is the error message (if any)?

Invalid HTTP Header Token or Error 400 Request Rejected. It changes from run to run

Please share the workflow

{
  "nodes": [
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "http://api.sharpspring.com/pubapi/v1/",
        "options": {},
        "headerParametersUi": {
          "parameter": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Content-Length",
              "value": "="
            }
          ]
        },
        "queryParametersUi": {
          "parameter": [
            {
              "name": "accountID",
              "value": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
            },
            {
              "name": "secretKey",
              "value": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
            },
            {
              "name": "ID",
              "value": "TEST1"
            },
            {
              "name": "Method",
              "value": "getLead"
            },
            {
              "name": "Params",
              "value": "{     \"id\":\"1\"   }"
            }
          ]
        }
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        20,
        380
      ]
    }
  ],
  "connections": {}
}
(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)

Share the output returned by the last node

{“status”:“rejected”,“reason”:{“message”:"400 - “Error 400 (Bad Request)!!1"”,“name”:“Error”,“stack”:“Error: Request failed with status code 400\n at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11)\n at IncomingMessage.emit (events.js:327:22)\n at endReadableNT (internal/streams/readable.js:1327:12)\n at processTicksAndRejections (internal/process/task_queues.js:80:21)”}}

Information on your n8n setup

  • n8n version: latest as of 12/29/21
  • Database you’re using (default: SQLite): PostGreSQL
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

It looks like the parameters method and params have to go in the body and not in the querystring. Try sending them in the body.

1 Like

Thank you for the quick response!

I actually just figured that out too. I also had to format them as JSON. I think I have everything correct now. However I’m getting a weird error from SharpSpring, that they don’t even list.

I’m getting…

“401 - “Unable to determine clusterID from provided accountID/secretKey””

I’m wondering if I tried too many times, and this is how they lock you out for a while.

I figured it out.

I had to move the

accountID
secretKey

parameters to the Query String and leave the rest in the Body

1 Like

Great that you figured it out. Have fun.