{"action":"closed","issue":{"url":"https://api.github.com/repos/woocommerce/wc-api-php/issues/60","repository_url":"https://api.github.com/repos/woocommerce/wc-api-php","labels_url":"https://api.github.com/repos/woocommerce/wc-api-php/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/woocommerce/wc-api-php/issues/60/comments","events_url":"https://api.github.com/repos/woocommerce/wc-api-php/issues/60/events","html_url":"https://github.com/woocommerce/wc-api-php/issues/60","id":186063924,"number":60,"title":"No product data specified to create product [woocommerce_api_missing_product_data]","user":{"login":"abhishekdeshkar","id":22673306,"avatar_url":"https://avatars.githubusercontent.com/u/22673306?v=3","gravatar_id":"","url":"https://api.github.com/users/abhishekdeshkar","html_url":"https://github.com/abhishekdeshkar","followers_url":"https://api.github.com/users/abhishekdeshkar/followers","following_url":"https://api.github.com/users/abhishekdeshkar/following{/other_user}","gists_url":"https://api.github.com/users/abhishekdeshkar/gists{/gist_id}","starred_url":"https://api.github.com/users/abhishekdeshkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhishekdeshkar/subscriptions","organizations_url":"https://api.github.com/users/abhishekdeshkar/orgs","repos_url":"https://api.github.com/users/abhishekdeshkar/repos","events_url":"https://api.github.com/users/abhishekdeshkar/events{/privacy}","received_events_url":"https://api.github.com/users/abhishekdeshkar/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-29T07:01:04Z","updated_at":"2016-11-03T18:37:26Z","closed_at":"2016-11-03T18:37:26Z","body":"Hello,\nI'm not sure if this is the right place to post this issue but I think this is the right place. Well, I have downloaded latest repository of woocommerce php API. I have been following woocommerce REST API Docs to create a test product. I have copied the sample from their documentation but it is not working. Here is my code.\n\nAPI docs : http://woocommerce.github.io/woocommerce-rest-api-docs/?php#create-a-product\n\n```\n<?php\n\nrequire_once(\"vendor/autoload.php\");\n\nuse Automattic\\WooCommerce\\Client;\n\n$woocommerce = new Client(\n    'http://wocom.dev', \n    'ck_c62182de9983593c9da6ed5c4642ff50e79e1b4f', \n    'cs_8f69a9d588abb9ca1b0309f22ac2cd7841496d56',\n    [\n        'version' => 'v3',\n        'ssl_verify'=> 'false',\n        'timeout' => 30000\n    ]\n);\n\n\n\n$data = [\n    'name' => 'Ship Your Idea',\n    'type' => 'variable',\n    'description' => 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.',\n    'short_description' => 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.',\n    'categories' => [\n        [\n            'id' => 9\n        ],\n        [\n            'id' => 14\n        ]\n    ],\n    'images' => [\n        [\n            'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_4_front.jpg',\n            'position' => 0\n        ],\n        [\n            'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_4_back.jpg',\n            'position' => 1\n        ],\n        [\n            'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_3_front.jpg',\n            'position' => 2\n        ],\n        [\n            'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_3_back.jpg',\n            'position' => 3\n        ]\n    ],\n    'attributes' => [\n        [\n            'id' => 6,\n            'position' => 0,\n            'visible' => false,\n            'variation' => true,\n            'options' => [\n                'Black',\n                'Green'\n            ]\n        ],\n        [\n            'name' => 'Size',\n            'position' => 0,\n            'visible' => true,\n            'variation' => true,\n            'options' => [\n                'S',\n                'M'\n            ]\n        ]\n    ],\n    'default_attributes' => [\n        [\n            'id' => 6,\n            'option' => 'Black'\n        ],\n        [\n            'name' => 'Size',\n            'option' => 'S'\n        ]\n    ],\n    'variations' => [\n        [\n            'regular_price' => '19.99',\n            'image' => [\n                [\n                    'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_4_front.jpg',\n                    'position' => 0\n                ]\n            ],\n            'attributes' => [\n                [\n                    'id' => 6,\n                    'option' => 'black'\n                ],\n                [\n                    'name' => 'Size',\n                    'option' => 'S'\n                ]\n            ]\n        ],\n        [\n            'regular_price' => '19.99',\n            'image' => [\n                [\n                    'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_3_front.jpg',\n                    'position' => 0\n                ]\n            ],\n            'attributes' => [\n                [\n                    'id' => 6,\n                    'option' => 'green'\n                ],\n                [\n                    'name' => 'Size',\n                    'option' => 'M'\n                ]\n            ]\n        ]\n    ]\n];\n\n\n\n\ntry\n{\n    print_r($woocommerce->post('products', $data));\n\n}\ncatch(Exception $e)\n{\n    echo $e->getMessage();\n}\n```\n\nError : \n\n```\nError: No product data specified to create product [woocommerce_api_missing_product_data]\n```\n"}}
{"actor":{"display_login":"claudiosanches"}}