- bjorn.kvinge298Asked on November 26, 2017 at 02:40 PM
I am trying to make a script that can send a submission with using the API and WinHttpRequst in Excel vba.
Can you please help me with the first question/answer field, how and where it should be in the code?
TargetURL = "https://eu-api.jotform.com/form/73295515263358/submissions?apiKey=XXXXXXXXXXXXXXXXXXXXXXX"
Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")
HTTPReq.Open "PUT", TargetURL, False
HTTPReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
- JotForm SupportMikeAnswered on November 26, 2017 at 05:03 PM
I am not really familiar with vba, but the following example should work, just make sure to add your API key:
Related API documentation:
In provided example, submission represents the field with qid 1 and submission the field with qid 2.
Dim result As String
argumentString = "submission=Siv&submission=Per Nils"
Set XMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")
XMLHTTP.Open "POST", _
XMLHTTP.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
result = XMLHTTP.responsetext
Set XMLHTTP = Nothing
- bjorn.kvinge298Answered on November 27, 2017 at 03:53 PM
It worked perfect, thank you very much for your help! :)