{"action":"created","issue":{"url":"https://api.github.com/repos/abraham/twitteroauth/issues/456","repository_url":"https://api.github.com/repos/abraham/twitteroauth","labels_url":"https://api.github.com/repos/abraham/twitteroauth/issues/456/labels{/name}","comments_url":"https://api.github.com/repos/abraham/twitteroauth/issues/456/comments","events_url":"https://api.github.com/repos/abraham/twitteroauth/issues/456/events","html_url":"https://github.com/abraham/twitteroauth/issues/456","id":146231356,"number":456,"title":"Passing objects as parameters","user":{"login":"johnholtripley","id":1788895,"avatar_url":"https://avatars.githubusercontent.com/u/1788895?v=3","gravatar_id":"","url":"https://api.github.com/users/johnholtripley","html_url":"https://github.com/johnholtripley","followers_url":"https://api.github.com/users/johnholtripley/followers","following_url":"https://api.github.com/users/johnholtripley/following{/other_user}","gists_url":"https://api.github.com/users/johnholtripley/gists{/gist_id}","starred_url":"https://api.github.com/users/johnholtripley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnholtripley/subscriptions","organizations_url":"https://api.github.com/users/johnholtripley/orgs","repos_url":"https://api.github.com/users/johnholtripley/repos","events_url":"https://api.github.com/users/johnholtripley/events{/privacy}","received_events_url":"https://api.github.com/users/johnholtripley/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/abraham/twitteroauth/labels/Explore","name":"Explore","color":"ffea00"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-04-06T08:23:47Z","updated_at":"2016-10-13T18:56:51Z","closed_at":null,"body":"Hi,\r\nFirstly, thanks for creating this - it's been incredibly simple to use.\r\nHowever, I'm having difficulty in passing an object as a parameter for the new alt text support Twitter has introduced.\r\nAccording to https://blog.twitter.com/2016/alt-text-support-for-twitter-cards-and-the-rest-api they want the alt text to be in this format:\r\n`{\r\n  \"media_id\": \"650011250680795136\",\r\n  \"alt_text\": {\r\n    \"text\": \"dancing cat\"\r\n  }\r\n}`\r\nI've tried passing objects, arrays, using json_decode with their example string to get the right format and all sorts, and every time I get `object(stdClass)#7 (2) { [\"request\"]=> string(31) \"/1.1/media/metadata/create.json\" [\"error\"]=> string(21) \"Invalid json payload.\" } ` back.\r\n\r\nCurrently I'm trying:\r\n`$altText = (object) ['text' => 'An image generated in the style of a medieval Herbarium'];\r\n$parameters = [\r\n\t     'alt_text' => $altText, \r\n\t    'media_id' => $media->media_id_string\r\n\t];\r\n$result = $connection->post('media/metadata/create', $parameters);`\r\nbut, as with my other attempts, getting that `invalid json payload` error.\r\n\r\nIs there a way to do this? Am I just doing something wrong?\r\n\r\nMany thanks for any help."},"comment":{"url":"https://api.github.com/repos/abraham/twitteroauth/issues/comments/253605803","html_url":"https://github.com/abraham/twitteroauth/issues/456#issuecomment-253605803","issue_url":"https://api.github.com/repos/abraham/twitteroauth/issues/456","id":253605803,"user":{"login":"agaleski","id":5888843,"avatar_url":"https://avatars.githubusercontent.com/u/5888843?v=3","gravatar_id":"","url":"https://api.github.com/users/agaleski","html_url":"https://github.com/agaleski","followers_url":"https://api.github.com/users/agaleski/followers","following_url":"https://api.github.com/users/agaleski/following{/other_user}","gists_url":"https://api.github.com/users/agaleski/gists{/gist_id}","starred_url":"https://api.github.com/users/agaleski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agaleski/subscriptions","organizations_url":"https://api.github.com/users/agaleski/orgs","repos_url":"https://api.github.com/users/agaleski/repos","events_url":"https://api.github.com/users/agaleski/events{/privacy}","received_events_url":"https://api.github.com/users/agaleski/received_events","type":"User","site_admin":false},"created_at":"2016-10-13T18:56:51Z","updated_at":"2016-10-13T18:56:51Z","body":"The desired result:\r\n```\r\n{\"media_id\":\"123456789\",\"alt_text\":{\"text\":\"dancing cat\"}}`\r\n```\r\nequals:\r\n```\r\njson_encode(array(\r\n    'media_id' => '123456789', \r\n    'alt_text' => array(\r\n        'text' => 'dancing cat'\r\n    )\r\n))\r\n```\r\n\r\nSo your example should look like:\r\n```\r\n$altText = (object) ['text' => 'An image generated in the style of a medieval Herbarium']; \r\n$parameters = [\r\n    'media_id' => $media->media_id_string,\r\n    'alt_text' => [\r\n        'text' => 'An image generated in the style of a medieval Herbarium'\r\n    ]\r\n];\r\n$result = $connection->post('media/metadata/create', $parameters);\r\n```\r\n\r\nHave not had the time to try it so far. Hope it helps.\r\n"}}
{"actor":{"display_login":"agaleski"}}