Bad Request 400 POST API requet. Empty body response.
I am using fetch calling
with the body
{
file: (tried base64 and also a buffer file),
public_id: 'images/abc',
signature: generated
api_key: <redacted>
timestamp: timestamp
}
I suspect the issue is with the file data?
If I do the same request via postman but use Postman's file upload button, the request works. Via my own program it does not.
The issue is, I do not get an error to act upon. The body is empty, the headers are empty.
My response is:
```
{
"body":{},
"bodyUsed":false,
"headers":{},
"encodeBody":"auto",
"redirected":false,
"ok":false,
"statusText":"Bad Request",
"status":400
}
```
I cannot find any error logs either. 11th Feb, 12th Feb, 14th Feb are probably my most common requests. I read about 400 errors being cached, maybe I fixed it once but got a cached response?
Thanks for any replies and help will be greatly appreciated!
PS: the reason I'm not using the SDK is that I couldnt see clear support / docs for ESM type imports only require and when I tried import cloudinary from "cloudinary" and used the SDK it didn't seem to work either. Cheers.
0
-
Hi Aaron,
Looking at the logs, it seems that the body isn't included in the request.
You can refer here, for an example of sending a direct call to the rest API:
If you would like to provide your full upload request we will gladly further take a look.
Regards,
Michal
0
Post is closed for comments.
Comments
1 comment