I'm using Microfocus UFT/QTP to automate a WPF app. I'm new to UFT and VBS. I need to call a REST API (GET) and parse the json response. It's a simple API with basic authentication and one parameter in the request but i can't get this to work. Please look into the code below and let me know what i'm doing wrong. I'm specifically getting "Error 415 Unsupported media type". Thanks!
Rough code below:
userName = "xyz@abc.com"
password = "Test123"
strJSONToSend = "{""accountNumber"": ""0132104201""}"
URL="https://blah-xyzucc.integration.ocp.blah.com:999/ic/api/integration/v1/flows/rest/blah_CUSTX_INTERN_blah_ACCNTSEARCH/1.0/accountSearch"
Set objXmlHttpMain = CreateObject("Msxml2.ServerXMLHTTP")
objXmlHttpMain.open "GET",URL, False, userName, password
objXmlHttpMain.setRequestHeader "charset","UTF-8"
objXmlHttpMain.setRequestHeader "Accept", "application/json"
objXmlHttpMain.send(strJSONToSend)
objXmlHttpMain.responseText