I’ve been working with Shippo, which offers a shipping API for creating labels, tracking, and address verification. I set it up a REST interface quite easily, and was able to get most standard operations working well. The problem I have is when it comes to multi-piece shipments which requires that I post an array of ‘parcels’. Let me explain.
Shippo has you create a To Address object, a From Address object, and a Parcel object (with dimensions & weight). Once created each is given an Object ID. To create the shipment you just supply all three object IDs and the shipment is created. Here is what it looks like basically.
Pretty simple. But if you want to send multi-piece shipments you have to supply an array of Parcel object IDs, formatted like this ‘object_id’, ‘object_id’]. No problem creating that string, but there is an issue with the JSON generated from Skuid.
Here is what is required.
{
"object\_purpose": "PURCHASE",
“address_from”: “4f406a13253945a8bc8deb0f8266b245”,
“address_to”: “4c7185d353764d0985a6a7825aed8ffb”
“parcel”: f“3b1e9b81ef92451c9e613a82128988d5”, “6a2f479f1b1c43dfb9d98234ed720e47”],
"async": false
}
But instead Skuid is adding extra Quotations around the parcel list. Which makes sense because it thinks it is sending a simple text field, like below…
{
"object\_purpose": "PURCHASE",
“address_from”: “4f406a13253945a8bc8deb0f8266b245”,
“address_to”: “4c7185d353764d0985a6a7825aed8ffb”
“parcel”: " 7“3b1e9b81ef92451c9e613a82128988d5”, “6a2f479f1b1c43dfb9d98234ed720e47”] ** "** ,
"async": false
}
This results in an error with the external data source, it isn’t expecting the extra quotes. So finally my question. Thanks if you made it this far.
Is there a way to prevent Skuid from adding the extra quotes around the ‘array’ of object IDs? Anyway to prevent it from treating it as a string and putting it in quotes at all? Or is there a way to custom specify the JSON post with a snippet?
Really appreciate any help with this. I’ve been following this community for some time now, just my first time posting.
Andy