Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

The Powerful and Comprehensive API for Mobile App Development and Testing

2,571 views

Published on

Watch a live presentation at http://offer.bitbar.com/the-powerful-and-comprehensive-api-for-mobile-app-development-and-testing

Testdroid provides a very powerful and useful API for its users to manage all aspects of mobile development and testing automatically. This powerful API caters your needs to instantly access our device farm, manage your projects, your test runs and results, plus many other things that will make your mobile app, game and web testing smoother, faster and less stressful on real Android and iOS devices.

Stay tuned and join our upcoming webinars at http://bitbar.com/testing/webinars/

Published in: Technology
  • Be the first to comment

The Powerful and Comprehensive API for Mobile App Development and Testing

  1. 1. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 1 20 January 2015 Ville-Veikko Helppi Technical Product Manager ville-veikko.helppi@bitbar.com The Powerful and Comprehensive API for Mobile App Development and Testing W E B I N A R
  2. 2. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 2 Agenda • The Characteristics of Great API • The Basics of Communication Mechanisms • Three Categories for API Usage – Authentication (security) – Managing Projects – Getting Results • Hands-on Example (cURL) • Additional resources • Q&A
  3. 3. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 3 The Characteristics of Great Application Programming Interface
  4. 4. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 4 • The way to integrate (different) systems • The way to expose/transport data easily, automatically and instantly • Modular, scalable and versatile API calls • Great standards – REST(ful) / JSON / OAuth etc. • Security – No manual hassling – all communications through API Why API?
  5. 5. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 5 • Easy to learn, easy to use, hard to misuse • Easy to read, maintain, extend • Appropriate for every user – Some people can configure/create access, some only need to use • Provides all features than can be done also manually • Versatile API backs up test automation approach and complements Agile process Characteristics of Great API
  6. 6. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 6 APIs Are Not Only for Services!
  7. 7. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 7 The Manual Flow Application Results Logs, outputs, data Screenshots
  8. 8. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 8 Access Devices via API Development environments and tools Real Mobile Devices (hundreds of) Data; Results, Screenshots & Logs Automatic, instant upload on devices
  9. 9. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 9 The Basics of Communication Mechanisms
  10. 10. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 10 For example: GET /oauth/token?client_id=testdroid-cloud- api&grant_type=password&username=example@bitbar.co m&password=P4s$w0rd&parameters=more The Basics
  11. 11. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 11 GET: fetch an existing resource. The URL contains all the necessary information the server needs to locate and return the resource. POST: create a new resource. POST requests usually carry a payload that specifies the data for the new resource. PUT: update an existing resource. The payload may contain the updated data for the resource. DELETE: delete an existing resource. The Basics - Verbs
  12. 12. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 12 Requests and Responses
  13. 13. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 13 2xx: Successful 202 Accepted: the request was accepted but may not include the resource in the response. 204 No Content: there is no message body in the response. 205 Reset Content: indicates to the client to reset its document view. 206 Partial Content: indicates that the response only contains partial content. 3xx: Redirection 301 Moved Permanently: the resource is now located at a new URL. 303 See Other: the resource is temporarily located at a new URL. The Location response header contains the temporary URL. 304 Not Modified: the server has determined that the resource has not changed and the client should use its cached copy. The Basics – Error Codes
  14. 14. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 14 4xx: Client Error 400 Bad Request: the request was malformed. 401 Unauthorized: request requires authentication. The client can repeat the request with the Authorization header. 403 Forbidden: server has denied access to the resource. 405 Method Not Allowed: invalid HTTP verb used in the request line, or the server does not support that verb. 409 Conflict: the server could not complete the request because the client is trying to modify a resource that is newer than the client's timestamp. 5xx: Server Error 501 Not Implemented: the server does not yet support the requested functionality. 503 Service Unavailable: this could happen if an internal system on the server has failed or the server is overloaded. The Basics – Error Codes
  15. 15. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 15 Access via Comprehensive API
  16. 16. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 16 • Authentication • Project Management – Create, Delete, Configure, Managing Users • Configuring Access and Assets – Configs, Upload/Download Files (App & Tests) – Device Access & Device Group Configuration • Running Tests – Upload App + Tests <-> Download Results/Data – Notifications, Sharing, Pre-processing of Data Access via Comprehensive API
  17. 17. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 17 Authentication
  18. 18. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 18 Authentication
  19. 19. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 19 Authentication
  20. 20. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 20 SEND Header=Accept: application/json client_id=testdroid_cloud_api grant_type=password username=email@address.com password=XXXXXXXX CURL: curl -X POST -H "Accept: application/json" -d "client_id=testdroid-cloud- api&grant_type=password&username=email@address.com& password=XXXXXXXX" https://cloud.testdroid.com/oauth/token Authentication
  21. 21. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 21 Projects and Managing Those via API
  22. 22. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 22 Get List of Projects
  23. 23. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 23 Get List of Projects
  24. 24. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 24 Get List of Projects SEND Header=Accept: application/json Authorization: Bearer <ACCESS_TOKEN> CURL: curl -H “Accept: application/json” -H “Authorization: Bearer <ACCESS- TOKEN>” https://cloud.testdroid.com/api/v2/me/projects or curl –H "Accept: application/json" "https://cloud.testdroid.com/api/v2/me/projects?access_token=<ACCES S-TOKEN>"
  25. 25. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 25 Create a Project
  26. 26. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 26 Create a Project
  27. 27. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 27 SEND Header=Accept: application/json Authorization: Bearer <ACCESS_TOKEN> name=name of new project CURL: curl -X POST -d "name=NewProject" -H "Authorization: Bearer fac84a04-feb0-42ed-a810-6d859e43c123" https://cloud.testdroid.com/api/v2/me/projects or curl -X POST -d "name=NewProject2” “https://cloud.testdroid.com/api/v2/me/projects?access_token=<ACCES S-TOKEN>" Create a Project
  28. 28. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 28 Update a Project
  29. 29. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 29 Update a Project
  30. 30. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 30 CURL: curl -X POST -d "projectId=75013784&name=NewName&description= Something&common=false" -H "Authorization: Bearer 5f5c3ad0-1f70-4435- ae4f-ec2a9d20a985" https://cloud.testdroid.com/api/v2/me/projects/75013784 or curl -X POST -d "projectId=75013784&name=NewName&description= Something&common=false" "https://cloud.testdroid.com/api/v2/me/projects/75013784?access_token=38 f57e00-a2f7-40d0-bdc2-e041b95ff43e" Update a Project
  31. 31. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 31 Upload an App
  32. 32. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 32 Upload an App
  33. 33. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 33 CURL: curl -F file=@"filename.apk" "https://cloud.testdroid.com/api/v2/me/projects/<PROJECTNUMBER>/fi les/application?access_token=<ACCESS-TOKEN>" Upload an App
  34. 34. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 34 Start a New Test Run
  35. 35. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 35 Start a New Test Run
  36. 36. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 36 CURL: curl -X POST -d “projectId=<PROJECTID>&name=<NAME OF NEW TEST RUN>” “https://cloud.testdroid.com/api/v2/me/projects/<PROJECTID>/runs?ac cess_token=<ACCESS-TOKEN>" Upload an App
  37. 37. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 37 Upload w/Python
  38. 38. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 38 Get Results from Testdroid Cloud via API
  39. 39. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 39 Get Details of Test Run
  40. 40. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 40 Get Details of Test Run
  41. 41. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 41 CURL: curl -H "Accept: application/json" https://cloud.testdroid.com/api/v2/me/projects/<PROJECTID>/runs/<TE STRUNID>/device-runs?access_token=<ACCESS-TOKEN> Get Details of Test Run
  42. 42. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 42 Get Device Run Logs
  43. 43. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 43 Get Device Run Logs
  44. 44. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 44 CURL: curl -H "Accept: application/json" https://cloud.testdroid.com/api/v2/me/projects/<PROJECTID>/runs/<TE STRUNID>/device-runs/<DEVICEID>/logs?access_token=<ACCESS- TOKEN> > log.txt Get Device Run Logs
  45. 45. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 45 Get Device Run Performance
  46. 46. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 46 Get Device Run Performance
  47. 47. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 47 CURL: curl -H "Accept: application/json" https://cloud.testdroid.com/api/v2/me/projects/<PROJECTID>/runs/<TE STRUNID>/device- runs/<DEVICEID>/performance?access_token=<ACCESS-TOKEN> > log.txt Get Device Run Performance
  48. 48. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 48 Get Screenshots
  49. 49. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 49 Get Screenshots
  50. 50. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 50 CURL: (List of screenshots) curl -H "Accept: application/json" https://cloud.testdroid.com/api/v2/me/projects/<PROJECTID>/runs/<TE STRUNID>/device- runs/<DEVICEID>/screenshots?access_token=<ACCESS-TOKEN> (Specific Screenshot) curl -H "Accept: application/json" https://cloud.testdroid.com/api/v2/me/projects/<PROJECTID>/runs/<TE STRUNID>/device- runs/<DEVICEID>/screenshots/<SCREENSHOTID>?access_token=<A CCESS-TOKEN> Get Screenshots
  51. 51. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 51 Hands-on - Let's cURL!
  52. 52. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 52 • Testdroid API for Python – https://github.com/bitbar/testdroid-api-client-python • Testdroid API for Ruby – https://github.com/bitbar/testdroid-api-client-ruby • Testdroid API for Java – https://github.com/bitbar/testdroid- api/tree/master/src/main/java/com/testdroid/api/sample • Testdroid API description – http://docs.testdroid.com/_pages/client.html Additional Examples
  53. 53. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 53
  54. 54. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 54 Video recording & slides of this webinar will be soon available at Vimeo and Slideshare! Please visit at www.testdroid.com for more information. THANK YOU! W E B I N A R
  55. 55. © Copyrights by Bitbar Technologies Ltd. 2015 All rights reserved. 55 We operate the largest global device cloud with over 400 devices instantly available for developers Devices from the US, Europe, China, Japan and Korea – global devices for global customers

×