Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.0.0 - Русский


http_put

HTTP PUT request.

Syntax

[result, status] = http_put(url)
[result, status] = http_put(url, data)
[result, status] = http_put(url, data, <opt_args>)

Arguments

url

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"

data

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.

<opt_args>

This represents a sequence of statements key1=value1, key2=value2, ... where key1, key2, ... can be one of the following:

headers

Strings defined as "name: value".

cookies

Strings defined as "name=value". This parameter is used to send custom cookies regardless of cookie preferences. Those cookies are sent in addition to stored cookies.

cert

This option determines whether Scilab verifies the authenticity of the peer's certificate. If none is 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.

follow

By default, follow is false. Set follow=%t to follow eventual redirections.

auth

Username and password can be specified for the websites which required authentication.

The syntax is auth="username:password"

verbose

This option displays information in the Scilab console to diagnose potential network issues. It is disabled by default, set verbose=%t to display the in-progress log.

format

This option determines the format of data sent. Only the JSON format is supported. Value can be "json" or "JSON".

result

Result is a string which contain the server answer or a scilab variable if the answer is in JSON format.

status

HTTP response code.

Description

This function will perform an HTTP PUT request.

The proxy configuration is used if it's enabled in the Preferences under the rubric "Web".

The cookies configuration under the "Web" rubric is used.

Disabled

No cookies are used and store.

Normal

Cookies are used and store. They are keeped between Scilab sessions. They are stored in SCIHOME/cookies.txt.

Private

Cookies are used and store. They are deleted at Scilab close. They are stored in TMPDIR/cookies.txt.

Examples

data.userId = 12;
data.title  = "A title";
data.body   = "A body";
data.id = 1;
result = http_put("https://jsonplaceholder.typicode.com/posts/1", data)

// set specific headers
result = http_get("https://jsonplaceholder.typicode.com/posts/1", headers=["myheader: user_header", "token: sdfrufhfDF42"], verbose=%t)

See also

History

ВерсияОписание
6.1 Function introduced.
Report an issue
<< http_post Web Tools http_upload >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Oct 24 14:37:13 CEST 2023