PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → How to POST the data from HTTPREQUEST
How to POST the data from HTTPREQUEST
Iniciado por guest, 21,oct. 2015 11:26 - 1 respuesta
Publicado el 21,octubre 2015 - 11:26
Hi All,

Good day.
Below is the HttpRequest that I run in my application and its working fine. I displays the information.
But I need your help on how to post the data from the generate httprequest.
Example assetnumber,serialnumber,model, I need to display it in each text box?

{"id":1,"type":"Asset","assetNumber":"1","contractExpiration":null,"macAddress":null,"networkAddress":null,"networkName":null,"notes":"test","purchaseDate":null,"serialNumber":"123123","version":null,"assetstatus":{"id":1,"type":"AssetStatus"},"billingRate":null,"location":{"id":1,"type":"Location","address":null,"city":null,"locationName":"Sample Location ","postalCode":null,"state":null,"defaultPriorityTypeId":null},"model":{"id":1,"type":"Model","assetTypeId":1,"manufacturerId":1,"modelId":1,"modelName":"Model Name","warrantyTypeId":1,"assettype":{"id":1,"type":"AssetType","assetType":"Sample Type"},"manufacturer":{"id":1,"type":"Manufacturer","address":null,"city":null,"country":null,"fax":null,"fullName":"Sample Manufacturer","manufacturerId":1,"name":"Sample","phone":null,"postalCode":null,"state":null,"url":null}},"warrantyType":{"id":1,"type":"WarrantyType"},"clients":[],"isSynchronizationDisabled":false,"isReservable":false,"leaseExpirationDate":null,"warrantyExpirationDate":null,"isNotesVisibleToClients":false,"isDeleted":false,"assetCustomFields":[]}

sResstart is string
sResstart1 is string
sResstart = HTTPRequest("http://localhost:8081/helpdesk/WebObjects/Helpdesk.woa/ra/Assets/1…")
IF sResstart = True THEN
ResCode is string = HTTPGetResult()
EDT_NoName1=ResCode
END

Regards,
Alvin
Publicado el 23,octubre 2015 - 16:52
I try:

// sample code of how to POST to Add a json record, must need wx20 or above
myRequest is restRequest
myResponse is restResponse
myRequest.url = "http://localhost:8081/helpdesk/WebObjects/Helpdesk.woa/ra/Assets/1…"

myRequest = httpPost
// just part of json sample, make it yourself right as a complete json
myRequest.content=[
{"id":2,
"type":"Asset",
"assetNumber":"1",
"contractExpiration":"Oct 23,20154"
}
]

myResponse = RESTSend(myRequest)

IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
Info(myResponse.Content)
END


Pls let me know if it works or not as I only have wm20 and if so,
pls post some sample codes for modify and delete also.

Have fun!

Cheers

King