ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / HTTP functions
  • Properties specific to restRequest variables
  • Managing redirections
  • HTTP cookies
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The restRequest type is used to define the advanced characteristics of a REST request. You can define and change the characteristics of the REST request using different WLanguage properties.
Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
cMyRequest is httpRequest
cMyRequest.URL = "http://www.windev.com"
cMyResponse is httpResponse = RESTSend(cMyRequest)
IF ErrorOccurred THEN
	Error(ErrorInfo(errFullDetails))
ELSE
	Info(cMyResponse.Content)
END
Properties

Properties specific to restRequest variables

The following properties can be used to handle a REST request:
Property nameType usedEffect
AuthenticationInteger constantDefines the authentication method required to access resources in a given server or website:
  • auBasic: The name and password are passed as plain text in the request.
  • auDigest: The name and password are hashed in the request.
  • auNegotiate: The client and server exchange a certain amount of information before establishing a connection. Kerberos is the default authentication protocol. If it is not available, the NTLM protocol is used.
  • auNTLM: The client and server exchange a certain amount of information before establishing a connection via the NTLM protocol (Windows only).
Note: Although still widely used, the NTLM protocol is no longer recommended.
AuthTokenAuthToken variableToken for accessing a web service to be used for OAuth 2.0 authentication. This access token is returned by AuthIdentify.
The access token is automatically passed to the access_token parameter in the URL. If this parameter must be different, you need to build the http URL.
WEBDEV - Browser code Not available.
ClientCertificateString or bufferCorresponds to:
  • a character string with an access path to the .p12 file that contains the certificate to attach to the request. The certificate will be automatically loaded taking into account:
    • the certificate in the executable library (if it has been integrated into the application),
    • the certificate at the specified location on disk (if the certificate has not been integrated into the executable library).
  • a buffer with the certificate (fLoadBuffer).
If this property is set to an empty string (""), the default certificate is reset to "<None>".
ClientCertificatePasswordCharacter string or Secret stringPassword associated with the client certificate (empty string by default).
New in version 2025
Secret strings: If you use the secret string vault, the type of secret string used for this parameter must be "ANSI string - Latin".
To learn more about secret strings and how to use the vault, see Secret string vault.
ConnectionTimeoutIntegerMaximum timeout for the connection expressed in milliseconds (20 seconds by default, i.e. 20000 milliseconds). This property can correspond to:
  • an integer representing the number of milliseconds,
  • a Duration variable,
  • the duration in a readable format (e.g., '20s' or '20000ms').
The connection fails if it cannot be established after this timeout (RESTSend will return an error, in the restResponse result variable).
WEBDEV - Browser code Not available.
ContentBufferHTTP message to be send to the server. This property is taken into account only if the sending method (Method property) allows it.
The message to be sent must comply with the HTTP protocol used. By default, if this property is specified, a POST request is used; otherwise, the GET method is used.
ContentTypeCharacter stringType of the HTTP message content to be sent to the server. This property is taken into account only if the sending method (Method property) allows it.
By default, the message type corresponds to "application/x-www-form-urlencoded".
However, you can use any value, for example: "text/xml", "application/javascript", "application/json", "application/xml", "image/jpeg", etc.
To send raw data, which will be read in a single operation by the WEBDEV Application Server, use the following types:
  • "application/octet-stream".
  • "text/xml".
DestinationCharacter stringFull path of the backup file of the HTTP request result.
WEBDEV - Browser code Not available.
DownloadProgresshttpProgress variableData reception progress notification.
HeaderAssociative array of stringsKey/Value set of headers to send.
Usage example of this property:
cMyRequest is httpRequest

cMyRequest.Header["Authorization"] = ...
	" WSSE profile=""UsernameToken"""
cMyRequest.Header["X-WSSE"] = ...
	"UsernameToken Username=blahblah "
cMyRequest.Header["Cache-Control"] = " no-cache"
Behavior changes from version 29 Update 3:
  • Before version 29 Update 3, empty headers were not sent.
  • Starting with version 29 Update 3, empty headers are sent. Example:
    req is httpRequest
    req.Header["Empty"] = ""
    req.Send()
    Now the "Empty" header is passed to the server when the request is sent, and its value is an empty string.
