{"action":"created","issue":{"url":"https://api.github.com/repos/openstf/stf/issues/219","repository_url":"https://api.github.com/repos/openstf/stf","labels_url":"https://api.github.com/repos/openstf/stf/issues/219/labels{/name}","comments_url":"https://api.github.com/repos/openstf/stf/issues/219/comments","events_url":"https://api.github.com/repos/openstf/stf/issues/219/events","html_url":"https://github.com/openstf/stf/pull/219","id":124697991,"number":219,"title":"STF REST API (v2.0.0)","user":{"login":"vbanthia","id":7875161,"avatar_url":"https://avatars.githubusercontent.com/u/7875161?v=3","gravatar_id":"","url":"https://api.github.com/users/vbanthia","html_url":"https://github.com/vbanthia","followers_url":"https://api.github.com/users/vbanthia/followers","following_url":"https://api.github.com/users/vbanthia/following{/other_user}","gists_url":"https://api.github.com/users/vbanthia/gists{/gist_id}","starred_url":"https://api.github.com/users/vbanthia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbanthia/subscriptions","organizations_url":"https://api.github.com/users/vbanthia/orgs","repos_url":"https://api.github.com/users/vbanthia/repos","events_url":"https://api.github.com/users/vbanthia/events{/privacy}","received_events_url":"https://api.github.com/users/vbanthia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":19,"created_at":"2016-01-04T05:15:46Z","updated_at":"2016-07-04T18:52:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/openstf/stf/pulls/219","html_url":"https://github.com/openstf/stf/pull/219","diff_url":"https://github.com/openstf/stf/pull/219.diff","patch_url":"https://github.com/openstf/stf/pull/219.patch"},"body":"This PR implements RESTful APIs for STF which will make possible to use STF for test automation.\r\nDetailed discussion can be seen [here](https://github.com/openstf/stf/issues/38)\r\n\r\nIn order to implement APIs, I did following things.\r\n* Created a new api unit\r\n* Used [swagger](http://swagger.io/) to define apis\r\n* Moved all the current apis in app unit to new api unit\r\n* Authorisation using accessToken which can be creating from STF UI. Refer (https://github.com/openstf/stf/pull/190)\r\n\r\nAPI Documentation can be found [here](http://vbanthia.github.io/angular-swagger-ui/)\r\n\r\n### How to use these API's for test automation?\r\nBasic idea behind test automation is by using STF's remote debugging feature. By this feature you can remotely connect STF device to you machine(client). [More about this feature](https://github.com/openstf/stf/wiki/%5Ben%5D-Remote-Debug)\r\n\r\n### How to connect device\r\n1. Get all the devices using `GET /devices/` endpoint. You can also use `fields` query parameter to get only useful information such as `GET /devices?fields=owner,ready`. You can filter the usable device by filtering devices whose `owner==null`\r\n2. Next step will be to request a usable device from STF server. You can do this by sending a POST request to `/user/devices` endpoint with `serial` in request body. Since this request is going to be asynchronous, STF will return you a polling URL. You can use this polling url to check if device is added into your devices (group).\r\n3. Once device is added into your devices(`/user/devices`). You can ask STF server to start remote debugging using `POST /user/devices/{serial}/remoteConnect` endpoint. This will again return a polling url like `/user/devices/{serial}`. You can check if remoteConnect is finished by `GET /user/devices/{serial}?fields=remoteConnect`. If it is true, you can get `remoteDebugUrl` from device information i.e `/user/devices/{serial}?fields=remoteDebugUrl`. After getting this url you can use this url for remote connection and then you can run most of the automated test such as appium, calabash etc.\r\n4. Once test are over, don't forget to disconnect remote debug and release the device by `DELETE /user/devices/{serial}/remoteConnect` and `DELETE /user/devices/{serial}`\r\n\r\n### NOTE\r\nThose who wants to try this branch, they can use `npm install stf@2.0.0-beta` or docker image  `docker pull openstf/stf:v2.0.0-beta`"},"comment":{"url":"https://api.github.com/repos/openstf/stf/issues/comments/230341432","html_url":"https://github.com/openstf/stf/pull/219#issuecomment-230341432","issue_url":"https://api.github.com/repos/openstf/stf/issues/219","id":230341432,"user":{"login":"vbanthia","id":7875161,"avatar_url":"https://avatars.githubusercontent.com/u/7875161?v=3","gravatar_id":"","url":"https://api.github.com/users/vbanthia","html_url":"https://github.com/vbanthia","followers_url":"https://api.github.com/users/vbanthia/followers","following_url":"https://api.github.com/users/vbanthia/following{/other_user}","gists_url":"https://api.github.com/users/vbanthia/gists{/gist_id}","starred_url":"https://api.github.com/users/vbanthia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbanthia/subscriptions","organizations_url":"https://api.github.com/users/vbanthia/orgs","repos_url":"https://api.github.com/users/vbanthia/repos","events_url":"https://api.github.com/users/vbanthia/events{/privacy}","received_events_url":"https://api.github.com/users/vbanthia/received_events","type":"User","site_admin":false},"created_at":"2016-07-04T18:52:35Z","updated_at":"2016-07-04T18:52:35Z","body":"Read this https://github.com/openstf/stf/blob/2.0.0/doc/API.md and use 2.0.0 branch "}}
{"actor":{"display_login":"vbanthia"}}