{"action":"created","issue":{"url":"https://api.github.com/repos/woothemes/woocommerce/issues/8561","labels_url":"https://api.github.com/repos/woothemes/woocommerce/issues/8561/labels{/name}","comments_url":"https://api.github.com/repos/woothemes/woocommerce/issues/8561/comments","events_url":"https://api.github.com/repos/woothemes/woocommerce/issues/8561/events","html_url":"https://github.com/woothemes/woocommerce/issues/8561","id":94477224,"number":8561,"title":"/wc-api/v2/customers/<ID>/orders fails to recognise a valid customer ID","user":{"login":"gtawebb","id":2797452,"avatar_url":"https://avatars.githubusercontent.com/u/2797452?v=3","gravatar_id":"","url":"https://api.github.com/users/gtawebb","html_url":"https://github.com/gtawebb","followers_url":"https://api.github.com/users/gtawebb/followers","following_url":"https://api.github.com/users/gtawebb/following{/other_user}","gists_url":"https://api.github.com/users/gtawebb/gists{/gist_id}","starred_url":"https://api.github.com/users/gtawebb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtawebb/subscriptions","organizations_url":"https://api.github.com/users/gtawebb/orgs","repos_url":"https://api.github.com/users/gtawebb/repos","events_url":"https://api.github.com/users/gtawebb/events{/privacy}","received_events_url":"https://api.github.com/users/gtawebb/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2015-07-11T14:11:51Z","updated_at":"2015-07-14T11:07:08Z","closed_at":"2015-07-12T15:46:32Z","body":"When I call:\r\n\r\n/wc-api/v2/customers/172/orders\r\n\r\nI get the following error response:\r\n\r\n{\"errors\":[{\"code\":\"woocommerce_api_invalid_customer_id\",\"message\":\"Invalid customer ID\"}]}\r\n\r\nBut when I call:\r\n\r\n/wc-api/v2/customers\r\n\r\nIt shows that the customer ID does exists:\r\n\r\n{\"customers\":[{\"id\":172,\"created_at\":\"2015-07-10T17:32:40Z\",\"email\":\"support@xxx.com\",\"first_name\":\"\",\"last_name\":\"\",\"username\":\"support\",\"role\":\"customer\",\"last_order_id\":\"1723\",\"last_order_date\":\"2015-07-11T10:51:27Z\",\"orders_count\":4,\"total_spent\":\"12.00\",\"avatar_url\":\"https:\\/\\/2.gravatar.com\\/avatar\\/?s=96\",\"billing_address\":{\"first_name\":\"G\",\"last_name\":\"W\",\"company\":\"\",\"address_1\":\"1 impasse grande terre\",\"address_2\":\"\",\"city\":\"xx\",\"state\":\"\",\"postcode\":\"xx\",\"country\":\"FR\",\"email\":\"support@xxx.com\",\"phone\":\"1234567\"},\"shipping_address\":{\"first_name\":\"\",\"last_name\":\"\",\"company\":\"\",\"address_1\":\"\",\"address_2\":\"\",\"city\":\"\",\"state\":\"\",\"postcode\":\"\",\"country\":\"\"}}]}\r\n\r\nThe customer ID exists and it has made orders but I'm unable to access the customer orders via the /wc-api/v2/customers/<ID>/orders API call which is a major blocker for me, it just returns an invalid customer error."},"comment":{"url":"https://api.github.com/repos/woothemes/woocommerce/issues/comments/121202349","html_url":"https://github.com/woothemes/woocommerce/issues/8561#issuecomment-121202349","issue_url":"https://api.github.com/repos/woothemes/woocommerce/issues/8561","id":121202349,"user":{"login":"gtawebb","id":2797452,"avatar_url":"https://avatars.githubusercontent.com/u/2797452?v=3","gravatar_id":"","url":"https://api.github.com/users/gtawebb","html_url":"https://github.com/gtawebb","followers_url":"https://api.github.com/users/gtawebb/followers","following_url":"https://api.github.com/users/gtawebb/following{/other_user}","gists_url":"https://api.github.com/users/gtawebb/gists{/gist_id}","starred_url":"https://api.github.com/users/gtawebb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtawebb/subscriptions","organizations_url":"https://api.github.com/users/gtawebb/orgs","repos_url":"https://api.github.com/users/gtawebb/repos","events_url":"https://api.github.com/users/gtawebb/events{/privacy}","received_events_url":"https://api.github.com/users/gtawebb/received_events","type":"User","site_admin":false},"created_at":"2015-07-14T11:07:08Z","updated_at":"2015-07-14T11:07:08Z","body":"I've added some debugging to \r\nI've added some debugging to woocommerce/includes/api/class-wc-api-customers.php line 708 and it seems that $id is being read as 'orders' instead of the id number. Maybe this gives a clue?\r\n\r\n\r\n      protected function validate_request( $id, $type, $context ) {\r\n\r\n\t\ttry {\r\n\t\t\tthrow new WC_API_Exception( 'woocommerce_api_invalid_customer_id'.'$id='.$id, __( 'Invalid customer ID', 'woocommerce' ), 404 );\r\n\t\t\t$id = absint( $id );\r\n\r\nOutput = {\"errors\":[{\"code\":\"woocommerce_api_invalid_customer_id$id=orders\",\"message\":\"Invalid customer ID\"}]}\r\n\r\nNotice the value of $id that I've added to the above forced error.\r\n\r\n"}}