API JSON POST Request in VBA

mintz

Board Regular
Joined
Aug 5, 2015
Messages
129
I have the following JSON request sample code from an API service provider

Code:
HTTP Method: POST
URL: /services/shipper/orders

Code:
POST /services/shipper/orders HTTP/1.1

Content-Type: application/json
User-Agent: Mozilla 5.0
Host: api.epackcne.com
Date: Tue, 06 Jan 2018 21:20:27 GMT
Token: test12345678901234
I converted the sample to VBA as follows:

Code:
With JsonHTTP
             .Open "POST", url, False
             .setRequestHeader "RequestName", "application/json"
             .setRequestHeader "Accept", "application/json"
             .setRequestHeader "User-Agent", "Mozilla 5.0"
             .setRequestHeader "Host", "api.epackcne.com"
             .setRequestHeader "X-WallTech-Date", "Tue, 06 Jan 2018 21:20:27 GMT"
             .setRequestHeader "Authorization", "test12345678901234"
             .send (body)
End With

I wasn't quite sure where the POST /services/shipper/orders HTTP/1.1 goes in the header?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
it doesn't. that's just telling you that it's using http 1 with the url and the post method. you can ignore that line
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top