Shipment creation - 400 bad request


#1

Hi,
I’m trying to create a shipment but get a 400 bad request error. The payload is as below. Can someone pls guide as to what is bad in the request.

https://api.veeqo.com/shipments
payload={ “shipment”: { “tracking_number_attributes”: { “tracking_number”: “2Y0000047095” }, “carrier_id”: 3, “notify_customer”: true, “update_remote_order”: false }, “allocation_id”: 13911087, “order_id”: “18926546”}
HTTP/1.1 400 Bad Request [Server: Cowboy, Connection: keep-alive, Date: Thu, 26 Jul 2018 14:26:18 GMT, Content-Type: application/json; charset=utf-8, Transfer-Encoding: chunked, X-Frame-Options: SAMEORIGIN, X-Xss-Protection: 1; mode=block, X-Content-Type-Options: nosniff, Cache-Control: no-cache, X-Request-Id: a20ff282-6f3e-4993-843b-df7f5945f9d5, X-Runtime: 0.041430, Vary: Accept-Encoding, X-Kong-Upstream-Latency: 60, X-Kong-Proxy-Latency: 0, Via: kong/0.7.0, 1.1 vegur] org.apache.http.conn.BasicManagedEntity@19b0e33b
java.lang.RuntimeException: Failed : HTTP error code : 400


#2

Hey,

Please can you check the type of quotes that you are using. I manged to create a shipment in my account using the same request but ensure the quotes are not curly quotes. You can use a tool such as JSONLint to validate your JSON.

The request below worked for me:

 {
 	"shipment": {
 		"tracking_number_attributes": {
 			"tracking_number": "2Y0000047095ssss"
 		},
 		"carrier_id": 3,
 		"notify_customer": true,
 		"update_remote_order": false
 	},
 	"allocation_id": 13911130,
 	"order_id": "18926671"
 }

For clarity the difference is between curly quotes: “” and straight quotes: ""

It might be the case that the forum has automatically changed the quotes in your request. In order to display a block of code use three back ticks before and after your code. EG ```

If that is the case, they I don’t know what was wrong with your request as it worked for me.

Thanks,


#3

what is strange is that the payload works fine if i dont send the tracking info…wondering what is wrong with that snippet?
“tracking_number_attributes”: {
“tracking_number”: “2Y0000047095”
},

I’m using the same quotes in the other parts and they are working fine…
Can you possibly check what was wrong with this one?
https://api.veeqo.com/shipments
payload={ “shipment”: { “tracking_number_attributes”: {
“tracking_number”: “PY0000882385” }, “carrier_id”: 3, “notify_customer”: true, “update_remote_order”: false }, “allocation_id”: 14058196,
“order_id”: 19084238}
HTTP/1.1 400 Bad Request [Server: Cowboy, Connection: keep-alive, Date: Wed, 01 Aug 2018 06:05:34 GMT, Content-Type: application/json; charset=utf-8, Transfer-Encoding: chunked, X-Frame-Options: SAMEORIGIN, X-Xss-Protection: 1; mode=block, X-Content-Type-Options: nosniff, Cache-Control: no-cache, X-Request-Id: ae983505-f287-495e-a370-fd97a5e520d8, X-Runtime: 0.045906, Vary: Accept-Encoding, X-Kong-Upstream-Latency: 90, X-Kong-Proxy-Latency: 0, Via: kong/0.7.0, 1.1 vegur] org.apache.http.conn.BasicManagedEntity@27cc7517


#4

Does the tracking number already exist in Veeqo?
Tracking number must be unique.