IgnoreErrorInteger constantSpecifies the ignored errors. Corresponds to a constant or combination of constants:
  • httpIgnoreInvalidCertificate: The certificate is ignored.
  • httpIgnoreInvalidCertificateName: The site name specified in the certificate is ignored.
  • httpIgnoreExpiredCertificate: The certificate date is ignored.
  • httpIgnoreDeprecated: Ignores errors related to the use of deprecated algorithms (e.g. SHA-1 certificate signature).
  • httpIgnoreRedirection: Redirection to a page is ignored.
  • httpIgnoreRedirectToHTTP: Redirection to a non-secure server is allowed.
  • httpIgnoreRedirectToHTTPS: Redirection to a secure server is allowed.
  • httpIgnoreUnsafeRenegotiation: Ignores the error indicating that the server does not support secure renegotiation (RFC 5746).
  • httpIgnoreRevocation: The revoked certificate list verification is ignored.
AndroidAndroid Widget Only the following errors are handled: httpIgnoreExpiredCertificate, httpIgnoreInvalidCertificate, httpIgnoreInvalidCertificateName, httpIgnoreRevocation, httpIgnoreRedirection.
WEBDEV - Browser code Not available.
MaxDownloadRateIntegerMaximum data download speed in kilobytes per second. This speed is given for information only.
0 (default value) means that this speed is not limited.
WEBDEV - Browser code Not available.
WEBDEV - Browser code Not available.
MaxUploadRateIntegerMaximum data upload speed in kilobytes per second. This speed is given for information only.
0 (default value) means that this speed is not limited.
WEBDEV - Browser code Not available.
MethodInteger constantHTTP method used:
  • httpCopy: COPY method (value 7).
  • httpDelete: DELETE method (value 4).
  • httpGet: GET method (value 1).
  • httpHead: HEAD method (value 5).
  • httpLock: LOCK method (value 12) (WebDAV protocol).
  • httpMkCol: MKCOL method (value 10) (WebDAV protocol).
  • httpMove: MOVE method (value 11) (WebDAV protocol).
  • httpPatch: PATCH method (value 6).
  • httpPost: POST method (value 2).
  • httpPropFind: PROPFIND method (value 8) (WebDAV protocol).
  • httpPropPatch: PROPPATCH method (value 9) (WebDAV protocol).
  • httpPut: PUT method (value 3).
  • httpUnlock: UNLOCK method (value 13) (WebDAV protocol).
If the Content property is not empty, the httpPost method is used by default. Otherwise, the httpGet method is used.
PasswordCharacter string or Secret stringPassword associated with the username (empty string by default). Used to access a page with a protected URL. Caution: The password is not encrypted when it is sent over the Internet.
Note: If the UserName and Password properties are specified, the corresponding "Authorization:Basic" header is automatically generated in the request header.
New in version 2025
Secret strings: If you use the secret string vault, the type of secret string used for this parameter must be "ANSI or Unicode string".
To learn more about secret strings and how to use the vault, see Secret string vault.
New in SaaS
ProcedureData
ProcedureName of the WLanguage procedure called as data is received.
This procedure can be used to progressively retrieve an HTTP response, e.g., when the server returns a chunked or a large response
This procedure has the following format:
PROCEDURE <Procedure name>(<Chunk> is Buffer)
where <Chunk> corresponds to the retrieved data.
If this procedure returns False, the request is cancelled as well as the data reception.
Procedure example:
PROCEDURE procData(bufChunk is Buffer)
Trace("Processing [%Size(bufChunk)%] bytes of data")
Trace(UTF8ToString(bufChunk))
Trace("----------------------")
WEBDEV - Browser codeAndroidAndroid Widget Not available.
Note: This feature is only available from WINDEV Suite SaaS 2025 - Update 3.
For more details, see Using new features exclusive to WINDEV Suite SaaS 2025.
New in SaaS
ProcedureHeader
ProcedureName of the WLanguage procedure to be called only if the request is successful (HTTP response code between 200 and 299). This procedure can be used when the server returns a chunked or a large response.
This procedure has the following format:
PROCEDURE <Procedure name>(<Response> is httpResponse)
where <Response> corresponds to the advanced characteristics of the response.
Procedure example:
PROCEDURE procHeader(cMyHeader is httpResponse)
Trace("ProcedureHeader")
IF 200 <= cMyHeader.StatusCode _AND_ 
	cMyHeader.StatusCode <= 299 THEN
	Trace("OK")
