Discussions
Create a shipment API call - no valid responses
about 1 year ago by Michael Harris
We've tried filling out the fields a million different ways and can't seem to ever get a valid 200 response with shipping options from the "Create a shipment" API call. We always get a 202. Please see below for the payload:
request('POST', ', \[ 'body' => '{"origin_address":{"line_1":"45915 Maries Rd","line_2":"Unit 110","state":"VA","city":"Sterling","postal_code":"20166","country_alpha2":"US","company_name":"Babel","contact_name":"Addison Meyers","contact_phone":"5716439910","contact_email":"[[email protected]](mailto:[email protected])"},"sender_address":{"line_1":"45915 Maries Rd","line_2":"Unit 110","state":"VA","city":"Sterling","postal_code":"20166","country_alpha2":"US","company_name":"Babel","contact_name":"Addison Meyers","contact_phone":"5716439917","contact_email":"[[email protected]](mailto:[email protected])"},"destination_address":{"line_1":"2701 Glencroft Rd","state":"VA","city":"Vienna","postal_code":"22181","country_alpha2":"US","contact_name":Jay Cole","contact_phone":"5716439919","contact_email":"[[email protected]](mailto:[email protected])"},"incoterms":"DDU","insurance":{"is_insured":false,"insured_currency":"USD"},"courier_selection":{"allow_courier_fallback":false,"apply_shipping_rules":true,"list_unavailable_couriers":true},"shipping_settings":{"additional_services":{"qr_code":"none"},"units":{"weight":"lb","dimensions":"in"},"buy_label":false,"buy_label_synchronous":false,"printing_options":{"format":"png","label":"4x6","commercial_invoice":"A4","packing_slip":"4x6"}},"set_as_residential":true,"parcels":\[{"box":{"length":13,"width":10,"height":4},"items":[{"dimensions":{"length":10,"width":8,"height":1},"description":"fabric","category":"home decor","sku":"12313","hs_code":"5907100","contains_battery_pi966":false,"contains_battery_pi967":false,"contains_liquids":false,"origin_country_alpha2":"US","quantity":2,"actual_weight":1,"declared_currency":"USD","declared_customs_value":1}],"total_actual_weight":3}]}', 'headers' => [ 'accept' => 'application/json', 'authorization' => 'Bearer sand_38a0aJsSP+dx8udjcAePOE886TxS0Ya8wx0EUDkeNfE=', 'content-type' => 'application/json', ], ]); echo $response->getBody(); The response that we get is as follows: { "shipment": { "easyship_shipment_id": "ESUS10131966", "consignee_tax_id": null, "courier": null, "created_at": "2023-12-04T16:55:12Z", "currency": "USD", "delivery_state": "not_created", "destination_address": { "city": "Vienna", "company_name": null, "contact_email": "[[email protected]](mailto:[email protected])", "contact_name": "Jay Cole", "contact_phone": "5716439917", "country_alpha2": "US", "line_1": "2701 Glencroft Rd", "line_2": null, "postal_code": "22181", "state": "VA" }, "eei_reference": null, "incoterms": null, "insurance": { "is_insured": false, "insured_amount": 0, "insured_currency": "USD" }, "label_generated_at": null, "label_paid_at": null, "label_state": "not_created", "last_failure_http_response_messages": \[], "metadata": {}, "order_created_at": null, "order_data": { "platform_name": null, "platform_order_number": null, "order_tag_list": \[], "seller_notes": null, "buyer_notes": null }, "origin_address": { "city": "Sterling", "company_name": "Babel", "contact_email": "[[email protected]](mailto:[email protected])", "contact_name": "Addison Meyers", "contact_phone": "5716439917", "country_alpha2": "US", "line_1": "45915 Maries Rd", "line_2": "Unit 110", "postal_code": "20166", "state": "VA" }, "parcels": \[ { "box": { "id": null, "name": null, "outer_dimensions": { "length": 33.02, "width": 25.4, "height": 10.16 }, "slug": null, "type": "box", "weight": 0 }, "items": [ { "actual_weight": 0.45359237, "category": "Home Decor", "contains_battery_pi966": null, "contains_battery_pi967": null, "contains_liquids": null, "declared_currency": "USD", "declared_customs_value": 1, "description": "fabric", "dimensions": { "length": 25.4, "width": 20.32, "height": 2.54 }, "hs_code": "59071000", "origin_country_alpha2": "US", "origin_currency": "USD", "origin_customs_value": 1, "quantity": 2, "sku": "12313" } ], "total_actual_weight": 1.36077711 } ], "pickup_state": "not_requested", "rates": \[], "regulatory_identifiers": { "eori": null, "ioss": null, "vat_number": null }, "return": false, "return_address": { "city": "Sterling", "company_name": "Babel", "contact_email": "[[email protected]](mailto:[email protected])", "contact_name": "Addison Meyers", "contact_phone": "5716439918", "country_alpha2": "US", "line_1": "45915 Maries Rd", "line_2": "Unit 114", "postal_code": "20166", "state": "VA" }, "sender_address": { "city": "Sterling", "company_name": "Babel", "contact_email": "[[email protected]](mailto:[email protected])", "contact_name": "Addison Meyers", "contact_phone": "5716439910", "country_alpha2": "US", "line_1": "45915 Maries Rd", "line_2": "Unit 110", "postal_code": "20166", "state": "VA" }, "set_as_residential": true, "shipment_state": "created", "shipping_documents": \[], "tracking_page_url": ", "trackings": \[], "updated_at": "2023-12-04T16:55:15Z", "warehouse_state": "none" }, "meta": { "status": "partial_success", "errors": [ "No shipping solutions available based on the information provided" ], "unavailable_couriers": \[] } }