API REST : Trying to upload a file
Hi,
I'm looking for the code to upload a file with the REST API.
I'm trying that, but I've a "End-point not foundserveur" response :
curl -H "Authorization: Bearer ??????-???-???-????-???????????" -H "Content-Type: multipart/form-data" -X POST https://api.ninoxdb.de/v1/teams/????????????????/databases/?????????/tables/G/records/6491/3505--61504-ACH.PDF
Do you have an idea ?
Thanks very much.
7 replies
-
@Jérôme
I need to dig into this one myself one of these days. You got the multpart/form-data correct... The error about the end point makes sense to me because you are pointing to and endpoint that does not exist (https://api.ninoxdb.de/v1/teams/????????????????/databases/?????????/tables/G/records/6491/3505--61504-ACH.PDF) ...
What I have yet to figure out is how to tell Ninox to write the file.. I do not have an enpoint that accepts a file to play with.. but I am wondering if setting the body to something like
importFile(this, "https://static.ninoxdb.de/images/logo-ninox-new-2@2x.png")
would work??
-
Thanks Mconneen.
I've found this in the REST API documentation :
Upload File To A Record
With the following request you can upload files to Ninox recordRequest
Content-Type
Content-Type: multipart/form-data
Valid File Names
The name of the file to be uploaded should not contain the following special characters \,/,*,?,>,<,|,"
ResponseA response message saying "File Uploaded Successfully" with Content-Type = text/html and a status code of 200 OK
-
Right... but the documentation does NOT indicate where /how to list the name of the file to be uploaded!
The "GET" works.. but I cannot figure out the syntax of the post.. I keep getting an internal server error.. so something is off.. :(
-
The GET works ? You can upload a file with the GET method ? How do you do that ?
Thanks Mconneen !
-
It's may be to fetch the files ? Doesn't it ?
-
@Jérôme... Sorry for the confusion .. Yes .. your last statement is correct... I can GET / fetch a file using the GET method as defined in the documentation.
The POST returns an internal server error... Most likely because I cannot figure out the proper syntax to reference the file to upload.
In other programming languages.. (Java, Python, C#, etc) ... it is pretty simple to write to the byte stream... Heck.. I was doing that back in 1998/99 and was the primary reason I purchased Jason Hunter's Java Servlet Programming! Which.. by the way I had the pleasure of meeting him at a Java One conference.. :)
-
It was a beautifull meeting !
Content aside
- 5 yrs agoLast active
- 7Replies
- 2373Views