PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Properties specific to the description of restRequest variables
  • Notes
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
restRequest (Type of variable)
In French: restRequête
The restRequest type is used to define the advanced characteristics of a REST request. The characteristics of this REST request can be defined and modified by several WLanguage properties.
Note: See Declaring a variable for more details.
Versions 22 and later
Android Widget This type of variable is now available in Android Widget mode.
Android This type of variable is now available for the Android applications.
WEBDEV - Browser code This type of variable is now available in browser code.
New in version 22
Android Widget This type of variable is now available in Android Widget mode.
Android This type of variable is now available for the Android applications.
WEBDEV - Browser code This type of variable is now available in browser code.
Android Widget This type of variable is now available in Android Widget mode.
Android This type of variable is now available for the Android applications.
WEBDEV - Browser code This type of variable is now available in browser code.
Example
cMyRequest is restRequest
cMyRequest..URL = "http://www.windev.com"
cMyResponse is restResponse = RESTSend(cMyRequest)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
Info(cMyResponse..Content)
END
Remarks

Properties specific to the description of restRequest variables

The following properties can be used to handle a REST request:
Property nameType usedEffect
UserAgentCharacter stringIdentifies the client. The default value is "PC SOFT Framework".
The content of the response may depend on the user agent (for example, a request performed from a Mobile device and a request performed from a PC browser may require different pages). In this case, see the documentation of the user agent for more details.
WEBDEV - Browser code Not available.
Versions 22 and later
AuthToken
New in version 22
AuthToken
AuthToken
AuthToken variableToken for accessing a Webservice that will be used in case of authentication via the OAuth 2.0 protocol. This access token was retrieved by AuthIdentify.
WEBDEV - Browser code Not available.
UploadProgresshttpProgress variableNotification of progress status when uploading POST data.
DownloadProgresshttpProgress variableNotification of progress status of download.
ContentTypeCharacter stringType of content of the message to send to the server. This property is taken into account only if the send method (..Method) allows it.
By default, the message type corresponds to: "application/x-www-form-urlencoded".
However, you have the ability to use any value, for example: "text/xml", "application/javascript", "application/json", "application/xml", "image/jpeg", ...
To send rough data that will be read at once by the WEBDEV application server, use the following types:
  • "application/byte-stream".
  • "text/xml".
ContentBufferMessage to send to the server. This property is taken into account only if the send method (..Method) allows it.
The message to send must comply with the HTTP protocol used. By default, if this property is specified and if it is not empty, the method used is a POST request ; otherwise, it is a GET request.
TimeoutIntegerMaximum response time-out (expressed in milliseconds). This property can correspond to:
  • an integer corresponding to the number of milliseconds,
  • a Duration variable,
  • Versions 23 and later
    the direct indication of duration (1 s or 10 ms for example).
    New in version 23
    the direct indication of duration (1 s or 10 ms for example).
    the direct indication of duration (1 s or 10 ms for example).
This property is set to 20 seconds by default.
Note: The time-out defined by HTTPTimeOut has no influence on this property.
WEBDEV - Browser code Not available.
HeaderAssociative array of character stringsKey/Value set of headers to send.
Example for using this property:
cMyRequest..Header["Authorization"] = ...
" WSSE profile=""UsernameToken"""
cMyRequest..Header["X-WSSE"] = ...
"UsernameToken Username=blahblah "
cMyRequest..Header["Cache-Control"] = " no-cache"
IgnoreErrorInteger constantSpecifies the ignored errors. Corresponds to a constant or to a combination of constants:
  • httpIgnoreInvalidCertificate: The certificate is ignored.
  • httpIgnoreInvalidCertificateName: The site name specified in the certificate is ignored.
  • httpIgnoreExpiredCertificate: The certificate date is ignored.
  • Versions 21 and later
    httpIgnoreRedirection: The redirection to a page is ignored.
    New in version 21
    httpIgnoreRedirection: The redirection to a page is ignored.
    httpIgnoreRedirection: The redirection to a page is ignored.
  • httpIgnoreRedirectToHTTP: The redirection to a non-secure server is allowed.
  • httpIgnoreRedirectToHTTPS: The redirection to a secure server is allowed.
