{"action":"created","issue":{"url":"https://api.github.com/repos/zf-fr/zfr-shopify/issues/56","repository_url":"https://api.github.com/repos/zf-fr/zfr-shopify","labels_url":"https://api.github.com/repos/zf-fr/zfr-shopify/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/zf-fr/zfr-shopify/issues/56/comments","events_url":"https://api.github.com/repos/zf-fr/zfr-shopify/issues/56/events","html_url":"https://github.com/zf-fr/zfr-shopify/issues/56","id":232303546,"number":56,"title":"GetMetafields not working with metafield[owner_id] and metafield[owner_resource]","user":{"login":"jschaedl","id":1880467,"avatar_url":"https://avatars2.githubusercontent.com/u/1880467?v=3","gravatar_id":"","url":"https://api.github.com/users/jschaedl","html_url":"https://github.com/jschaedl","followers_url":"https://api.github.com/users/jschaedl/followers","following_url":"https://api.github.com/users/jschaedl/following{/other_user}","gists_url":"https://api.github.com/users/jschaedl/gists{/gist_id}","starred_url":"https://api.github.com/users/jschaedl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jschaedl/subscriptions","organizations_url":"https://api.github.com/users/jschaedl/orgs","repos_url":"https://api.github.com/users/jschaedl/repos","events_url":"https://api.github.com/users/jschaedl/events{/privacy}","received_events_url":"https://api.github.com/users/jschaedl/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2017-05-30T16:05:36Z","updated_at":"2017-06-26T09:14:01Z","closed_at":"2017-06-26T09:14:01Z","body":"Hi,\r\n\r\nwe are using your library for some time now and it's really awesome. There is only one thing we have experienced lately:\r\nWe have a problem getting metafields using `owner_id` and `owner_resource`. We followed the shopify documentation https://help.shopify.com/api/reference/metafield#index and used the GetMetafields command as follows:\r\n\r\n```\r\n...\r\n$this->shopifyClient = new ShopifyClient([\r\n    'private_app' => true,\r\n    'api_key'     => $apiKey,\r\n    'password'    => $password,\r\n    'shop'        => $storeUrl\r\n]);\r\n...\r\n\r\n$metafields = $this->shopifyClient->getMetafields([\r\n    'metafield[owner_id]' => $shopifyProductId,\r\n    'metafield[owner_resource]' => 'product'\r\n]);\r\n```\r\n\r\nUnfortunately the returned metafields array is always empty. When we call this endpoint with the same query params via postman, a proper metafields list is returned. \r\n\r\nSo we debugged it and found out that guzzle don't append the query params to the uri. The uri should actually look like: [https://your-shopify-url/admin/metafields.json?metafield[owner_id]=10251204676&metafield[owner_resource]=product](https://your-shopify-url/admin/metafields.json?metafield[owner_id]=10251204676&metafield[owner_resource]=product) \r\n\r\nWith this in mind we checked the guzzle service configuration for this endpoint and saw that it defines the metafields parameter as an object: https://github.com/zf-fr/zfr-shopify/blob/master/src/ServiceDescription/Shopify-v1.php#L1922\r\n\r\nSo our question is: How should the criteria array look like to get the metafields? We've already tried the following variants, but none of them worked:\r\n\r\n```\r\n$criteria = [\r\n    'metafield[owner_id]' => $shopifyProductId,\r\n    'metafield[owner_resource]' => 'product'\r\n];\r\n\r\n$criteria = [\r\n    'metafield => [\r\n        'owner_id' => $shopifyProductId,\r\n        'owner_resource' => 'product'\r\n    ]\r\n];\r\n\r\n```\r\nWould be great if you could give us a hint. :-) Thanks a lot!"},"comment":{"url":"https://api.github.com/repos/zf-fr/zfr-shopify/issues/comments/311005651","html_url":"https://github.com/zf-fr/zfr-shopify/issues/56#issuecomment-311005651","issue_url":"https://api.github.com/repos/zf-fr/zfr-shopify/issues/56","id":311005651,"user":{"login":"bakura10","id":1198915,"avatar_url":"https://avatars2.githubusercontent.com/u/1198915?v=3","gravatar_id":"","url":"https://api.github.com/users/bakura10","html_url":"https://github.com/bakura10","followers_url":"https://api.github.com/users/bakura10/followers","following_url":"https://api.github.com/users/bakura10/following{/other_user}","gists_url":"https://api.github.com/users/bakura10/gists{/gist_id}","starred_url":"https://api.github.com/users/bakura10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bakura10/subscriptions","organizations_url":"https://api.github.com/users/bakura10/orgs","repos_url":"https://api.github.com/users/bakura10/repos","events_url":"https://api.github.com/users/bakura10/events{/privacy}","received_events_url":"https://api.github.com/users/bakura10/received_events","type":"User","site_admin":false},"created_at":"2017-06-26T09:14:01Z","updated_at":"2017-06-26T09:14:01Z","body":"In the meantime, I'm closing this issue :)."}}
{"actor":{"display_login":"bakura10"}}