Welcome! Log In Create A New Profile

Advanced

rest webservice post question

Posted by Allard 
rest webservice post question
December 19, 2021 08:51PM
Hi

I created a get and a post and having issues with post

First
The get works great just
url with 2 params ==> url/name/emailadres

It runs some logic and returns what I need

The problem
The POST

If I test it inthe test page that is generated it works

if I try to caal ifrom windev is says 404 not found

My code :

x is string
httpReq is httpRequest
httpReq.URL = "[wdsoft.nl];
httpReq..ContentType = "application/json"
Juser is JSON
Juser.EmailAdres = EDT_EmailAdres
Juser.voornaam = EDT_Voornaam
Juser.achternaam = EDT_Achternaam
x= StringToJSON(Juser)
httpReq..Content = StringToJSON(Juser)
httpReq.Method = httpPost

httpResp is httpResponse = HTTPSend(httpReq)

IF httpResp.StatusCode ="200" THEN
Info(httpResp.Content)
ELSE

END
Re: rest webservice post question
December 26, 2021 02:31PM
Hello Allard,

yes, this problem I had too, but I remembered the httpRequest, there you need to add

HTTPRequest(gsServer+"error_log.php?delete","","",sPost,"application/x-www-form-urlencoded")

so similar you need to add "application/x-www-form-urlencoded" as content type instead of application/json...

Did you try to test the API with postman?? what did the results say??

Second, we had a Windows 10 problem in december, with update KB5008212... You need to add this link:

[download.microsoft.com]

then it works...

btw. I use actually the Variant variable instead of the JSON variable and VariantToJson (which makes a string not a JSON type)... I don't know if it makes a difference?!
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: