Trouble generating labels

Hello, I’m using the Ordoro v3 API. I’m able to create new orders through the “/order” endpoint, and I can verify those orders are successfully created because they show up on the ordoro.com UI. I can also create labels for those orders through the UI.

The problem is when I try to create labels via the “/shipment/shipment_id/label/generate” endpoint. I get a json object returned that looks like: “{“error_message”: “‘postal_reporting_number’”, “param”: null}”

I’m not clear what I’m supposed to pass in for the shipment_id, but when I append “1” to the order_id, such as M-123-1, I get the above error. When I pass I in any other value I get an error that says “No shipment with id ‘M-123-10’ for company_id XXXXX”.

I am making this api call in PHP cUrl. Any ideas on what I’m doing wrong?

  $ch = curl_init();
        $username = env('ORDORO_USERNAME');
        $password = env('ORDORO_PASSWORD');
       
        curl_setopt($ch, CURLOPT_URL, "https://apiverson.ordoro.com/shipment/M-123-1/label/generate");
        curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch, CURLOPT_HEADER, FALSE);
        curl_setopt($ch, CURLOPT_POST, TRUE);
        curl_setopt($ch, CURLOPT_POSTFIELDS, "{
            \"shipper_id\": 203984,
            \"weight\": 2,
            \"box_shape\": \"PKG\",
            \"shipping_method\": \"PM\"
          }");
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
            'Content-Type: application/json',
            'Accept: application/json')                                                                       
        );
        
        $response = curl_exec($ch);
        curl_close($ch);
        dd($response);

Hi,

If you’re using v3, you will typically be able to get the shipment_id by appending -1 as you have been doing.

For which carrier are you trying to generate a label? This endpoint is specific to USPS via Pitney Bowes, and requires that you have an account with them.

EDIT: In fact, this is a v2 specific endpoint. If you are attempting to create a v3 order label via USPS via Pitney Bowes, you should be using the /order/:order_number/label/pitney endpoint.

See the docs here for a better reference. https://devapiverson.docs.apiary.io/#reference/label/orderordernumberlabelpitney

Hello, thank you for your reply.

I am not actually using Pitney for a carrier. I am using Endicia. I read the Ordoro v3 api docs but it wasn’t clear that the endpoint I was previously using was only for Pitney.

I just tried again using /order/order_number/label/endicia, and I am apparently able to create a shipment as the json response that comes back contains the shipment info. However, when I check the same order in the v3 UI, the order still has a status of “Awaiting fulfillment”. Also, no return labels come back, and searching the docs, there doesn’t seem to be a way of getting a return label. How would I go about doing this?

Hi,

Apologies for the missing documentation around the endicia endpoint as the v3 api is still in flux.
You can use the return key, which is a boolean, and defaults to false, to describe whether you are creating a forward or return label.

With regard to the status of the order, did the shipping info response have a tracking number associated? The response also has a has_label boolean field, was this returned as true?

You may get more personalized results by contacting support about the order status remaining in Awaiting Fulfillment.

Hello, thanks again for your reply. I tried posting again to the same " /order/order_number/label/endicia" endpoint, and tried setting the return attribute to true. The body of my post request looked like this

curl_setopt($ch, CURLOPT_POSTFIELDS, “{
“shipper_id”: 203984,
“weight”: 2,
“box_shape”: “Parcel”,
“shipping_method”: “Priority”,
“length”: 14,
“width”: 11,
“height”: 3,
“return”: true
}”);

The response for that request looked like this

"{
    "tracking_number": "9405515902072198036200", 
    "cost": 6.37, 
    "shipping_method": "Priority", 
    "tracking_url": "https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=9405515902072198036200", 
    "ship_date": "2017-11-30T19:45:24.833452+00:00", 
    "carrier_name": "endicia", 
    "carrier": {"id": 203984, "link": "/shipper/203984/"}, 
    "box_shape": "Parcel", 
    "length": 14, 
    "width": 11, 
    "height": 3
}"

As you can see, there is a tracking number associated with it, but no “has_label” field.

Given this response, how would I now go about creating a label and return label?

Hi Tony,

Apologies there. If you take a look at the order, there should be shipping_info and return_shipping_info fields on the order response. Because there is a tracking number associated here, you have created a label. There can be no tracking without a label.

To retrieve the labels you must use the GET /label endpoint.
https://devapiverson.docs.apiary.io/#reference/label/label/get

Hope this helps.

Looks like you have only created a return label for this specific order. You can retrieve the label by using the following url.
/label?o=<order_number>&pdf_type=single_page&return=true

Hi Sophie,

Thanks for all your help. I’ve been able to get the labels created and I can retrieve the to label using the /label endpoint, as you suggested. If I have created both a to and a return label, how would I go about retrieving the return label? Using the /label endpoint only seems to return the to label but not the return label.

The endpoint example I gave in my previous message was specifically for the return label that you created.

My apologies for not catching that. Everything is working now. Thank you for your help

Good information thanks for sharing
Fieldengineer