JSON post with Access VBA

I need to convert the CURL POST command below to vba (access).  I'm very proficient with access vba but not anything web-based so any direction on learning materials would be also appreciated.  I found and modified an example that I thought might work (code below), but it just gives the error "ActiveX can't create the object.  Suggestions?

CURL COMMAND:
curl -X POST -H "Content-type: application/json" -H "Accept: application/json" -d '{"shop": "9999999999","client_code": "88888888888.","lastname": "Ender","phonenumber": "5555555559","vehicle_year": "1999","vehicle_make": "JEEP","vehicle_model": "something" }' http://somewebsite.com/api/customers

VBA CODE (Fails with error above):

Private Sub cmdCreateAutoTextCustomer_Click()
Dim sURL As String, sHTML As String
Dim oHttp As Object
Dim Body As String
'‘Add a reference to the MSXML type library
Set oHttp = CreateObject("MSXML3.ServerXMLHTTP")

'‘The website to post to
sURL = "http://somewebsite.com/api/customers"

'‘ The json string to send.
Body = "{""shop_number"": ""9729925026"",""client_code"": ""142KukK231k."",""lastname"": ""Ender"",""phonenumber"": ""5555555559"",""vehicle_year"": ""2009"",""vehicle_make"": ""JEEP"",""vehicle_model"": ""something"" }"

oHttp.Open "POST", sURL, False
oHttp.setRequestHeader ' "Content - type", "application / json" '
oHttp.setRequestHeader '"Accept”, "application / json"'

'‘Send the json
oHttp.send (Body)

'‘Server response.
sHTML = oHttp.responseText

'‘Verify that the login was successful.
If Mid(sHTML, Len(sHTML) - 5, 6) = ":true}" Then
    MsgBox "Success"
    Set oHttp = Nothing
    MsgBox "An error occured."
Exit Sub
End If

Set oHttp = Nothing
End Sub
cmccurdyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DarrenSenior Software EngineerCommented:
Hi,

What is the error you are getting and what are you getting back in the response?

What does
oHttp.responseText

Open in new window

output

Does this work?
oHttp.responseXML.xml

Open in new window

From your previous question that I answered you were failing on the create object. This is now working so you might have to debug the oHttp object to see what you are receiving back.

Thanks,

Darren
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cmccurdyAuthor Commented:
Thanks, I'm working on that now.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.