HTTP POST or PUT request to upload file(s) on server.
[result, status] = http_upload(url, filename, variablename) [result, status] = http_upload(url, filename, variablename, data) [result, status] = http_upload(url, filename, variablename, data, <opt_args>)
A string containing the server address following by the optional port, the route of the request and query datas. syntax: "address:port/route?queryfield=querydata"
A string or a matrix of string which contains file(s) to upload on server.
A string which contains the file variable name expected by the server. This value must be given by the documentation of the API you are using.
This argument represent data sent by the request. Can be a scilab variable which will be converted into JSON format if possible or sent as a string.
This represents a sequence of statements
key1=value1, key2=value2, ...where
key2, ... can be one of the following:
This option determines whether Scilab verifies the authenticity of the peer's certificate. If
noneis given, no verification is performed.Disabling verification of the certificate allows bad guys to man-in-the-middle the communication without you knowing it. Disabling verification makes the communication insecure. Just having encryption on a transfer is not enough as you cannot be sure that you are communicating with the correct end-point.
followis false. Set
follow=%tto follow eventual redirections.
Username and password can be specified for the websites which required authentication.
The syntax is
This option displays information in the Scilab console to diagnose potential network issues. It is disabled by default, set
verbose=%tto display the in-progress log.
By default, this function send request a POST request. Using this argument it is possible to use a PUT request, by passing method="PUT".
Result is a string which contain the server answer or a scilab variable if the answer is in JSON format.
HTTP response code.
This function will perform an HTTP POST or PUT request to upload file(s).
The proxy configuration is used if it's enabled in the Preferences under the rubric "Internet".
f1 = "myfilename"; res = http_upload("url:port/route", f1, "varname"); res = http_upload("url:port/route", f1, "varname", method="PUT"); f2 = "myfilenametwo"; res = http_upload("url:port/route", [f1 f2], "varname"); data.type = "images" data.date = date(); res = http_upload("url:port/route", [f1 f2], data, "varname");
- http_get — HTTP GET request.
- http_put — HTTP PUT request.
- http_patch — HTTP PATCH request.
- http_delete — HTTP DELETE request.
- http_upload — HTTP POST or PUT request to upload file(s) on server.
- toJSON — Convert scilab variable to JSON.
- fromJSON — Convert JSON to scilab variable.
|Report an issue|
|<< http_put||Web Tools||toJSON >>|