{"_id":"544a47db27b7fc140078db01","parentDoc":null,"project":"543d1e263a300f20000d31fb","version":{"_id":"543d1e5e5276641a00a593cf","forked_from":"543d1e263a300f20000d31fe","project":"543d1e263a300f20000d31fb","__v":16,"createdAt":"2014-10-14T13:00:14.946Z","releaseDate":"2014-10-14T13:00:14.946Z","categories":["543d1e5f5276641a00a593d0","543d1ee45276641a00a593da","5448e2cbc64edd1a00453c29","5449135acdc944220048845c","544a0a93778b3e08002b2289","544a0a9727b7fc140078da58","544a456f27b7fc140078daff","544e027cbd51b9080037f680","544e029ab80812080035bba6","544e3a2eb80812080035bd67","5450b7c5a66f020800dba7b3","5450c0e47abbbc0800a5e989","5450c0f97abbbc0800a5e98a","5450c103a66f020800dba819","54f99f588d09b7390007ea45","565c81dbf3e9360d00823e43"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2"},"is_link":false,"user":"54352decadf50e0800b89024","__v":1,"category":{"_id":"544a456f27b7fc140078daff","project":"543d1e263a300f20000d31fb","version":"543d1e5e5276641a00a593cf","pages":["544a47db27b7fc140078db01","54b933914ba4e40c00624837"],"__v":2,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-24T12:26:23.670Z","from_sync":false,"order":1,"slug":"guides","title":"Guides"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-10-24T12:36:43.584Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"basic_auth":false,"results":{"codes":[]},"try":true,"auth":"never","params":[],"url":""},"isReference":false,"order":0,"body":"This page will explain how to use and format the `order_by` argument to list endpoints that support ordering.\n\nMost endpoints that list content, also allow you to choose how to order the results.\nThis is done via the `order_by` request parameter.\n\neTilbudsavis API use a flexible ordering system where you can chain your prefered sort order.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Usage\"\n}\n[/block]\n`order_by` is a comma-seperated list of order tokens that determines how the result set will be sorted.\n\nEach list endpoint has it's own available order tokens, but the syntax for combining them is the same.\n\n     order_by=created\n    \nwill order the result set by created time in ascending order (oldest first)\nAscending is the default direction. You can change this by prefixing a `-` to the order token:\n\n    order_by=-created\n    \nwill order by created, but in descending order (newest first)\n\nYou can chain order tokens together by comma-seperating order tokens:\n\n    order_by=-created,-popularity\n  \nThis will order the result set by descending creation date, and if two items have the same creation date, sort those by descending popularity.\nThis results in an order that is; \"New items first; if created at same time; most popular item first.\"\n\nEach endpoint has it's own list of supported order tokens.","excerpt":"","slug":"order-by","type":"basic","title":"Order By"}
This page will explain how to use and format the `order_by` argument to list endpoints that support ordering. Most endpoints that list content, also allow you to choose how to order the results. This is done via the `order_by` request parameter. eTilbudsavis API use a flexible ordering system where you can chain your prefered sort order. [block:api-header] { "type": "basic", "title": "Usage" } [/block] `order_by` is a comma-seperated list of order tokens that determines how the result set will be sorted. Each list endpoint has it's own available order tokens, but the syntax for combining them is the same. order_by=created will order the result set by created time in ascending order (oldest first) Ascending is the default direction. You can change this by prefixing a `-` to the order token: order_by=-created will order by created, but in descending order (newest first) You can chain order tokens together by comma-seperating order tokens: order_by=-created,-popularity This will order the result set by descending creation date, and if two items have the same creation date, sort those by descending popularity. This results in an order that is; "New items first; if created at same time; most popular item first." Each endpoint has it's own list of supported order tokens.