Closed JavPer73 closed 9 months ago
Just checked and there are tons of variables here, for example if the carrier supports multi-collo. Just want to be sure I am using the right methods of this API.
Thanks!
How to create multicollo shipments
To create a multicollo, include the number of parcels you wish to ship in the quantity field under the parcel object, and make a
POST
request to the Create multiple parcels endpoint. The maximum number of parcels you can create under quantity is 20.
Yes I already read that document before, but it ultimately points to the same Create single parcel Endpoint https://panel.sendcloud.sc/api/v2/parcels Only diference I see is that the input is an array of parcels instead of a single parcel. Has this API been tested with multicollo? Am I using the right methods?
But the array can also contain just 1 parcel. It's about the Quantity property. The example below creates 3 parcels for DPD, because the Quantity is set to 3.
When you print the labels there will be a section with "Packages 1 of 3", "Packages 2 of 3", "Packages 3 of 3"
var parcels = new[]
{
new CreateParcel
{
Name = "John Doe",
CompanyName = "SendCloud",
Address = "Insulindelaan",
HouseNumber = "115",
City = "Eindhoven",
PostalCode = "5642CV",
Telephone = "+31612345678",
Email = "john@doe.nl",
Country = "NL",
Shipment = new ShippingMethod { Id = 4203 },
Weight = 10.000,
OrderNumber = "1",
InsuredValue = 0,
TotalOrderValue = "11.11",
TotalOrderValueCurrency = "EUR",
Quantity = 3,
RequestLabel = true,
}
};
var response = await _apiV2.Parcels.BulkCreate(parcels);
Is this what you mean?
As I wrote in the opening message
So I tried with Parcels.BulkCreate(new CreateParcel[] { parcel }) with the same parcel object as before but I got independent labels who are not detected as Multicollo.
But it was with MRW, if we check
https://support.sendcloud.com/hc/en-us/articles/360038716852-How-to-create-multicollo-shipments-#2
it has a lot of requirements:
MRW
Only available if you have a direct contract
Set label preferences directly in MRW (have parcels displayed as 1, 2, 3 or as 1/3, 2/3, 3/3, etc.)
Parcel dimensions are mandatory. To automate this, use our [Boxes feature](https://support.sendcloud.com/hc/en-us/articles/360059184551).
I just wanted to be sure I was using the right API calls before continuing to do more tests with other carriers.
This is how multicollo appear in the Sendcloud webapp
You are using the right API call Parcels.BulkCreate(new CreateParcel[] { parcel })
When you use the example from me. You can see the Multicollo appear like the your screenshot.
Thanks, now we are sure the API works right!
I will test with other carriers
I am struggling to create multicollo parcels (RequestLabel = true)
If I use Parcels.Create(parcel) with quantity >1 I get an exception 'Requesting a label for a multi-collo shipment in only allowed via creating multiple parcels"
So I tried with Parcels.BulkCreate(new CreateParcel[] { parcel }) with the same parcel object as before but I got independent labels who are not detected as Multicollo.
Is there a specific method I haven't found?