Hi @shaisachs . Thanks so much for this and for demo'ing it at Netroots a couple of years ago :) .
I'm stuck, and I know you've left NGPVAN ( :( for us, :) for you ), and I've sent the same question into the official NGPVAN dev support folks. Figure you know the VAN API better than anyone. And once I figure out the answer, I'll do a PR against your doc here.
So, I want to add a bunch of new Locations, using curl and json. I'm able to add a new location, like this:
curl -H "Content-type: application/json" \
--user ""my_app_user_ID":"4e7c"|1" \
-X POST \
--data '{"name": "JOETestLocation3",
"address": {
"addressLine1": "123 main st",
"city": "Irvine",
"stateOrProvince": "CA",
"zipOrPostalCode": "92620"
}
}' \
https://api.securevan.com/v4//locations/findOrCreate
but not able to add multiple locations, like this:
curl -H "Content-type: application/json" \
--user ""my_app_user_ID":"4e7c"|1" \
-X POST \
--data '{
“locations”: [
"name":"Blue Gum Park",
"address":{"addressLine1":"14 Aberdeen","city":"Irvine","stateOrProvince":"CA"}},{"name":"Brywood Park","address": {"addressLine1":"15 Westwood","city":"Irvine","stateOrProvince":"CA"}},
{"name":"Canyon Park","address": {"addressLine1":"6 Canyon Park","city":"Irvine","stateOrProvince":"CA"}},
{"name":"Carrotwood Park","address": {"addressLine1":"60 Bennington","city":"Irvine","stateOrProvince":"CA"}},
{"name":"Chaparral Park","address": {"addressLine1":"19032 Turtle Rock Drive","city":"Irvine","stateOrProvince":"CA"}}] }’ \
https://api.securevan.com/v4//locations/findOrCreate
Admittedly, my JSON game is not the strongest. But when I try variations of the above, I get this error message:
"errors": [
{
"code": "INVALID_PARAMETER",
"text": "The body of the request is null or cannot be parsed."
}
]
So I guess my question is - what is the correct format for uploading multiple Location records in JSON into VAN so that they are parsed correctly?
I've been poring over the VAN dev docs at https://developers.ngpvan.com/van-api#van and I'll be searching on Stack Exchange for clues as well.
Thanks so much for any help.