{"action":"created","issue":{"url":"https://api.github.com/repos/tcdent/php-restclient/issues/11","labels_url":"https://api.github.com/repos/tcdent/php-restclient/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/tcdent/php-restclient/issues/11/comments","events_url":"https://api.github.com/repos/tcdent/php-restclient/issues/11/events","html_url":"https://github.com/tcdent/php-restclient/issues/11","id":122825148,"number":11,"title":"Post Json format","user":{"login":"bobhsr","id":1159196,"avatar_url":"https://avatars.githubusercontent.com/u/1159196?v=3","gravatar_id":"","url":"https://api.github.com/users/bobhsr","html_url":"https://github.com/bobhsr","followers_url":"https://api.github.com/users/bobhsr/followers","following_url":"https://api.github.com/users/bobhsr/following{/other_user}","gists_url":"https://api.github.com/users/bobhsr/gists{/gist_id}","starred_url":"https://api.github.com/users/bobhsr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobhsr/subscriptions","organizations_url":"https://api.github.com/users/bobhsr/orgs","repos_url":"https://api.github.com/users/bobhsr/repos","events_url":"https://api.github.com/users/bobhsr/events{/privacy}","received_events_url":"https://api.github.com/users/bobhsr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-17T21:19:07Z","updated_at":"2015-12-17T22:26:22Z","closed_at":null,"body":"There is POST method that has not been working.\r\n\r\nThis is sample CURL example at the service.\r\n\r\n{\"email\": \"sam@email.com\", \"items\": [{ \"name\": \"api Name\", \"quantity\": 10, \"unit_price\": 2}, { \"name\": \"api 2\", \"quantity\": \"4\", \"unit_price\": 3 }] \r\n\r\n}\r\n\r\nHave the tried the following.\r\n\r\n$data = array(\r\n        'email' => 'john@dow.com', \r\n        );\r\n$data['items'] = array(\r\n        'name' => 'fruits', 'quantity' => 4,\r\n         'unit_price' => 7,\r\n        );\r\n\r\n$data2 = array(\r\n            'email' => 'john@dow.com', 'currency' => 'USD',\r\n            'country' => 'US', 'billing_first_name' => 'John',\r\n            // 'items' => '',\r\n            'items' =>  array(\r\n            0 => array(\r\n                'unit_price' => 10.00, \r\n                'name' => 'item1',\r\n                'quantity' => 15\r\n                ),\r\n            1 => array(\r\n                'unit_price' => 34.00, \r\n                'name' => 'item2', \r\n                'quantity' => 42\r\n                )\r\n            )\r\n\r\n            );\r\n\r\n$result = $api->post('invoice/', $data,\r\n            array('Content-Type' => 'application/json'));\r\n\r\nThe service just accepts email, and ignores items."},"comment":{"url":"https://api.github.com/repos/tcdent/php-restclient/issues/comments/165600717","html_url":"https://github.com/tcdent/php-restclient/issues/11#issuecomment-165600717","issue_url":"https://api.github.com/repos/tcdent/php-restclient/issues/11","id":165600717,"user":{"login":"tcdent","id":54419,"avatar_url":"https://avatars.githubusercontent.com/u/54419?v=3","gravatar_id":"","url":"https://api.github.com/users/tcdent","html_url":"https://github.com/tcdent","followers_url":"https://api.github.com/users/tcdent/followers","following_url":"https://api.github.com/users/tcdent/following{/other_user}","gists_url":"https://api.github.com/users/tcdent/gists{/gist_id}","starred_url":"https://api.github.com/users/tcdent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tcdent/subscriptions","organizations_url":"https://api.github.com/users/tcdent/orgs","repos_url":"https://api.github.com/users/tcdent/repos","events_url":"https://api.github.com/users/tcdent/events{/privacy}","received_events_url":"https://api.github.com/users/tcdent/received_events","type":"User","site_admin":false},"created_at":"2015-12-17T22:26:22Z","updated_at":"2015-12-17T22:26:22Z","body":"I believe you just need to call `json_encode` on your `$data` array.\r\n\r\nYour execution could look like this (untested):\r\n\r\n```\r\n$result = $api->post('invoice/', json_encode($data), array('Content-Type' => 'application/json'));\r\n```"}}