michaelbonds / ship-station

A php wrapper for ShipStation's api.
10 stars 32 forks source link

API endpoint doesn't works correctly. #9

Open ceekchong opened 4 years ago

ceekchong commented 4 years ago

I worked with shipstation API for creatlabelfororder. But when I set the testlabel parameter, I get the issue like this.

Client error: `POST https://ssapi.shipstation.com/orders/createlabelfororder` resulted in a `400 Bad Request` response:
{"Message":"The request is invalid.","ModelState":{"request.testlabel":["The value '0' is not vali (truncated...)

Also, I get same issue when create the order with insureShipment insureOption. Please let me know what is my wrong. Thank you

zack6849 commented 4 years ago

Hi @ceekchong for some reason json is casing that boolean value to an int when serializing it.

I'll look into fixing that, but in the meantime, quoting the value works, eg:

echo $orders->createLabelForOrder([
    'orderId' => '12345678',
    'carrierCode' => 'stamps_com',
    'serviceCode' => 'usps_first_class_mail',
    'confirmation' => 'none',
    'shipDate' => date('c'),
    'testLabel' => "true"
])->getBody();
ceekchong commented 4 years ago

Hi @zack6849 Thanks for your kindly reply. I checked and it works with your eg. Please fix the issues and let me know after you fix the issues.

I only missed the testLabel => "true" option. I wrote such as 'testLabel' => true/false, but it makes issues.

Thank you