Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added timeout parameter to POST /worker

  • Loading branch information...
commit f439dd2d9e1c24a7e13d85f02193a9ce7ac705d4 1 parent 69567c7
Oliver Morgan authored

Showing 1 changed file with 46 additions and 5 deletions. Show diff stats Hide diff stats

  1. +46 5 README.md
51 README.md
Source Rendered
@@ -20,17 +20,20 @@ All date formats are given in ISO-8601 which can be processed natively with `Dat
20 20 All requests are pre-processed and validated. This section outlines how we handle errors within the API and respond to them.
21 21
22 22 1. Sending Invalid JSON-content will result in the following response.
23   -
  23 +
  24 + ```
24 25 HTTP/1.1 400 Bad Request
25 26 Content-Length: 26
26   -
  27 +
27 28 {"message":"Invalid JSON"}
  29 + ```
28 30
29 31 2. All API requests are validated. The following is an example output for a required parameter that wasn't given.
30   -
  32 +
  33 + ```
31 34 HTTP/1.1 422 Unprocessable Entity
32 35 Content-Length: 136
33   -
  36 +
34 37 {
35 38 "message": "Validation Failed",
36 39 "errors": [
@@ -40,8 +43,9 @@ All requests are pre-processed and validated. This section outlines how we handl
40 43 }
41 44 ]
42 45 }
  46 + ```
43 47
44   - Possible error codes are `required` and `invalid`.
  48 + Possible error codes are `required` and `invalid`.
45 49
46 50 ### Authentication
47 51 Where necessary you will need to authenticate who you are. Before spawning browser workers and getting browser screenshots for example. Authentication is done using your username/password within the HTTP request. For example:
@@ -103,6 +107,42 @@ Spawn a new browser instance as a browser worker. Browser workers are completely
103 107
104 108 > This call requires authentication.
105 109
  110 +Once a worker has been spawned you can see it listed in your dashboard account online at browserstack.com. You can then login to this worker VM and do any interactions you want if you need to.
  111 +
  112 +### Parameters
  113 +A valid request must contain a `browser` and either a `url` or `data` parameter but not both. `Timeout` is optional but defaults to 30seconds.
  114 +
  115 +#### browser
  116 +The browser ID. These can be found from the `/browser` API call outlined above.
  117 +
  118 +#### (timeout=30)
  119 +A number in seconds before the worker is terminated. Set this to 0 to keep the worker alive indefinitely.
  120 +
  121 +> IMPORTANT! If you have set the timeout to 0. Make sure you remember to terminate the worker otherwise it will continue to use up your credits.
  122 +
  123 +#### (url)
  124 +A valid url to navigate the browser to. This should be used instead of `data` and not together.
  125 +
  126 +> Must be base-64 encoded
  127 +
  128 +#### (data)
  129 +A valid HTML content page to run. This should be used instead of `url` and not together.
  130 +
  131 +> Must be base-64 encoded.
  132 +
  133 +### Response
  134 +The response will be returned when the worker has been spawned and the url loaded. The `X-Worker-Id` represents the worker id used for getting screenshots and status of the worker.
  135 +
  136 + HTTP/1.1 200 Success
  137 + X-Worker-Id: 3255bfef
  138 +
  139 +## Getting a Worker Screenshot
  140 +This method will allow you to get a screenshot image of the browser window.
  141 +
  142 + POST /worker
  143 +
  144 +> This call requires authentication.
  145 +
106 146 ### Parameters
107 147
108 148 #### browser
@@ -123,3 +163,4 @@ The response will be returned when the worker has been spawned and the url loade
123 163
124 164 HTTP/1.1 200 Success
125 165 X-Worker-Id: 3255bfef
  166 +

0 comments on commit f439dd2

Please sign in to comment.
Something went wrong with that request. Please try again.