Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Limesurvey JSON POST VBA

  • micmoo
  • micmoo's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 2 months ago #163924 by micmoo
Limesurvey JSON POST VBA was created by micmoo
Hello,
I am trying to have access to my survey using ms access and JSON request. I am aware there is plenty of examples on the web (focused on getting data from and to MS Excel). They give great insight in the Json parsing. However I am trying to send a simple POST request to a survey using VBA but for a reason I do not understand I can not get even the session ID.

Here is the code :
Dim JSRequest As New XMLHTTP60
JSRequest.Open "POST", " xxxxx.limequery.com/admin/remotecontrol "
JSRequest.setRequestHeader "Content-type:", "application/json"
JSRequest.setRequestHeader "method:", "get_session_key"
JSRequest.setRequestHeader "params:", "[" & """mysusername""" & "," & """mypassword""" & "]"
JSRequest.setRequestHeader "id:", 1
JSRequest.send
If JSRequest.status = 200 Then
Debug.Print JSRequest.GetAllResponseHeaders
Debug.Print "responseBody = " & JSRequest.ResponseBody
Debug.Print "responsetext = " & JSRequest.ResponseText
End If
Exit Sub

I am getting the status = 200 but I get the following response :
responseBody = ?????????????????????????????????
responsetext = {"id":null,"result":null,"error":"unable to decode malformed json"}

I suspect that the string related to the user/pwd is not correct but I could not find the correct string (the string below will give - ["mysusername","mypassword"] -. I have tried different strings using fiddler but without success. Did I miss something ?

Would be grateful if somebody could help

Thanks in advance
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose