Web Connection
Include an API Key in my https request
I need to access a REST API from foxpro. Here are the instructions I have been given: The endpoint to retrieve the data is https://interfaceapi.cpso.com:PortNumberHere/cfs/roster
There is an Api Key that you need to include in your https request. Key: NameOfACompany Value: Wmj...................6uN
I have done this using postman. Takes about 1 minute. You put in the url and go to headers tab and put in the key and the value. You select GET as the verb and click Send. Works perfectly.
I have foxpro code that uses wwhttp and looks like this:
DO wwhttp
DO wwJsonSerializer
loHttp = CREATEOBJECT("wwHttp")
loSer = CREATEOBJECT("wwJsonSerializer")
lcurl="https://interfaceapi.cpso.com:<some com port number here>/cfs/roster"
lcJson = loHttp.Get(lcurl)
My question: Exactly what foxpro code needs to be added to the above code, that will add the key and value to the header of my request?
Thank You, John