New ERROR: Bad request - please check your parameters

Hi, new ERROR: Bad request - please check your parameters.

I have this error when generating the Post HTTP Request. the following message appears:

ERROR: Bad request - please check your parameters

Details

Time

19/07/2023 08:44:17

Item Index: 0

HTTP Code

400

Cause
Data below may contain sensitive information. Proceed with caution when sharing.

{

“status”:“rejected”,

“reason”:{

“message”:“400 - “{"code":"rest_upload_no_content_disposition","message":"No Content-Disposition supplied.","data":{"status":400}}””,

“name”:“Error”,

“stack”:“Error: 400 - “{"code":"rest_upload_no_content_disposition","message":"No Content-Disposition supplied.","data":{"status":400}}” at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15) at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12) at RedirectableRequest.handleResponse (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:238:9) at RedirectableRequest.emit (node:events:525:35) at RedirectableRequest.emit (node:domain:489:12) at RedirectableRequest._processResponse (/usr/local/lib/node_modules/n8n/node_modules/follow-redirects/index.js:356:10) at ClientRequest.RedirectableRequest._onNativeResponse (/usr/local/lib/node_modules/n8n/node_modules/follow-redirects/index.js:62:10) at Object.onceWrapper (node:events:628:26) at ClientRequest.emit (node:events:525:35) at ClientRequest.emit (node:domain:489:12) at HTTPParser.parserOnIncomingClient (node:_http_client:693:27) at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17) at TLSSocket.socketOnData (node:_http_client:534:22) at TLSSocket.emit (node:events:513:28) at TLSSocket.emit (node:domain:489:12) at addChunk (node:internal/streams/readable:315:12) at readableAddChunk (node:internal/streams/readable:289:9) at TLSSocket.Readable.push (node:internal/streams/readable:228:10) at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17)”

}

}

Stack

NodeApiError: Bad request - please check your parameters
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js:1281:27)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:655:19)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:596:53

HTTP Request

Execute node

Parameters


Docs

Import cURL

Method

Fixed

Expression

URL

Fixed

Expression

Authentication

Generic Auth Type

Fixed

Expression

Credential for Basic Auth

Send Query Parameters

Send Headers

Send Body

Body Content Type

Fixed

Expression

Specify Body

Fixed

Expression

Body Parameters

Name

Fixed

Expression

Value

Fixed

Expression

{{ $json.image_url1 }}

https://www.pexels.com/photo/framed-image-with-russian-inscription-placed-on-table-5425695/

Name

Fixed

Expression

Value

Fixed

Expression

{{ $json.image_url2 }}

https://www.pexels.com/photo/laptop-with-map-on-blue-screen-on-table-at-home-4558710/

Add Parameter

Options

No properties

You can view the raw requests this node makes in your browser’s developer console

I wish this node would…

Hi @Edgard_Neto, seeing you have posted quite a lot recently, could you please check the below points before reading my thoughts on the actual problem?

  1. It seems your workflow can’t be executed out of the box as it does not include example data and relies on credentials for multiple different services such as OpenAI or WordPress. When reaching out here on the forum it’d be great if you could simplify your workflow rather than leaving it to the folks trying to help you.
  2. It’d also be of great help if you could fill out the details requested in the forum template when posting. This will help greatly with understanding your setup.
  3. Make sure you don’t post any confidential/secret information such as access tokens on a public forum. Keep them just as secret as you would passwords. This is not so much a problem for others, but by doing so you will put yourself at risk. So you would want to revoke the credentials you have included in your example workflow here as soon as you can.

Problem

On the actual issue, the 400 error you have thrown is coming from the API you are calling. It seems you are making a POST request to https://superrealreviews.com/wp-json/wp/v2/media which is a Wordpress instance. You are sending body parameters like image_url1 or image_url2 but these aren’t any parameters understood by the endpoint in question from the looks of it.

This is not an n8n-specific problem, you’d see the very same behaviour when trying to send unknown parameters to your API using curl or Postman for example.

Solution

To upload photos to Wordpress you’d need to make sure to have the respective files in n8n as binary objects (meaning you would need to download them before doing anything with them). Here is a quick workflow showing the idea, first defining two items with a url value on the Mock data node, then downloading images from these URLs and finally uploading them to Wordpress. When giving this a try on your side you would of course have to use a valid url and credentials (username + app password) of your own Wordpress instance:

The workflow runs as expected:

The images also show up in the WP UI:

Hope this helps!

5 Likes

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