Discussions

Ask a Question
Back to All

Create Shipment API return "partial_success" error in sandbox v2 api

Hello,
I have some errors,when Call API for shipment than get not proper response. "undefined method `[]' for nil:NilClass" as errors array in response. so please help me.

Request ::
{"origin_address": {"line_1": "250 Executive Park Blvd, Suite 3400", "line_2": "", "state": "California", "city": "San Francisco", "postal_code": "94134", "company_name": "YourCompany", "contact_name": "My Company (San Fran", "contact_phone": "+1 (650) 555-0111 ", "contact_email": "[email protected]"},
"destination_address": {"line_1": "192 Spadina Ave", "line_2": "", "state": "Toronto", "city": "Toronto", "postal_code": "M4C 1A1", "company_name": "", "contact_name": "Deco Addict", "contact_phone": "+1 603-996-3829", "contact_email": "[email protected]", "country_alpha2": "CA"},
"incoterms": "DDU",
"insurance": {"is_insured": false},
"courier_selection": {"apply_shipping_rules": true, "selected_courier_id": "0e999042-dc78-4954-b7f4-14670b394d86", "allow_courier_fallback": false},
"shipping_settings": {
"units": {"weight": "kg", "dimensions": "cm"},
"buy_label": true, "buy_label_synchronous": true,
"printing_options": {"format": "PDF", "label": "4x6", "commercial_invoice": "A4", "packing_slip": "4x6"}
},
"parcels": [{"total_actual_weight": 1.00, "box": {"slug": "null", "length": 13, "width": 13, "height": 13}, "items": [{"quantity": 1, "description": "Cabinet with Doors", "category": "health_beauty", "sku": "E-COM11", "actual_weight": 1.00, "declared_currency": "USD", "declared_customs_value": 140.0, "dimensions": {"length": 13, "width": 13, "height": 13}}]}]}

Response body ::
{
"status": "partial_success",
"errors": [
"undefined method `[]' for nil:NilClass"
],
"shipment": {
"easyship_shipment_id": "ESUS10116163",
"created_at": "2022-12-21T11:15:46.934Z",
"updated_at": "2022-12-21T11:15:48.380Z",
"label_paid_at": "2022-12-21T11:15:48.178Z",
"label_generated_at": null,
"order_created_at": null,
"origin_address": {
"line_1": "250 Executive Park Blvd, Suite 3400",
"line_2": "",
"state": "California",
"city": "San Francisco",
"postal_code": "94134",
"country_alpha2": "US",
"contact_name": "My Company (San Fran",
"company_name": "YourCompany",
"contact_phone": "+1 (650) 555-0111 ",
"contact_email": "[email protected]"
},
"sender_address": {
"line_1": "250 Executive Park Blvd, Suite 3400",
"line_2": "",
"state": "California",
"city": "San Francisco",
"postal_code": "94134",
"country_alpha2": "US",
"contact_name": "My Company (San Fran",
"company_name": "YourCompany",
"contact_phone": "+1 (650) 555-0111 ",
"contact_email": "[email protected]"
},
"return_address": {
"line_1": "250 Executive Park Blvd, Suite 3400",
"line_2": "",
"state": "California",
"city": "San Francisco",
"postal_code": "94134",
"country_alpha2": "US",
"contact_name": "My Company (San Fran",
"company_name": "YourCompany",
"contact_phone": "+1 (650) 555-0111 ",
"contact_email": "[email protected]"
},
"destination_address": {
"line_1": "192 Spadina Ave",
"line_2": null,
"state": "Toronto",
"city": "Toronto",
"postal_code": "M4C 1A1",
"country_alpha2": "CA",
"contact_name": "Deco Addict",
"company_name": "",
"contact_phone": "+16039963829",
"contact_email": "[email protected]"
},
"order_data": {
"platform_name": null,
"platform_order_number": null,
"order_tag_list": [],
"seller_notes": null,
"buyer_notes": null
},
"metadata": {},
"set_as_residential": false,
"consignee_tax_id": null,
"eei_reference": null,
"incoterms": "DDU",
"insurance": {
"is_insured": false,
"insured_amount": 168.71,
"insured_currency": "USD"
},
"parcels": [
{
"total_actual_weight": 1.0,
"box": {
"id": null,
"courier_umbrella_name": null,
"courier_origin_country_alpha2": null,
"name": null,
"slug": null,
"outer_length": 13.0,
"outer_width": 13.0,
"outer_height": 13.0,
"weight": 0.0
},
"items": [
{
"description": "Cabinet with Doors",
"category": "Health & Beauty",
"sku": "E-COM11",
"quantity": 1,
"dimensions": {
"length": 13.0,
"width": 13.0,
"height": 13.0
},
"actual_weight": 1.0,
"origin_currency": "USD",
"origin_customs_value": 140.0,
"declared_currency": "USD",
"declared_customs_value": 140.0
}
]
}
],
"total_customs_value": 140.0,
"total_actual_weight": 1.0,
"shipment_state": "created",
"pickup_state": "not_requested",
"delivery_state": "not_created",
"label_state": "technical_failed",
"warehouse_state": "none",
"trackings": [],
"tracking_page_url": "https://www.trackmyshipment.co/shipment-tracking/ESUS10116163",
"shipping_documents": [],
"currency": "USD",
"selected_courier": {
"id": "0e999042-dc78-4954-b7f4-14670b394d86"
},
"rates": [
{
"courier_id": "0e999042-dc78-4954-b7f4-14670b394d86",
"courier_name": "DHL eCommerce - Packet Priority",
"min_delivery_time": 8,
"max_delivery_time": 12,
"value_for_money_rank": 1.0,
"delivery_time_rank": 1.0,
"currency": "USD",
"shipment_charge": 28.71,
"fuel_surcharge": 0.0,
"remote_area_surcharge": 0.0,
"remote_area_surcharges": {},
"other_surcharges": {},
"oversized_surcharge": 0.0,
"additional_services_surcharge": 0.0,
"residential_full_fee": 0.0,
"residential_discounted_fee": 0.0,
"shipment_charge_total": 28.71,
"warehouse_handling_fee": 0.0,
"insurance_fee": 0.0,
"sales_tax": 0.0,
"provincial_sales_tax": 0.0,
"ddp_handling_fee": 0.0,
"import_tax_charge": 0.0,
"import_tax_non_chargeable": 0.0,
"import_duty_charge": 0.0,
"total_charge": 28.71,
"is_above_threshold": true,
"incoterms": "DDU",
"estimated_import_tax": 20.25,
"estimated_import_duty": 0.0,
"minimum_pickup_fee": 0.0,
"available_handover_options": "dropoff,free_pickup",
"tracking_rating": 0,
"easyship_rating": 2.8,
"courier_remarks": null,
"payment_recipient": "Easyship",
"discount": {
"code": null,
"amount": 0,
"expires_at": null,
"percentage": null,
"origin_amount": 0
}
}
]
}
}