MwSpaceLLC / packlink-php

Packlink Pro Php Api Sdk (shipping automation) | Php Library Model (Unofficial)
Apache License 2.0
4 stars 2 forks source link

400 Bad Request Error #1

Open adeelfaisal opened 1 year ago

adeelfaisal commented 1 year ago

Hi I am trying to make a shipment but i am getting error 400 Client Error - Bad Request

My Laravel Code is

` $shipment = [ "user_id" => null, "client_id" => null, "service" => $request->carrier, "carrier" => $request->carrier, "service_id" => $request->id_carrier, "collection_date" => $request->date, "collection_time" => $request->time, "dropoff_point_id" => null, "content" => $request->content, "contentvalue" => $request->myField, "content_second_hand" => false, "shipment_custom_reference" => null, "priority" => false, "contentValue_currency" => "EUR", "from" => array( "name" => $request->name1, "surname" => $request->last1, "company" => $request->contact1, "street1"=> $request->address1, "street2" => null, "zip_code" => $request->pincode1, "city" => $request->postal1, "country" => $request->country, "phone" => $request->phone1, "email" => $request->email1, ), "to" => array( "name" => $request->name2, "surname" => $request->last2, "company" => $request->remark1, "street1" => $request->address2, "street2" => '', "zip_code" => $request->pincode2, "city" => $request->postal2, "country" => $request->country2, "phone" => $request->phone2, "email" => $request->email2, ), "additional_data" => array( "postal_zone_id_from" => null, "postal_zone_id_to" => null, "shipping_service_name" => null, "zip_code_id_from" => null, "zip_code_id_to" => null, "selectedWarehouseId" => null, "parcel_Ids" => [], "postal_zone_name_to" => null, "order_id" => "11", "seller_user_id" => null, "items" => array( 0 => array( "price" => 35.38, "title" => "The adventure begins Framed poster", "picture_url" => "prestashop.mwspace.ovh/4-home_default/the-adventure-begins-framed-poster.jpg", "quantity" => 1, "category_name" => "Art", ) ) ), "packages" => array ( 0 => array( 'weight' => $request->weight, // kg 'height' => $request->heig, // cm 'length' => $request->leng, // cm 'width' => $request->widt, // cm

) ) ];

     $shipment = Shipment::create($shipment); `
MwSpaceLLC commented 1 year ago

hi there, tnks for use it.

Please, share me correct example of coding complete for test it.