Sorting Results
Methods that allow for more than one object to be returned generally supply a _sort
parameter that lets you specify the order in which the results are returned. For example,
orders can be sorted by the following fields:
order_idshipping.companyshipping.first_nameshipping.last_nameshipping.cityshipping.state_regionshipping.postal_codeshipping.country_codebilling.phonebilling.emailbilling.cc_emailbilling.companybilling.first_namebilling.last_namebilling.citybilling.statebilling.postal_codebilling.country_codecreation_dtspayment.payment_dtscheckout.screen_branding_theme_codechannel_partner.channel_partner_codechannel_partner.channel_partner_order_id
As with most data-set sorting routines, there is an ascending and a descending option. So to
sort the result set by billing last name (ascending) followed by billing first name
(ascending), you would use the following _sort parameter:
+billing.first_name,+billing.last_name
If you wanted to find the most recent orders, then you would sort by creation_dts in a
descending fashion with:
-creation_dts
warning
Always URL-encode parameters! If you fail to URL-encode the plus character, you are going to receive a bad request error for an improper sort attribute.
Was this page helpful?