I try to upload a file to ninox (https://ninox.com/) a cloud database with a REST-API (docs: https://ninox.com/de/manual/ninox-api/rest-api). Content-Type must be multipart/formdata.
I tried:
Code: Select all
function jobArrived( s : Switch, job : Job )
{
// VIA API TO NINOX DATABASE
var theHTTP = new HTTP( HTTP.SSL );
theHTTP.authScheme = HTTP.OauthAuth;
theHTTP.authorization = "Bearer "+apiKey;
theHTTP.setAttachedFile( job.getPath() );
theHTTP.url = "https://api.ninoxdb.de/v1/teams/asdFGW849643dad/databases/fwa469844dawd/tables/C/records/76/files";
theHTTP.setPostData("Content-Type: multipart/form-data");
theHTTP.post();
while( !theHTTP.waitForFinished( 3 ) )
{
job.log( 1, "API CALL IN PROGRESS!" );
}
if( theHTTP.finishedStatus == HTTP.Ok && theHTTP.statusCode == 200 )
{
job.log(1,"API CALL successfull RESPONSE: "+theHTTP.getServerResponse().toString( "UTF-8" ));
}
else
{
job.log(3,"API CALL Failed: "+theHTTP.getServerResponse().toString( "UTF-8" )+ " Status Code: "+theHTTP.statusCode.toString( "UTF-8" ));
}
// outgoing conn
job.sendToSingle( job.getPath() );
}
Does anybody know how to handle those Multipart/form-data posts? I have no clue.31.03.2020 22:33,Error,,Test Flow,Script Element,00001,sc1.jpg,Error in line 10 of script : No matching slot found_ available overloads are:; void SHTTP::setPostData(Utility8::SByteArray_QString);
It works in postman. But it's easy there.
Kind regards
Ben