Dear Team,
I need to POST JSON (encrypted data in a string format) data to an API - https://XXX/XXX/ (cannot share the link due to confidentiality issue).
Somehow I found the below link which is very similar to my requirement. So I had tried to run the macro from below mentioned link and tried to capture the response:
https://www.mrexcel.com/board/thread...o-api.1135571/
Dim objHTTP As Object
Dim Json As String
Json = Range("A30")
Dim result As String
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
Url = "https://webservices.net/example"
objHTTP.Open "POST", Url, False
objHTTP.setRequestHeader "Content-type", "application/json"
objHTTP.setRequestHeader "apikey", ""
objHTTP.send (Json)
result = objHTTP.responseText
'Some simple debugging
Range("B30").Value = result
Set objHTTP = Nothing
Challenge is when I run this code then I receive the below response:
{"timestamp":"2022-49-15","status":500,"error":"Internal Server Error","message":"","path":"/XXX/XXXX"}
I had contacted the Website technical team but there response was "Its an API (not a web application). Please consume it using any rest client or through an application and share the response you are getting from our API."
So just want to know is there any change I need to do in a code to POST the JSON data on the REST API through VBA or is it not feasible and we have to use any 3rd party software to do so?
Any help will be appreciated a lot.
Thanks,
Bookmarks