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

Rates retrieve method does not return individual rates

Open mersedsv opened this issue 2 years ago • 1 comments

Rates retrieve does not work. Method does not return individual shipping rates, nor it expects individual shipment object id.

Documentation: https://goshippo.com/docs/reference/js#rates-retrieve

Expectations: Providing object id (which was created using shippo.shipment.create) and getting single rate as referenced in the doc. Request will be send to https://api.goshippo.com/rates/<RATE OBJECT ID> as per documentation.

Actual behaviour: const shippingRate = await shippo.shipment.retrieve(shippingRateId);

{
    type: 'ShippoNotFoundError',
    code: undefined,
    detail: { detail: 'Not found' },
    path: '/shipments/a58a355b5eb94522ac89d357be2b916d',
    statusCode: 404
}

It seems that shippo.shipment.retrieve method actually does not expects shippingRateId ... instead it expects shipping id. If I provide shipping id, it simply returns all shipping rates, which is different behaviour then explained within documentation.

Request is sent to the https://api.goshippo.com/shipments/<Shipping ID>

mersedsv avatar Mar 19 '22 02:03 mersedsv

@mersedsv Just stumbled upon this problem. You are using the wrong API call, you should use: await shippo.rate.retrieve(shippingRateId)

cquark7 avatar Aug 03 '22 06:08 cquark7