Obtain Token from LimeSurvey Using VBA

Plus d'informations
il y a 1 mois 6 jours #181907 par websolprov
Dear Friends,

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 = "http://[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

End Sub

Connexion ou Créer un compte pour participer à la conversation.

LimeSurvey Partners

Commencez dès maintenant !

Créez simplement un compte et commencez à utiliser LimeSurvey dès aujourd'hui.

Inscrivez-vous maintenant

Inscrivez-vous à notre Newsletter!