I have a macro system in Excel that does other update tasks for internal records, and I want to (at the end of the process) send out a LimeSurvey to the recipient of the update. I want to use VBA to obtain a token from Lime and then use this to generate an email from within VBA containing the unique link.
I cant get the API to return the session_key despite trying everything I cant get anything to return. This is the current version of code I am using. I dont get any errors, receive the status code = 200 but the response is empty:
Sub GetData()
Dim objHTTP As Object
Dim arrJSON As Variant, strJSON As String
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
Url = "https://[website URL obscured]/survey/index.php/admin/remotecontrol"
objHTTP.Open "POST", Url, False
objHTTP.SetRequestHeader "Content-Type", "application/json"
strJSON = "{""method"":""get_session_key"",""username"":""*obscured username*"",""password"":""*obscured password*""}"
objHTTP.send (strJSON)
Debug.Print objHTTP.Status
If objHTTP.Status = "200" Then
MsgBox (objHTTP.responseText)
End If