{"action":"created","issue":{"url":"https://api.github.com/repos/J7mbo/twitter-api-php/issues/109","labels_url":"https://api.github.com/repos/J7mbo/twitter-api-php/issues/109/labels{/name}","comments_url":"https://api.github.com/repos/J7mbo/twitter-api-php/issues/109/comments","events_url":"https://api.github.com/repos/J7mbo/twitter-api-php/issues/109/events","html_url":"https://github.com/J7mbo/twitter-api-php/pull/109","id":70760706,"number":109,"title":"Fix for failing POST methods","user":{"login":"glenscott","id":124257,"avatar_url":"https://avatars.githubusercontent.com/u/124257?v=3","gravatar_id":"","url":"https://api.github.com/users/glenscott","html_url":"https://github.com/glenscott","followers_url":"https://api.github.com/users/glenscott/followers","following_url":"https://api.github.com/users/glenscott/following{/other_user}","gists_url":"https://api.github.com/users/glenscott/gists{/gist_id}","starred_url":"https://api.github.com/users/glenscott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glenscott/subscriptions","organizations_url":"https://api.github.com/users/glenscott/orgs","repos_url":"https://api.github.com/users/glenscott/repos","events_url":"https://api.github.com/users/glenscott/events{/privacy}","received_events_url":"https://api.github.com/users/glenscott/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/J7mbo/twitter-api-php/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/J7mbo/twitter-api-php/labels/fix","name":"fix","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/J7mbo/twitter-api-php/milestones/1","html_url":"https://github.com/J7mbo/twitter-api-php/milestones/1.0.0","labels_url":"https://api.github.com/repos/J7mbo/twitter-api-php/milestones/1/labels","id":1094632,"number":1,"title":"1.0.0","description":null,"creator":{"login":"J7mbo","id":2657310,"avatar_url":"https://avatars.githubusercontent.com/u/2657310?v=3","gravatar_id":"","url":"https://api.github.com/users/J7mbo","html_url":"https://github.com/J7mbo","followers_url":"https://api.github.com/users/J7mbo/followers","following_url":"https://api.github.com/users/J7mbo/following{/other_user}","gists_url":"https://api.github.com/users/J7mbo/gists{/gist_id}","starred_url":"https://api.github.com/users/J7mbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/J7mbo/subscriptions","organizations_url":"https://api.github.com/users/J7mbo/orgs","repos_url":"https://api.github.com/users/J7mbo/repos","events_url":"https://api.github.com/users/J7mbo/events{/privacy}","received_events_url":"https://api.github.com/users/J7mbo/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2015-05-04T08:01:48Z","updated_at":"2015-05-04T08:01:48Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-04-24T18:24:11Z","updated_at":"2015-05-04T12:19:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/J7mbo/twitter-api-php/pulls/109","html_url":"https://github.com/J7mbo/twitter-api-php/pull/109","diff_url":"https://github.com/J7mbo/twitter-api-php/pull/109.diff","patch_url":"https://github.com/J7mbo/twitter-api-php/pull/109.patch"},"body":"Previously, trying to add or remove a user from a list failed with an error\r\n\r\n````\r\n{\"errors\":[{\"code\":112,\"message\":\"You must specify either a list ID or a slug and owner.\"}]}\r\n````\r\n\r\nThis was despite passing both slug and owner as parameters to the `setPostFields` method.\r\n\r\nAfter a lot of experimentation, it turns out that these endpoints required the data to be sent as `application/x-www-form-urlencoded` rather than `multipart/form-data` for the parameters to be recogised.\r\n\r\nHowever, fixing this threw up another problem:  I was now receiving this error for both endpoints:\r\n\r\n````\r\n{\"errors\":[{\"code\":32,\"message\":\"Could not authenticate you.\"}]}\r\n````\r\n\r\nIt turns out that the POST parameters were not being correctly used to assemble the oAuth base string which is required for authenticated requests.\r\n\r\nThis pull request fixes both of these issues.\r\n\r\nOne thing to note, because of the change, you _must_ call `setPostFields` *before* the `buildOauth` method like this:\r\n\r\n````\r\n        $json = $twitter\r\n                ->setPostfields( $postFields )\r\n                ->buildOauth( $url, $requestMethod )\r\n                ->performRequest();\r\n\r\n````\r\n"},"comment":{"url":"https://api.github.com/repos/J7mbo/twitter-api-php/issues/comments/98690913","html_url":"https://github.com/J7mbo/twitter-api-php/pull/109#issuecomment-98690913","issue_url":"https://api.github.com/repos/J7mbo/twitter-api-php/issues/109","id":98690913,"user":{"login":"J7mbo","id":2657310,"avatar_url":"https://avatars.githubusercontent.com/u/2657310?v=3","gravatar_id":"","url":"https://api.github.com/users/J7mbo","html_url":"https://github.com/J7mbo","followers_url":"https://api.github.com/users/J7mbo/followers","following_url":"https://api.github.com/users/J7mbo/following{/other_user}","gists_url":"https://api.github.com/users/J7mbo/gists{/gist_id}","starred_url":"https://api.github.com/users/J7mbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/J7mbo/subscriptions","organizations_url":"https://api.github.com/users/J7mbo/orgs","repos_url":"https://api.github.com/users/J7mbo/repos","events_url":"https://api.github.com/users/J7mbo/events{/privacy}","received_events_url":"https://api.github.com/users/J7mbo/received_events","type":"User","site_admin":false},"created_at":"2015-05-04T12:19:57Z","updated_at":"2015-05-04T12:19:57Z","body":"I've been taking a look at this today. I pulled your branch and I've been working on it [here](https://github.com/J7mbo/twitter-api-php/tree/glenscott-master). I also added some tests.\r\n\r\nWith all these changes, we still are having issues with `media/upload` which I was rather hoping this PR would address. The small change seems to be `form/multipart` as a header but adding that makes no difference. Here's the [failing test](https://github.com/J7mbo/twitter-api-php/blob/glenscott-master/test/TwitterAPIExchangeTest.php#L178).\r\n\r\nIf we can work on getting this sorted too, I'll happily merge the PR as it'll have fixed the failing POST methods... and we can add more tests for each endpoint to prove it works."}}