>>John, you need to compose the JSON data and post it.
>>LOCAL loXMLHTTP as "MSXML2.XMLHTTP"
>>loXmlHttp = CREATEOBJECT("MSXML2.XMLHTTP")
>>loXmlHttp.open("POST", cdom, .F., cUser, cPassw)
>
>>TEXT TO JSONData NOSHOW
>>{ "username": "
hbelalcazar@xsoftware.com.co",
>> "password": "abcfghz$",
>> "client": "companyx"
>>}
>>ENDTEXT
>
>>loXmlHttp.send(m.JSONData)
>>Of course, not only this does not pretend to be real production code, but also you should use a JSON library (besides Rick's, you can also check Marco Plaza's nfJson at VFPX) to write and read the webapi data.
>
>Thank you Antonio and also Mike and Rick, I received some additional help from the provider of the webapi and the final code that worked for me is this:
>
>
>LOCAL loXMLHTTP as "MSXML2.XMLHTTP", lAsync as Boolean, JSONCred as String
>loXmlHttp = CREATEOBJECT("MSXML2.XMLHTTP")
>lAsync=.T.
>cUser="hbelalcazar@xsoftware.com.co"
>cPass="abcfghz$"
>cdom="https://xxxtapi.awswebsites.net/api/Internal_list"
>JSONCredentials = '{ "username": "hbelalcazar@xsoftware.com.co", "password": abcfghz$", "client": "companyx" }'
>
>loXmlHttp.open("POST", cdom, lAsync)
>loXmlHttp.setRequestHeader("Content-type:", "application/json")
>loXmlHttp.setRequestHeader("Accept:", "application/json")
>loXmlHttp.send(JSONCredentials)
>
Good.
A final note. An asynchronous call requires specific control of the status of the response, that is, the .send() method may return without a response from the API being available.
----------------------------------
António Tavares Lopes