PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
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
Sends a REST request and waits for the server response.
Example
cMaRequete is httpRequest
cMaRequete.URL = "<adresse serveur>"
cMaReponse is httpResponse = RESTSend(cMaRequete)
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
 
// 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 = RESTSend(cMaRequete)
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

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 Variable of type restRequest containing the characteristics of the REST request to send 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 (with quotes)
URL to interrogate.
Remarks
Business / UI classification: Business Logic
Component: wd260com.dll
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 RestSend
PROPAGANDA DA AULA PRIVADA RESTSEND
https://youtu.be/933LvEUWFIA
AULA PRIVADA COMPLETA RESTSEND SOMENTE PARA COLABORADORES GRUPO PRIVADO
https://youtu.be/LfOcn4tyBww
https://windevdesenvolvimento.blogspot.com/2019/02/dicas-2024-windev-mobile-webservice-020.html

// BTN_ADICIONA_httpPost
solicitacao_http is restRequest
solicitacao_http..URL="http://nots-amarildo/empresa"
solicitacao_http..Method=httpPost
solicitacao_http..ContentType="application/json"
solicitacao_http..Content=[
{
"razao_social"
:
"NOVO0645"
}
]
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 RestSend


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 RestSend
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