Versions 22 and later
AndroidAndroid Widget Only the following errors are supported: httpIgnoreExpiredCertificate, httpIgnoreInvalidCertificate, httpIgnoreInvalidCertificateName, httpIgnoreRevocation, httpIgnoreRedirection.
New in version 22
AndroidAndroid Widget Only the following errors are supported: httpIgnoreExpiredCertificate, httpIgnoreInvalidCertificate, httpIgnoreInvalidCertificateName, httpIgnoreRevocation, httpIgnoreRedirection.
AndroidAndroid Widget Only the following errors are supported: httpIgnoreExpiredCertificate, httpIgnoreInvalidCertificate, httpIgnoreInvalidCertificateName, httpIgnoreRevocation, httpIgnoreRedirection.
WEBDEV - Browser code Not available.
MethodInteger constantHTTP method used:
  • httpCopy: COPY method.
  • httpGet: GET method.
  • httpPatch: PATCH method.
  • httpPost: POST method.
  • httpPut: PUT method.
If ..Content is not empty, the httpPost method is used by default. Otherwise, the httpGet method is used.
PasswordCharacter stringPassword associated with the user name (empty string by default). Used to access a page with a protected URL. Caution: The password is not encrypted when it is sent on Internet.
Note: If ..UserName and ..Password are specified, the corresponding "Authorization:Basic" is automatically generated in the request header.
Versions 21 and later
ConnectionTimeout
New in version 21
ConnectionTimeout
ConnectionTimeout
IntegerMaximum time-out for the connection expressed in milliseconds (20 seconds by default, which means 20000 milliseconds). This property can correspond to:
  • an integer corresponding to the number of milliseconds,
  • a Duration variable,
  • Versions 23 and later
    the direct indication of duration (20 s or 20000 ms for example).
    New in version 23
    the direct indication of duration (20 s or 20000 ms for example).
    the direct indication of duration (20 s or 20000 ms for example).
If the connection was not established after this time-out, the connection failed (RESTSend will return an error, found in the restResponse variable).
WEBDEV - Browser code Not available.
URLCharacter stringAddress of server to contact (URL address).
This URL can contain:
  • the port number for connecting to the server.
    The default value is 80 in HTTP (corresponds to a server of Web pages) and 443 in HTTPS. To specify a port number, use the following format: "<Server URL>:<Port #>". For example: http://www.windev.com:80.
  • additional parameters. These parameters can be used to perform a search or to fill a form. For example, to find "windev" on "http://www.google.com", the URL to contact will be: "http://www.google.com/search?q=windev".
Notes:
  • To specify both the port number and additional parameters, use the following format: "<Server URL>:<Port #>/<Additional Parameters>".
  • To perform a secure transaction, the URL must start with "https://". In this case, the management mode of requests is always performed by Internet Explorer (see HTTPParameter for more details).
UserCharacter stringName used to access a page with a protected URL (empty string by default). This name is used to identify the user.
Note: If ..UserName and ..Password are specified, the corresponding "Authorization:Basic" is automatically generated in the request header.
Versions 22 and later
VersionSSL
New in version 22
VersionSSL
VersionSSL
Integer constantSSL version used:
  • ProtocolDefault: Default protocol (TLS 1.2).
  • ProtocolTLS1: TLS1 protocol.
  • ProtocolTLS1_1: TLS1.1 protocol.
  • ProtocolTLS1_2: TLS1.2 protocol.
WEBDEV - Browser code Not available.


Note: These properties can be used via one of the following syntaxes:
  • <Variable Name>..<Property Name>
  • <Variable Name>.<Property Name>

Notes

  • The management of client certificates is not available.
  • Versions 21 and later
    The redirections are supported by default. To avoid supporting the redirections, use the httpIgnoreRedirection constant in ..IgnoreError.
    New in version 21
    The redirections are supported by default. To avoid supporting the redirections, use the httpIgnoreRedirection constant in ..IgnoreError.
    The redirections are supported by default. To avoid supporting the redirections, use the httpIgnoreRedirection constant in ..IgnoreError.
Minimum required version
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment