{"_id":"54cc2149380ecd0d00ca18bf","user":"5436a1afb7cf0e1c0020d9ca","category":{"_id":"54cc2149380ecd0d00ca18b2","project":"5436a1e1d0ffee0e00f18f8c","__v":2,"version":"54cc2148380ecd0d00ca18aa","pages":["54cc2149380ecd0d00ca18bc","54cc2149380ecd0d00ca18bd","54cc2149380ecd0d00ca18be","54cc2149380ecd0d00ca18bf","54cc2149380ecd0d00ca18c0","54cc2149380ecd0d00ca18c1","54cc2149380ecd0d00ca18c2","55cbcc534cf2180d00bb1bf4"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-30T14:26:30.616Z","from_sync":false,"order":7,"slug":"php-client","title":"PHP client"},"parentDoc":null,"__v":0,"version":{"_id":"54cc2148380ecd0d00ca18aa","__v":2,"forked_from":"5436a1e1d0ffee0e00f18f8f","project":"5436a1e1d0ffee0e00f18f8c","createdAt":"2015-01-31T00:26:48.753Z","releaseDate":"2015-01-31T00:26:48.753Z","categories":["54cc2149380ecd0d00ca18ab","54cc2149380ecd0d00ca18ac","54cc2149380ecd0d00ca18ad","54cc2149380ecd0d00ca18ae","54cc2149380ecd0d00ca18af","54cc2149380ecd0d00ca18b0","54cc2149380ecd0d00ca18b1","54cc2149380ecd0d00ca18b2","54cc2149380ecd0d00ca18b3","552f29ca633a5b0d00e99d09"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.1.0","version":"1.1"},"project":"5436a1e1d0ffee0e00f18f8c","updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-10-30T14:31:18.500Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"never","params":[],"url":""},"isReference":false,"order":3,"body":"To retrieve multiple orders, call the `findAll()` method on the Order resource class.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$order = new ShippingEasy_Order();\\n$order->findAll();\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\nIf successful the call will return a JSON hash included an array of orders and a hash metadata detailing the conditions used in the search as well as pagination details regarding the response.\n\n## Filtering Parameters\n[block:parameters]\n{\n  \"data\": {\n    \"3-0\": \"status\",\n    \"2-0\": \"last_updated_at\",\n    \"1-0\": \"per_page\",\n    \"0-0\": \"page\",\n    \"0-1\": \"*Integer*\\n\\nThe page to return in the paginated result set.\",\n    \"1-1\": \"*Integer*\\n\\nThe number of result to include per pagein the paginated result set. Defaults to 50 if not specified and the maximum number of results returned per page is 200.\",\n    \"2-1\": \"*Datetime*\\n\\nFilters the results by the orders' last updated at timestamp and only returns results with a timestamp newer than or equal to the specified value. Defaults to 1 week ago if not specified. The maxiumum time this value can be set to is 3 months ago.\",\n    \"3-1\": \"*String* or *Array*\\n\\nFilters the results by the orders' ShippingEasy order status. Defaults to \\\"shipped\\\". Possible values are \\\"shipped\\\" , \\\"cleared\\\", and \\\"ready_for_shipment\\\". It is possible to pass an array of statuses, e.g. [\\\"shipping\\\", \\\"ready_for_shipment\\\"].\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n## Filtering Example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$order = new ShippingEasy_Order();\\n$order->findAll(array(\\\"page\\\" => 1, \\\"per_page\\\" => 1, \\\"status\\\" => array(\\\"ready_for_shipment\\\", \\\"shipped\\\"), \\\"last_updated_at\\\" => \\\"2014-05-07 14:42:18 UTC\\\"));\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\nAn example JSON response may be found here:\n\nhttps://gist.github.com/twmills/005b3c4ab9c85330a801\n\n## Filtering by Store Example\n\nIf you would like to filter your results to a specific store, initialize your object with the store api key:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$order = new ShippingEasy_Order(\\\"d8821dde1d32f408def40b77273d5c11\\\");\\n$order->findAll(array(\\\"page\\\" => 1, \\\"per_page\\\" => 1, \\\"status\\\" => array(\\\"ready_for_shipment\\\", \\\"shipped\\\"), \\\"last_updated_at\\\" => \\\"2014-05-07 14:42:18 UTC\\\"));\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Possible Exceptions\"\n}\n[/block]\n## ShippingEasy_AuthenticationError\nYour credentials could not be authenticated.\n\n## ShippingEasy_InvalidRequestError\nThe orders retrieved for one or more of the following reasons:\n\n* The API timestamp could not be parsed.\n\nThe exception will contain a message that indicates which of these conditions failed.","excerpt":"","slug":"php-retrieving-multiple-orders","type":"basic","title":"Retrieving multiple orders"}

Retrieving multiple orders


To retrieve multiple orders, call the `findAll()` method on the Order resource class. [block:code] { "codes": [ { "code": "$order = new ShippingEasy_Order();\n$order->findAll();", "language": "php" } ] } [/block] If successful the call will return a JSON hash included an array of orders and a hash metadata detailing the conditions used in the search as well as pagination details regarding the response. ## Filtering Parameters [block:parameters] { "data": { "3-0": "status", "2-0": "last_updated_at", "1-0": "per_page", "0-0": "page", "0-1": "*Integer*\n\nThe page to return in the paginated result set.", "1-1": "*Integer*\n\nThe number of result to include per pagein the paginated result set. Defaults to 50 if not specified and the maximum number of results returned per page is 200.", "2-1": "*Datetime*\n\nFilters the results by the orders' last updated at timestamp and only returns results with a timestamp newer than or equal to the specified value. Defaults to 1 week ago if not specified. The maxiumum time this value can be set to is 3 months ago.", "3-1": "*String* or *Array*\n\nFilters the results by the orders' ShippingEasy order status. Defaults to \"shipped\". Possible values are \"shipped\" , \"cleared\", and \"ready_for_shipment\". It is possible to pass an array of statuses, e.g. [\"shipping\", \"ready_for_shipment\"]." }, "cols": 2, "rows": 4 } [/block] ## Filtering Example [block:code] { "codes": [ { "code": "$order = new ShippingEasy_Order();\n$order->findAll(array(\"page\" => 1, \"per_page\" => 1, \"status\" => array(\"ready_for_shipment\", \"shipped\"), \"last_updated_at\" => \"2014-05-07 14:42:18 UTC\"));", "language": "php" } ] } [/block] An example JSON response may be found here: https://gist.github.com/twmills/005b3c4ab9c85330a801 ## Filtering by Store Example If you would like to filter your results to a specific store, initialize your object with the store api key: [block:code] { "codes": [ { "code": "$order = new ShippingEasy_Order(\"d8821dde1d32f408def40b77273d5c11\");\n$order->findAll(array(\"page\" => 1, \"per_page\" => 1, \"status\" => array(\"ready_for_shipment\", \"shipped\"), \"last_updated_at\" => \"2014-05-07 14:42:18 UTC\"));", "language": "php" } ] } [/block] [block:api-header] { "type": "basic", "title": "Possible Exceptions" } [/block] ## ShippingEasy_AuthenticationError Your credentials could not be authenticated. ## ShippingEasy_InvalidRequestError The orders retrieved for one or more of the following reasons: * The API timestamp could not be parsed. The exception will contain a message that indicates which of these conditions failed.