API call to add tracking information to order


#1

I am attempting to place an API call to add a tracking number to an automatically generated shipment.

I am posting to:
$url = “https://api.ordoro.com/shipment/5-1044-1/tracking/”;

My post payload looks like this:
array:3 [▼
"notify_cart" => true
"tracking" => "1Z85X8W00341190000"
“shipment_id” => “5-1044-1”
]

I am receiving this error message:
array (size=2)
‘error_message’ => string ‘The input must be dict-like (not a : u’1Z85X8W00341190000’)’ (length=75)
‘param’ => string ‘tracking’ (length=8)

This seems to indicate that this parameter is being converted to unicode, and I found some documents online that indicate you might be using a python back-end which has trouble with certain character encodings. I have tried using the connection header to specify ISO-8859-1 encoding and typecasting all of my variables to make sure they are simple ASCII, but I have not yet been able to get around this error. Do you have any suggestions or documentation related to this? Or, perhaps, is the problem something else completely?


#2

Hi,

The issue with your request is that tracking is a nested object. Apologies for the terrible error message, dict-like is referring to the dictionary or object mapping.

If you’ll take a look at the documentation linked here POST /shipment/:id/tracking/, you’ll see as below that tracking is of Type NewTracking.

Name Type
ship_date datetime
notify_cart stringbool
shipment_id string, required
tracking NewTracking

Then if you visit the ``NewTracking model representation, you’ll see as below, the fields that are included in that object.

Name Type
tracking string, required
vendor string, required
shipping_method string
package_tracking string
cost number
email_ship_to stringbool
email_bill_to stringbool

I think you’ll likely want your request to look a little more like this:

array:3 [▼
"notify_cart" => true
"tracking" => array:2 [▼
  "tracking"=> "1Z85X8W00341190000",
  "vendor" => "some vendor like USPS, etc"
]
"shipment_id" => "5-1044-1"
]

Hope this helps! Feel free to reach out for any additional clarification.

Sophie