How can I send a JSON PUT request to pipedrive from ACCESS using VBA?

Question asked on StackOverflow
(How can I send a JSON PUT request to pipedrive from ACCESS using VBA? - Stack Overflow)

I use this converter: GitHub - VBA-tools/VBA-JSON: JSON conversion and parsing for VBA

I can get the json data but i have got some text fields whith some text which schould update the data in pipedrive

Dim jsonUpload As String

Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1")


jsonUpload = txt_pipedrive_id & ";"

jsonUpload = jsonUpload & txt_firma & ";"

jsonUpload = jsonUpload & txt_ansprechpartner & ";"

jsonUpload = jsonUpload & txt_adresse & ";"

jsonUpload = jsonUpload & txt_email & ";"

jsonUpload = jsonUpload & txt_telefon

Dim Json As Object
Set Json = JsonConverter.ConvertToJson(MyRequest.responseText)

MyRequest.Open "put", "https://api.pipedrive.com/v1/persons/" & txt_pipedrive_id & "?api_token={api_token}"
MyRequest.Send.Json

From omegastripes

What is the exact question? Why do you get MyRequest.responseText value prior to MyRequest.Open and MyRequest.Send? MyRequest.Send.Json is wrong syntax.

You can check the JSON is correct here: https://developers.pipedrive.com/docs/api/v1/?_ga=2.42896229.1164545172.1531365598-1698388143.1531365598#!/Persons/get_persons_id

Then;
Set Json = JsonConverter.ConvertToJson(jsonUpload )

URL is wrong;
'https://" & YourPipedriveCompany & “.pipedrive.com/v1/persons/” & txt_pipedrive_id & “?api_token=” & YourAPIToken

Then;
With CreateObject(“MSXML2.XMLHTTP”)
.Open “PUT”, strURL, False
.setRequestHeader “Content-Type”, “application/json”
.Send (strSql)
txt = .responseText
End With’

1 Like