ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Communication / HTTP functions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Sends a REST request and waits for the server response.
Example
cMaRequete is httpRequest
cMaRequete.URL = "<adresse serveur>"
cMaReponse is httpResponse = cMaRequete.Send()
IF ErrorOccurred THEN
	Error(ErrorInfo(errFullDetails))
ELSE
	Info(cMaReponse.Content)
END
// L'exemple de code ci-dessous montre comment appeler un Webservice REST WINDEV avec paramètres.
// La procédure dans le Webservice est de cette forme :
// PROCEDURE PRIVÉE UpdateBandeauhaut(bModeTest est un booléen)

// L'URL de test est alors de la forme suivante :
// http://<IP du serveur>/<composante commune>
// ?test#/<composante commune>/UpdateBandeauhaut/{bModeTest}|GET

// Code WLangage permettant de l'appeler en passant le paramètre
cMaRequete is httpRequest
cMaRequete.Method = httpGet
cMaRequete.URL = "http://<IP du serveur>/CDM/UpdateBandeauhaut/1" 
//Où CDM est la composante commune et 1 la valeur du paramètre

cMaReponse is httpResponse = cMaRequete.Send()
IF ErrorOccurred THEN
	Error(ErrorInfo(errFullDetails))
ELSE
	IF cMaReponse.Content = True THEN
		Info("Le site a bien été mis à jour.")
	ELSE
		Error(cMaReponse.Content)
	END
END
Syntax

Synchronous syntax: waiting for response Hide the details

<REST response> = <REST request>.Sends()
<REST response>: restResponse variable
Name of the restResponse variable containing the response received from the REST server.
<REST request>: restResponse variable
Name of the restRequest variable that contains the characteristics of the REST request to be sent to the server.
WINDEVWEBDEV - Browser codeAndroidAndroid Widget

Asynchronous syntax Hide the details

<REST request>.Sends(<WLanguage procedure>)
<REST request>: restResponse variable
Name of the restResponse variable containing the response received from the REST server.
<WLanguage procedure>: Procedure name
Name of WLanguage procedure called during the response from the REST server. This procedure has the following format:
PROCEDURE <Procedure name>(<Response> is restResponse)
where <Response> is a restResponse variable containing the response received from the REST server.
Remarks
  • WindowsLinuxAndroidAndroid Widget iPhone/iPadIOS Widget To find out the runtime errors of this function, use ErrorOccurred and ErrorInfo.
  • WEBDEV - Browser code Access to REST APIs from a domain other than the one hosting the site from a browser code (Cross-domain) is blocked by default (Cross-Origin Request Blocked). To allow this access, specific authorizations must be configured on the web server. This topic is covered in the following post on the support blog: https://blogs.pcsoft.fr/fr/autoriser-acces-api-rest-domaine-cors
Business / UI classification: Business Logic
Component: wd300com.dll
Minimum version required
  • Version 26
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/07/2025

Send a report | Local help