Getting Error in API connector - Error code 400

I have made a workflow on dify, and am trying to connect it through our API connector.
I have connected the file upload api but I am having an issue connecting to the “Execute Workflow”.

Screenshot of the API connector
1.Dify (Atnest) - file Upload

  1. Execute Workflow

While initializing the call to execute workflow, I am getting below error:

Other things which I have tried

  • I switch to “Data type” to file from json, then it also shows an error.
  • I switch the “Body type” to form-data, then it asks for the json code.

Can you please anyone let me know on this.

Thanks

1 Like

Hello,

I believe that you need get the response from step 1 - 1.Dify (Atnest) - file Upload to apply in step 2. But the icp_file wait a file, not an ID.

Maybe the response from step 1 bring the file as 64 base, probably

Share the screen with API response from step 1

Hi,

File Upload API call SS

This is what I am getting, once I make the call.
As per DIFY API’s, response coming is right.

Thanks

Hi,

I believe that there is a call type - get file, that you need run before Execute Workflow

In resume:

1 - Post to upload file
2 - Get file using id from response 1st call
3 - Send this file to Execute Workflow

I hope help you
Best,

The issue is that you execute workflow is expecting a file and not a file ID. I guess you are running your own script? you may be able to modify it?

Hi,

Thanks for the response.
I have created the video for the better understand.
Please click here

Thanks

Hi,

Does any one got any solution or any other method should i try.

Please let me know.

From what I remember, there’s two case for 400 error on WF API.
A) You are sending a request where a mandatory parameters is missing. Solution: set this parameter to optional if this is not mandatory. Other solution: switch from manually entered parameters to detect request data. When you are using detect data, there’s no mandatory fields.
B) You have a conditionnal on your workflow that is not met when doing the request. You could set the “Return 200 if condition is not met” if the service that is sending the request really need you to return a 200 everytime.