DominicProgrammer
IS-IT--Management
Code:
lcUrl = "[URL unfurl="true"]http://192.168.1.100:5000/EsdApi/deononline/signinvoice"[/URL] && local pc IP
loXmlHttp = Createobject("Msxml2.ServerXMLHTTP.6.0")
llNull = loXmlHttp.Open( "POST" , lcUrl, .F. ) &&..open connection
loXmlHttp.setRequestHeader("Content-Type","application/json") && you are sending in JSON
loXmlHttp.setRequestHeader("accept", "application/json") && you are accepting JSON
llNull = loXmlHttp.Send(lcRequest) &&..send request
lcResponse = loXmlHttp.responseText &&..get response
&&&&& now await response from TIMS & pick the details
Strtofile(Alltrim(m.lcResponse), [c:\copy-cat\api\responses\]+lcOutFIle, .T.)
jsonString = loXmlHttp.responseText
TEXT TO json noshow
&& how do i get this jsonstring here as a json text file?
ENDTEXT
** the resulting json file should look like below
*!* {
*!* "statusCode": "0",
*!* "status": "SUCCESS",
*!* "middlewareInvoiceNumber": "13",
*!* "traderSystemInvoiceNumber": "953790",
*!* "controlCode": "0100000000000000013",
*!* "qrCode": "[URL unfurl="true"]https://tims-test.kra.go.ke/KRA-Portal/invoiceChk.htm?actionCode=loadPage&invoiceNo=0100000000000000013",[/URL]
*!* "invoiceType": "Original",
*!* "serialNo": "",
*!* "totalTaxAmount": "13.79",
*!* "totalTaxableAmount": "86.20",
*!* "totalInvoiceAmount": "99.99"
*!* }
Hi Programmers.
I have the above code and i would like to have the "jsonString" converted to json so that i can now serialise it to a cursor, the jsonString is actually a response from a an API post. How can i do this.. your help will be highly appreciated. Thanks in advance
Dominic.