Hello!
Sorry I didn’t see this sooner, looks like my spam filter got ahold of it
In order to “talk JSON” from VBA/VBScript, you need a handy dandy parser object, I use this one:
http://www.aspjson.com
In one of my projects, I have a table called Assets. Here is the code to create an Asset record from within MS Access:
Public Function AddAsset(strDesc As String) As String
Dim oj As New clsJSON, data, strOut As String, s As String
Dim authnetStatus, authnetVal, xml, strURL As String
' On Error GoTo getAssetTags_Error
On Error Resume Next
strURL = "https://api.airtable.com/v0/123123/Assets" ' & strID '
' Debug.Print strURL
Set oj = New clsJSON
Set xml = CreateObject("Microsoft.XMLHTTP")
xml.Open "POST", strURL, False
xml.setRequestHeader("Content-type") = "application/json"
xml.setRequestHeader("Authorization") = "Bearer key456456"
oj.data.Add oj.Collection()
oj.data.Add "fields", oj.Collection
oj.data("fields").Add "Description", strDesc
data = oj.JSONoutput
xml.send data
authnetStatus = CStr(xml.Status)
authnetVal = xml.responseText
AddAsset = authnetVal ' oj.JSONoutput '
On Error GoTo 0
Exit Function
getAssetTags_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure getAssetTags of Module modAirTables"
End Function
The trick to getting it to work as expected is in referencing and dereferencing the JSON object, but once you get the hang of it, it’s not too bad.
–Jon