La fonction de suggestion automatique permet d'affiner rapidement votre recherche en suggérant des correspondances possibles au fur et à mesure de la frappe.
sept. 20, 20214:06 AM - modifié sept. 20, 20214:20 AM
Participant
How to POST filename to files/v3/files
Résolue
This question is about this endpoint, which unfortunately has no Postman examples to checkout.
I'm struggeling with accessing the POST endpoint (e.g. the "create new file" one). From the documentation, I assume the endpoint should be accessed like this:
However, I always get the response 400 Bad Request:
{
"status": "error",
"message": "Could not determine name from file",
"correlationId": "4ee371ac-d54f-4382-bd7d-aea0bf167e85",
"category": "BAD_REQUEST"
}
So the "fileName" parameter is not correct. I checked other questions on here, and it seems even though the documentation says it's a form part, it might be not? Other questions seem to send this parameter via the header of the "file" for part.
I tried using "Content-Type: text/plain" and "fileName: test.txt" as headers, also "filename: test.txt" and "name: test.txt", but these did not work. So I tried using "Content-Type: text/plain; fileName: test.txt" (also in all variations), and neither did that.
I also tried "Content-Disposition: form-data; name="fieldName"; filename="filename.txt"" which changes the error message:
{
"status": "error",
"message": "file must be specified",
"correlationId": "ca738d9c-64a1-441a-b900-efa2b25388fe",
"context": {
"file": [
"false"
]
},
"category": "VALIDATION_ERROR"
}
Which probably means now the "file" part is no longer valid?
I feel like every question has its own way to defining the file name (but maybe I'm just bad at reading the code), and neither works for me.
What is the correct way to send the file name to this endpoint?
Which has to be added to the "file" form data part. I have no idea if that is possible in the current version of Postman, but for Java's org.springframework.http.client.MultipartBodyBuilder it's done like this:
Which has to be added to the "file" form data part. I have no idea if that is possible in the current version of Postman, but for Java's org.springframework.http.client.MultipartBodyBuilder it's done like this: