# Trouble generating labels

**URL:** <https://forums.ordoro.com/t/trouble-generating-labels/154>\
**Category:** Uncategorized\
**Created:** [November 29, 2017, 12:39am UTC](https://forums.ordoro.com/t/trouble-generating-labels/154 "2017-11-29T00:39:42Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony](https://avatars.discourse-cdn.com/v4/letter/t/ee7513/32.png) [@Tony](https://forums.ordoro.com/u/Tony)\
**Post date:** [November 29, 2017, 12:39am UTC](https://forums.ordoro.com/t/trouble-generating-labels/154/1 "2017-11-29T00:39:42Z")

</div>

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](http://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);
```

---

<div class="post-metadata">

**Author:** ![sophie](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.ordoro.com/sophie/32/19_2.png) [@sophie](https://forums.ordoro.com/u/sophie)\
**Post date:** [November 29, 2017, 12:48am UTC](https://forums.ordoro.com/t/trouble-generating-labels/154/2 "2017-11-29T00:48:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sophie](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.ordoro.com/sophie/32/19_2.png) [@sophie](https://forums.ordoro.com/u/sophie)\
**Post date:** [November 29, 2017, 12:54am UTC](https://forums.ordoro.com/t/trouble-generating-labels/154/3 "2017-11-29T00:54:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tony](https://avatars.discourse-cdn.com/v4/letter/t/ee7513/32.png) [@Tony](https://forums.ordoro.com/u/Tony)\
**Post date:** [November 29, 2017, 1:33am UTC](https://forums.ordoro.com/t/trouble-generating-labels/154/4 "2017-11-29T01:33:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![sophie](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.ordoro.com/sophie/32/19_2.png) [@sophie](https://forums.ordoro.com/u/sophie)\
**Post date:** [November 30, 2017, 5:22pm UTC](https://forums.ordoro.com/t/trouble-generating-labels/154/5 "2017-11-30T17:22:42Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![Tony](https://avatars.discourse-cdn.com/v4/letter/t/ee7513/32.png) [@Tony](https://forums.ordoro.com/u/Tony)\
**Post date:** [November 30, 2017, 7:59pm UTC](https://forums.ordoro.com/t/trouble-generating-labels/154/6 "2017-11-30T19:59:57Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![sophie](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.ordoro.com/sophie/32/19_2.png) [@sophie](https://forums.ordoro.com/u/sophie)\
**Post date:** [November 30, 2017, 8:14pm UTC](https://forums.ordoro.com/t/trouble-generating-labels/154/7 "2017-11-30T20:14:48Z")

</div>

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](https://devapiverson.docs.apiary.io/#reference/label/label/get)

Hope this helps.

---

<div class="post-metadata">

**Author:** ![sophie](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.ordoro.com/sophie/32/19_2.png) [@sophie](https://forums.ordoro.com/u/sophie)\
**Post date:** [November 30, 2017, 8:23pm UTC](https://forums.ordoro.com/t/trouble-generating-labels/154/8 "2017-11-30T20:23:07Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![Tony](https://avatars.discourse-cdn.com/v4/letter/t/ee7513/32.png) [@Tony](https://forums.ordoro.com/u/Tony)\
**Post date:** [December 2, 2017, 1:27am UTC](https://forums.ordoro.com/t/trouble-generating-labels/154/9 "2017-12-02T01:27:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sophie](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.ordoro.com/sophie/32/19_2.png) [@sophie](https://forums.ordoro.com/u/sophie)\
**Post date:** [December 4, 2017, 3:17pm UTC](https://forums.ordoro.com/t/trouble-generating-labels/154/10 "2017-12-04T15:17:13Z")

</div>

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

> [@sophie](#):
>
> return=true

---

<div class="post-metadata">

**Author:** ![Tony](https://avatars.discourse-cdn.com/v4/letter/t/ee7513/32.png) [@Tony](https://forums.ordoro.com/u/Tony)\
**Post date:** [December 4, 2017, 6:20pm UTC](https://forums.ordoro.com/t/trouble-generating-labels/154/11 "2017-12-04T18:20:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![willkaens](https://avatars.discourse-cdn.com/v4/letter/w/a3d4f5/32.png) [@willkaens](https://forums.ordoro.com/u/willkaens)\
**Post date:** [January 13, 2021, 11:10am UTC](https://forums.ordoro.com/t/trouble-generating-labels/154/12 "2021-01-13T11:10:51Z")

</div>

Good information thanks for sharing  
[Fieldengineer](https://www.fieldengineer.com)