ELSE
	Trace("Error")
END
Trace(cMyHeader.RawHeader)
Trace("----------------------")
Note: Redirect headers do not trigger the procedure.
WEBDEV - Browser codeAndroidAndroid Widget Not available.
Note: This feature is only available from WINDEV Suite SaaS 2025 - Update 3.
For more details, see Using new features exclusive to WINDEV Suite SaaS 2025.
ProcedureTraceProcedureName of the WLanguage procedure used to identify the data and headers that have been sent and received. This procedure has the following format:
PROCEDURE <Procedure name>(<InfoType> is int,
<Data> is Buffer)
where:
  • <InfoType> is an integer constant that corresponds to the type of data being traced:
    • httpTraceDataSent: Data sent.
    • httpTraceDataReceived: Data received..
    • httpTraceHeaderSent: Header sent.
    • httpTraceHeaderReceived: Header received.
    • httpTraceInfo: Detailed information about the execution of the request (low-level cURL/OpenSSL error, step in progress, warnings, etc.).
  • <Data> is a buffer that contains the information.
Procedure example:
PROCEDURE ProcTrace(nTypeInfo is int, ...
		bufByData is Buffer)
	SWITCH nTypeInfo
		CASE httpTraceHeaderSent:
			Trace("Entête : ", ...
				UTF8ToString(bufByData))
		CASE httpTraceDataSent:
			Trace("Données : ", ...
					bufByData)
		CASE httpTraceHeaderReceived:
			Trace("Entête reçu : ", ...
				UTF8ToString(bufByData))
		CASE httpTraceDataReceived:
			Trace("Données reçues : ", ...
					bufByData)
	END
WEBDEV - Browser code Not available.
WEBDEV - Browser code ResponseRawContent
BooleanIndicates whether the Content property corresponds to the raw content:
  • True: The Content property corresponds to a buffer. No changes are made.
  • False (default): The content is modified by the browser. In particular, UTF-8 text is automatically decoded. The Content property returns the result as a string.
SelectedCipherCharacter stringName of the cipher selected for the secure request.
This property is available in read-only mode.
SelectedSSLVersionInteger constantSSL version chosen for a secure request:
  • ProtocolDefault: Default protocol (TLS 1.2).
  • ProtocolTLS1: TLS1 protocol.
  • ProtocolTLS1_1: TLS1.1 protocol.
  • ProtocolTLS1_2: TLS1.2 protocol.
  • ProtocolTLS1_3: TLS1.3 protocol.
WEBDEV - Browser code Not available.
This property is available in read-only mode.
TimeoutIntegerMaximum response timeout (in milliseconds). This property can correspond to:
  • an integer representing the number of milliseconds,
  • a Duration variable,
  • the duration in a readable format (e.g., '1s' or '10ms').
This property is set to 20 seconds by default.
Note: The timeout defined with HTTPTimeOut has no influence on this property.
WEBDEV - Browser code Not available.
UploadProgresshttpProgress variableNotification of the progress status when uploading POST data.
URLCharacter stringAddress of the server to which the request is to be sent (URL address).
This URL can contain:
  • the port number for connecting to the server.
    By default, HTTP servers hosting web pages use port 80, whereas HTTPS servers use port 443. To specify a port number, use the following format: "<Server URL>:<Port number>". For example: "http://www.windev.com:80".
  • additional parameters. These parameters can be used to perform a search or fill a form. For example, here is the URL to search for "windev" on "http://www.google.com": "http://www.google.com/search?q=windev".
Remarks:
  • To specify both the port number and additional parameters, use the following format: "<Server URL>:<Port number>/<Additional parameters>".
  • For a secure transaction, the URL must start with "https://". In this case, requests are always handled by Internet Explorer (for more details, see HTTPConfigure).
