PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Sends a REST request and waits for the server response.
Versions 22 and later
WEBDEV - Browser code This function is now available in browser code.
New in version 22
WEBDEV - Browser code This function is now available in browser code.
WEBDEV - Browser code This function is now available in browser code.
Example
cMyRequest is restRequest
cMyRequest.URL = "<server address>"
cMyResponse is restResponse = RESTSend(cMyRequest)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
Info(cMyResponse.Content)
END
// The code sample below explains how to call a WINDEV REST Webservice with parameters.
// The procedure found in the Webservice has the following format:
// PRIVATE PROCEDURE UpdateTopBar(bTestMode is boolean)
 
// The test URL has the following format:
// http://<Server IP>/<Common component>
//?test
 
// WLanguage code used to call it by passing the parameter
cMyRequest is restRequest
cMyRequest.Method = httpGet
cMyRequest.URL = "http://<Server IP>/CDM/UpdateTopBar/1"
//Where CDM is the common component and 1 the parameter value
 
cMyResponse is restResponse = RESTSend(cMyRequest)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
IF cMyResponse.Content = True THEN
Info("The site was updated.")
ELSE
Error(cMyResponse.Content)
END
END
Syntax

Syntax that is using a restRequest variable Hide the details

<REST response> = RESTSend(<REST request>)
<REST response>: restResponse variable
Name of 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.

Simplified syntax for sending a request Hide the details

<REST response> = RESTSend(<URL>)
<REST response>: restResponse variable
Name of restResponse variable containing the response received from the REST server.
<URL>: Character string
URL to interrogate.
Versions 22 and later
WEBDEV - Browser code Available in WINDEV, Android and iPhone from version 26 onwards

Asynchronous syntax that is using a restRequest variable Hide the details

RESTSend(<HTTP request> , <WLanguage procedure>)
<HTTP request>: httpRequest variable
Name of the restRequest variable that contains the characteristics of the REST request to be sent to the 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.
New in version 22
WEBDEV - Browser code Available in WINDEV, Android and iPhone from version 26 onwards

Asynchronous syntax that is using a restRequest variable Hide the details

RESTSend(<HTTP request> , <WLanguage procedure>)
<HTTP request>: httpRequest variable
Name of the restRequest variable that contains the characteristics of the REST request to be sent to the 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.
WEBDEV - Browser code Available in WINDEV, Android and iPhone from version 26 onwards

Asynchronous syntax that is using a restRequest variable Hide the details

RESTSend(<HTTP request> , <WLanguage procedure>)
<HTTP request>: httpRequest variable
Name of the restRequest variable that contains the characteristics of the REST request to be sent to the 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.
Versions 22 and later
WEBDEV - Browser code Available in WINDEV, Android and iPhone from version 26 onwards

Simplified asynchronous syntax for sending a request Hide the details

RESTSend(<URL> , <WLanguage procedure>)
<URL>: Character string
URL to interrogate.
<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.
New in version 22
WEBDEV - Browser code Available in WINDEV, Android and iPhone from version 26 onwards

Simplified asynchronous syntax for sending a request Hide the details

RESTSend(<URL> , <WLanguage procedure>)
<URL>: Character string
URL to interrogate.
<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.
WEBDEV - Browser code Available in WINDEV, Android and iPhone from version 26 onwards

Simplified asynchronous syntax for sending a request Hide the details

RESTSend(<URL> , <WLanguage procedure>)
<URL>: Character string
URL to interrogate.
<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
  • WindowsLinux 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 avoid being blocked, 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: wd270com.dll
Minimum version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment