I am successfully implementing the VBA-Web code in https://github.com/VBA-tools/VBA-Web but I dont know how to add an item with array or collection into the body. I'm quite new to using array or collections for this purpose. Here's the Json data I'm trying to post:
{
"operation": "CREATE",
"orderNo": "ORD001",
"type": "D",
"date": "2014-10-14",
"location": {
"address": "393 Hanover St, Boston, MA 02113, USA",
"locationNo": "LOC001",
"locationName": "Green Cross Pharmacy North End",
"acceptPartialMatch": true
},
"duration": 20,
"twFrom": "10:00",
"twTo": "10:59",
"load1": 10,
"load2": 25,
"vehicleFeatures": ["FR"],
"skills": ["SK001", "SK002"],
"notes": "Deliver at back door"
}
How do I add the location data into this code for posting?
Sub PostMan()
Dim Body As New Dictionary
Body.Add "operation", "CREATE"
Body.Add "orderNo", "ORD101"
Body.Add "type", "D"
Body.Add "date", "2020-04-24"
Body.Add "location", 'How do I the location data here?
Body.Add "vehicleFeatures", 'How do I add this item?
Body.Add "skills", 'How do I add this item?
Dim Client As New WebClient
Dim Response As WebResponse
Set Response = Client.PostJson("https://api.optimoroute.com/v1/create_order?key=AUTH_KEY", Body)
Worksheets("Open1").Range("A1").Value = Response.Content
End Sub