{"_id":"5c097a0265263a0216070bad","user":"5436a1afb7cf0e1c0020d9ca","category":{"_id":"5c097a0265263a0216070b9f","project":"5436a1e1d0ffee0e00f18f8c","__v":2,"version":"5c097a0265263a0216070bd2","pages":["5c097a0265263a0216070baa","5c097a0265263a0216070bab","5c097a0265263a0216070bac","5c097a0265263a0216070bad","5c097a0265263a0216070bae","5c097a0265263a0216070baf","5c097a0265263a0216070bb0","5c097a0265263a0216070bcc"],"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":1,"githubsync":"","version":{"_id":"5c097a0265263a0216070bd2","__v":0,"forked_from":"54cc2148380ecd0d00ca18aa","project":"5436a1e1d0ffee0e00f18f8c","createdAt":"2015-01-31T00:26:48.753Z","releaseDate":"2015-01-31T00:26:48.753Z","categories":["5c097a0265263a0216070b98","5c097a0265263a0216070b99","5c097a0265263a0216070b9a","5c097a0265263a0216070b9b","5c097a0265263a0216070b9c","5c097a0265263a0216070b9d","5c097a0265263a0216070b9e","5c097a0265263a0216070b9f","5c097a0265263a0216070ba0","5c097a0265263a0216070ba1"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.2.0","version":"1.2"},"project":"5436a1e1d0ffee0e00f18f8c","updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-10-30T14:31:18.500Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","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    \"4-0\": \"includes\",\n    \"4-1\": \"Adds information to the response. Specifying includes=products will deliver additional information (if available) about each product in the order.\",\n    \"5-0\": \"order_number\",\n    \"5-1\": \"The external_order_identifier to search for\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\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->findAllByStore(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\"].", "4-0": "includes", "4-1": "Adds information to the response. Specifying includes=products will deliver additional information (if available) about each product in the order.", "5-0": "order_number", "5-1": "The external_order_identifier to search for" }, "cols": 2, "rows": 6 } [/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->findAllByStore(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.