Using the Shippo API when you request rates it returns multiples and there is an 'attribute' key that contains values such as FASTEST, BESTVALUE, and CHEAPEST. This all seems fine and dandy but I can't seem to locate in the docs whether or not these values will always be present.. ie can I filter by say "BESTVALUE" and always have a result?
When accessing a rate(s), you'll want to remember that they are in the context of a specific shipment. So if you were returning an individual rate using the rate's object_id
, then there is no guarantee that there would be any values listed under attributes
.
If you were retrieving your rates from the shipment object (under the rates_list
field), then you could filter the rates tied to that shipment object listed in the rates_list
field using FASTEST, CHEAPEST, BESTVALUE.
Shippo generates these attributes for every shipment, but not necessarily every rate.