shippo-php-client icon indicating copy to clipboard operation
shippo-php-client copied to clipboard

Empty extra array results in API failure

Open chamby opened this issue 5 years ago • 2 comments

Setting extra to [] results in a JSON encoded array instead of an object. The Shippo API rejects this format with the following message:

{"shipment": [{"extra": ["Invalid format of the 'extra' object. The accepted format is 'extra': {}"]}]}

Perhaps JSON_FORCE_OBJECT or dropping empty extra parameter could be used to resolve this from the PHP library side.

Something changed recently at the API end because until last week the array format was working, but now all of my calls with an empty array fail. I will manually ensure that no empty array is passed to the PHP client, but thought you should be aware.

This is on version 1.4.3

chamby avatar Apr 29 '19 18:04 chamby

Hi.

We recently did some changes to the API because we noticed that some calls included an empty array for extras and that would result in a 500 response. So we added the proper status code and error to the response.

We'll look into how the error response is parsed on the library side so it can be surfaced properly.

Thanks.

malcolmrebughini avatar Apr 29 '19 18:04 malcolmrebughini

any news?

Rotron avatar Jan 14 '20 14:01 Rotron