UserCharacter stringName used to access a page with a protected URL (empty string by default). This name identifies the user.
Note: If the User and Password properties are specified, the corresponding "Authorization:Basic" header is automatically generated in the request header.
UserAgentCharacter stringIdentifies the client. By default, this value corresponds to the application name.
The content of the response depends on the user agent (for example, a request from a PalmPilot requires different pages than a request sent from a browser). For more details, see the user agent documentation.
WEBDEV - Browser code Not available.
VersionHTTPInteger constantHTTP version used by the server:
  • httpVersion2: HTTP 2.0. If the server does not support this version, an older version is used.
  • httpVersion2Only: Forces HTTP 2.0. If the server does not support this version, a fatal error is displayed.
  • httpVersion1_1: HTTP 1.1.
  • httpVersion1_0: HTTP 1.0.
  • httpVersionDefault: HTTP 1.0.
VersionSSLInteger constantMinimum and maximum SSL version supported.
To set the minimum and maximum TLS versions to 1.1 and 1.3, simply specify the ProtocolTLS1_1 + ProtocolTLS1_3 constants
The following constants can be used:
  • ProtocolDefault: Default protocol. Maximum version supported (or a lower version if the server does not support this protocol).
  • ProtocolTLS1: TLS1 protocol.
  • ProtocolTLS1_1: TLS1.1 protocol.
  • ProtocolTLS1_2: TLS1.2 protocol.
  • ProtocolTLS1_3: TLS1.3 protocol.
WEBDEV - Browser code Not available.
Remarks

Managing redirections

Redirections are supported by default. To ignore redirections, use the httpIgnoreRedirection constant in the IgnoreError property.
WINDEVWEBDEV - Server codeAndroidAndroid Widget iPhone/iPadAjax

HTTP cookies

Cookies received in response to a call to RESTSend are stored while waiting for a subsequent call to RESTSend on the same domain. In this case, the restRequest variable is updated.
For more details, see HTTPCookieManage.
Minimum version required
  • Version 20
This page is also available for…
Comments
Video httpput
PROPAGANDA AULA 2025 RESTREQUEST
https://youtu.be/cJZm-WrAPgM
AULA COMPLETA 2025 RESREQUEST
https://youtu.be/d3zULOtHQjs
https://windevdesenvolvimento.blogspot.com/2019/02/dicas-2025-windev-mobile-webservice-021_23.html
// BTN_ALTERA_httpPut
solicitacao_http is restRequest
URL is string="http://nots-amarildo/empresa/{nEmpresaId}"
URL = Replace(URL,"{nEmpresaId}","2")
solicitacao_http..URL=URL
solicitacao_http..ContentType="application/json"
solicitacao_http..Method=httpPut
solicitacao_http..Content=[
{
"razao_social"
:
"ALTERADO1205"
}
]
resposta_http is restResponse = RESTSend(solicitacao_http)
EDT_RETORNO=resposta_http..Content
amarildo
23 Feb. 2019
Video RestREquest


https://youtu.be/G7oY3hd7Jo0

https://windevdesenvolvimento.blogspot.com/2019/02/dicas-2023-windev-mobile-webservice-019.html

solicitacao_http is restRequest
sUrl is string="http://localhost/empresa/{nEmpresaid}"
sUrl=Replace(sUrl,"{nEmpresaid}","2")
solicitacao_http..URL=sUrl
solicitacao_http..Method=httpGet
resposta_http is restResponse = RESTSend(solicitacao_http)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
EDT_RETORNO=resposta_http..Content
END

amarildo
22 Feb. 2019
Video Restquest
https://youtu.be/VvMa-5kUZkQ

https://windevdesenvolvimento.blogspot.com/2019/02/dicas-2022-windev-mobile-webservice-018.html

solicitacao_http is restRequest
solicitacao_http..URL="http://nots-amarildo/empresa"
solicitacao_http..Method=httpGet
resposta_http is restResponse = RESTSend(solicitacao_http)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
EDT_RETORNO=resposta_http..Content
END
amarildo
20 Feb. 2019

Last update: 06/16/2025

Send a report | Local help