I have an array like such:
[
{
"customer": {
"id": "61ae22891dbcb5200f4af298",
"customerId": "C0001346",
"companyName": "Real Constructions",
"displayName": "Real Constructions",
"fullName": "NiyatiU",
"email": "niyati@curbwaste.com",
"phone": "(987) 654-3209"
},
"address": {
"streetName": "NY",
"state": "NY",
"city": "NY",
"zipcode": "39092"
}
},
{
"customer": {
"id": "61ae29f31dbcb5200f4af2b2",
"customerId": "C0001347",
"companyName": "UK Reality",
"displayName": "UK Reality",
"fullName": "VatsalShah",
"email": "vatsal@curbwaste.com",
"phone": "(766) 688-1348"
},
"address": {
"streetName": "Queens",
"state": "NY",
"city": "Queens",
"zipcode": "11354"
}
}
]
and I would like to pass each object as a seperate param to xargs and curl. Psuedo code like
jq '. | map(@json) | join("\\0")' http/customer/us/customers.json \
| xargs -0 -n 1 -I % curl -X POST http://localhost:3000/customers -d '%'
But then I get:
xargs: insufficient space for argument
because the json element is too big, I'd assume. I'd prefer not write a bunch of files.