PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD21]HTTP Reqeusts
[WD21]HTTP Reqeusts
Débuté par Ericus, 03 oct. 2017 10:55 - 1 réponse
Posté le 03 octobre 2017 - 10:55
Morning

I am now trying to get HTTPRequest or HTTPForm to work but with no avail. Fabrice I have had a look at your use of HTTPRequest in replication but I am not coming right.

If anybody cares to go to http://api.cyclopsit.com/ you will see that there are 3 calls exposed.

1. List all the agents
2. Get specific agent details
3. Update agent details

1. If you type http://api.cyclopsit.com/1.0/Client/List/1 in a browser you will see that the details for 2 agents are returned.

In Windev I tried this:

asURL is ANSI string = "http://api.CyclopsIT.com/1.0/Client/List/1"
asHeader is ANSI string
sUsResult is UNICODE string
IF NOT HTTPRequest(asURL,"","","","text/xml","","")
Error(ErrorInfo(errFullDetails))
ELSE
asHeader = HTTPGetResult(httpHeader)
END
Info(asHeader)

All that is returned is the OK and details about the server but no details of the 2 agents.

2. If you type in http://api.cyclopsit.com/1.0/Client/Get/1/1 in a browser you will see that the details of one agent is returned.

In Windev I tried it now as follow:

asURL is ANSI string = "http://api.CyclopsIT.com/1.0/Client/Get/"
asHeader is ANSI string
sUsResult is UNICODE string
HTTPCreateForm("Form")
HTTPAddParameter("Form","agentId","1")
HTTPAddParameter("Form","clientId","1")
IF NOT HTTPSendForm("Form",asURL,"","","","text/xml") THEN
Error(ErrorInfo(errFullDetails))
END
asHeader = HTTPGetResult(httpHeader)
HTTPCancelForm("Form")
Info(asHeader)

Once again all I get is an OK with some server details but not usable data.

Can someone please tell me what I am doing wrong.

Thanks in advance


Ericus Steyn
Posté le 09 octobre 2017 - 22:15
Instead of doing the httpHeader in the HTTPGetResult, just do the HTTPGetResult()