Submitting test requestsYou can submit tests to pagetest either by doing a POST or a GET to http://www.webpagetest.org/runtest.php In response you will either get redirected to the results page or you will get an xml response (depending on if xml was requested). Parameters
Specifying connectivityIf the connectivity is not specified, by default you will get the Cable (5/1 Mbps, 28ms RTT) profile. The connectivity is specified as part of the location in the format: location:browser.connectivity
Dulles_IE7.DSL Frankfurt.Dial China.custom Dulles:Chrome.DSL
Browser is only required in a Chrome/Firefox install where wptdriver is configured for multiple browsers.
XML responseThe XML response follows the format of REST API's. You will get a HTTP 200 response to the request itself indicating that the request was parsed but the result of the submission itself will be in the XML. See the samples for a full example XML response. <response>
<statusCode></statusCode>
<statusText></statusText>
<requestId></requestId>
<data>
<testId></testId>
<xmlUrl></xmlUrl>
<userUrl></userUrl>
<summaryCSV></summaryCSV>
<detailCSV></detailCSV>
</data>
</response>
statusCode - 200 indicates a successful submission. Anything else is an error (and will come back as 400 with descriptive text) statusText - Descriptive error text explaining the failure requestId - Request ID echoed from request (r parameter). Will not be present if not specified. Makes it easier to track asynchronous requests. testId - ID assigned to the test request (and used in all of the urls) xmlUrl - URL to use to get the results in XML format userUrl - URL to use to direct the user to a results page (what you would normally get redirected to if not using the XML interface) summaryCSV - URL to the summary results in CSV format (page-level data and timings). Will return a 404 if the test is not yet complete. detailCSV - URL to the full detail results in CSV format (request-level data and timings). Will return a 404 if the test is not yet complete. SamplesTest www.aol.com and redirect to the results page: http://www.webpagetest.org/runtest.php?url=www.aol.com
http://www.webpagetest.org/runtest.php?url=www.aol.com&runs=10&fvonly=1
http://www.webpagetest.org/runtest.php?url=www.aol.com&runs=2&f=xml&r=12345 <response> <statusCode>200</statusCode> <statusText>Ok</statusText> <requestId>12345</requestId> <data> <testId>091111_2XFH</testId> <xmlUrl>http://www.webpagetest.org/xmlResult/091111_2XFH/</xmlUrl> <userUrl>http://www.webpagetest.org/result/091111_2XFH/</userUrl> </data> </response> Check test statusYou can check the status of a test by doing a GET to http://www.webpagetest.org/testStatus.php with your test id. You will get a HTTP 200 response to the request itself indicating that the request was parsed but the result of the submission itself will be in the XML.
http://www.webpagetest.org/testStatus.php?f=xml&test=your_test_id <?xml version="1.0" encoding="UTF-8"?> <response> <statusCode>100</statusCode> <statusText>Test Started</statusText> <data> <statusCode>100</statusCode> <statusText>Test Started</statusText> <testId>your_test_id</testId> <runs>9</runs> <fvonly>1</fvonly> <location>Dulles_IE8</location> <startTime>02/12/11 1:06:16</startTime> <fvRunsCompleted>1</fvRunsCompleted> <rvRunsCompleted>0</rvRunsCompleted> </data> </response> statusText - Descriptive text explaining the status
data - Some test information including the test ID, the number of runs the test requested, the start time, etc.(non-xml)
Getting test resultsunder normal use (non-xml) you will be redirected to the results page. When using the XML API you should use the xmlUrl provided in the response to the test request. The XML url can also take some optional parameters:
The format of the response for the test details is the same as for submitting the request (with different data). All times are in ms. <response> <statusCode></statusCode> <statusText></statusText> <requestId></requestId> <data> <runs></runs> <average> <firstView> </firstView> <repeatView> </repeatView> </average> <run> <id></id> <firstView> <results> </results> <pages> </pages> <thumbnails> </thumbnails> <images> </images> <rawData> </rawData> </firstView> <repeatView> <results> </results> <pages> </pages> <thumbnails> </thumbnails> <images> </images> <rawData> </rawData> </repeatView> </run> <run> ... </run> </data> </response> statusCode - 200 if the test is complete and results are available. 1xx if the test is still pending (try again in a reasonable amount of time - 5-10 seconds). 400 if it is an invalid test ID. statusText - Descriptive text of any failures requestId - Request ID echoed from the request runs - Number of runs in the response average - Averaged test results across all of the successful runs (a block each for first and repeat view data) run - A block for each test run with the results for that run id - Run number (increments up from 1 in order) firstView/repeatView - A block of results each for First and Repeat view data results - Test results (all times are in ms) pages - URL's to user pages thumbnails - URL's to the thumbnails for the various images (waterfall, checklist, screen shot) images - URL's to the full-sized images (waterfall, checklist, screen shot) rawData - URL's to the headers and tab-delimited results files SampleUsing the test request sample from earlier (and adding a requestId), we get: http://www.webpagetest.org/xmlResult/091111_2XFH/?r=12345 <?xml version="1.0" encoding="UTF-8" ?> <response> <statusCode>200</statusCode> <statusText>Ok</statusText> <requestId>12345</requestId> <data> <runs>2</runs> <average> <firstView> <loadTime>4495</loadTime> <TTFB>315</TTFB> <bytesIn>392645</bytesIn> <bytesInDoc>392645</bytesInDoc> <requests>44</requests> <requestsDoc>44</requestsDoc> <render>1904</render> <fullyLoaded>4495</fullyLoaded> <docTime>4495</docTime> <domTime>0</domTime> <avgRun>1</avgRun> </firstView> <repeatView> <loadTime>3266</loadTime> <TTFB>359</TTFB> <bytesIn>102151</bytesIn> <bytesInDoc>102151</bytesInDoc> <requests>13</requests> <requestsDoc>13</requestsDoc> <render>682</render> <fullyLoaded>3266</fullyLoaded> <docTime>3266</docTime> <domTime>0</domTime> <avgRun>1</avgRun> </repeatView> </average> <run> <id>1</id> <firstView> <results> <URL>http://www.aol.com</URL> <loadTime>4467</loadTime> <TTFB>346</TTFB> <bytesOut>22403</bytesOut> <bytesOutDoc>22403</bytesOutDoc> <bytesIn>386528</bytesIn> <bytesInDoc>386528</bytesInDoc> <requests>43</requests> <requestsDoc>43</requestsDoc> <result>0</result> <render>1963</render> <fullyLoaded>4467</fullyLoaded> <cached>0</cached> <web>1</web> <docTime>4467</docTime> <domTime>0</domTime> <score_cache>48</score_cache> <score_cdn>96</score_cdn> <score_gzip>100</score_gzip> <score_cookies>87</score_cookies> <score_keep-alive>94</score_keep-alive> <score_minify>91</score_minify> <score_combine>75</score_combine> <score_compress>99</score_compress> <score_etags>93</score_etags> <date>1257974116</date> </results> <pages> <details>http://www.webpagetest.org/result/091111_2XFH/1/details/</details> <checklist>http://www.webpagetest.org/result/091111_2XFH/1/performance_optimization/</checklist> <report>http://www.webpagetest.org/result/091111_2XFH/1/optimization_report/</report> <breakdown>http://www.webpagetest.org/result/091111_2XFH/1/breakdown/</breakdown> <domains>http://www.webpagetest.org/result/091111_2XFH/1/domains/</domains> <screenShot>http://www.webpagetest.org/result/091111_2XFH/1/screen_shot/</screenShot> </pages> <thumbnails> <waterfall>http://www.webpagetest.org/result/091111_2XFH/1_waterfall_thumb.png</waterfall> <checklist>http://www.webpagetest.org/result/091111_2XFH/1_optimization_thumb.png</checklist> <screenShot>http://www.webpagetest.org/result/091111_2XFH/1_screen_thumb.jpg</screenShot> </thumbnails> <images> <waterfall>http://www.webpagetest.org/results/09/11/11/2XFH/1_waterfall.png</waterfall> <checklist>http://www.webpagetest.org/results/09/11/11/2XFH/1_optimization.png</checklist> <screenShot>http://www.webpagetest.org/results/09/11/11/2XFH/1_screen.jpg</screenShot> </images> <rawData> <headers>http://www.webpagetest.org/results/09/11/11/2XFH/1_report.txt</headers> <pageData>http://www.webpagetest.org/results/09/11/11/2XFH/1_IEWPG.txt</pageData> <requestsData>http://www.webpagetest.org/results/09/11/11/2XFH/1_IEWTR.txt</requestsData> </rawData> </firstView> <repeatView> <results> <URL>http://www.aol.com</URL> <loadTime>3418</loadTime> <TTFB>357</TTFB> <bytesOut>8762</bytesOut> <bytesOutDoc>8762</bytesOutDoc> <bytesIn>108138</bytesIn> <bytesInDoc>108138</bytesInDoc> <requests>14</requests> <requestsDoc>14</requestsDoc> <result>0</result> <render>682</render> <fullyLoaded>3418</fullyLoaded> <cached>1</cached> <web>1</web> <docTime>3418</docTime> <domTime>0</domTime> <score_cache>35</score_cache> <score_cdn>83</score_cdn> <score_gzip>100</score_gzip> <score_cookies>66</score_cookies> <score_keep-alive>83</score_keep-alive> <score_minify>100</score_minify> <score_combine>100</score_combine> <score_compress>100</score_compress> <score_etags>93</score_etags> <date>1257974129</date> </results> <pages> <details>http://www.webpagetest.org/result/091111_2XFH/1/details/cached/</details> <checklist>http://www.webpagetest.org/result/091111_2XFH/1/performance_optimization/cached/</checklist> <report>http://www.webpagetest.org/result/091111_2XFH/1/optimization_report/cached/</report> <breakdown>http://www.webpagetest.org/result/091111_2XFH/1/breakdown/</breakdown> <domains>http://www.webpagetest.org/result/091111_2XFH/1/domains/</domains> <screenShot>http://www.webpagetest.org/result/091111_2XFH/1/screen_shot/cached/</screenShot> </pages> <thumbnails> <waterfall>http://www.webpagetest.org/result/091111_2XFH/1_Cached_waterfall_thumb.png</waterfall> <checklist>http://www.webpagetest.org/result/091111_2XFH/1_Cached_optimization_thumb.png</checklist> <screenShot>http://www.webpagetest.org/result/091111_2XFH/1_Cached_screen_thumb.jpg</screenShot> </thumbnails> <images> <waterfall>http://www.webpagetest.org/results/09/11/11/2XFH/1_Cached_waterfall.png</waterfall> <checklist>http://www.webpagetest.org/results/09/11/11/2XFH/1_Cached_optimization.png</checklist> <screenShot>http://www.webpagetest.org/results/09/11/11/2XFH/1_Cached_screen.jpg</screenShot> </images> <rawData> <headers>http://www.webpagetest.org/results/09/11/11/2XFH/1_Cached_report.txt</headers> <pageData>http://www.webpagetest.org/results/09/11/11/2XFH/1_Cached_IEWPG.txt</pageData> <requestsData>http://www.webpagetest.org/results/09/11/11/2XFH/1_Cached_IEWTR.txt</requestsData> </rawData> </repeatView> </run> <run> <id>2</id> <firstView> <results> <URL>http://www.aol.com</URL> <loadTime>4523</loadTime> <TTFB>283</TTFB> <bytesOut>22772</bytesOut> <bytesOutDoc>22772</bytesOutDoc> <bytesIn>398762</bytesIn> <bytesInDoc>398762</bytesInDoc> <requests>44</requests> <requestsDoc>44</requestsDoc> <result>0</result> <render>1845</render> <fullyLoaded>4523</fullyLoaded> <cached>0</cached> <web>1</web> <docTime>4523</docTime> <domTime>0</domTime> <score_cache>48</score_cache> <score_cdn>96</score_cdn> <score_gzip>100</score_gzip> <score_cookies>88</score_cookies> <score_keep-alive>97</score_keep-alive> <score_minify>91</score_minify> <score_combine>75</score_combine> <score_compress>98</score_compress> <score_etags>93</score_etags> <date>1257974140</date> </results> <pages> <details>http://www.webpagetest.org/result/091111_2XFH/2/details/</details> <checklist>http://www.webpagetest.org/result/091111_2XFH/2/performance_optimization/</checklist> <report>http://www.webpagetest.org/result/091111_2XFH/2/optimization_report/</report> <breakdown>http://www.webpagetest.org/result/091111_2XFH/2/breakdown/</breakdown> <domains>http://www.webpagetest.org/result/091111_2XFH/2/domains/</domains> <screenShot>http://www.webpagetest.org/result/091111_2XFH/2/screen_shot/</screenShot> </pages> <thumbnails> <waterfall>http://www.webpagetest.org/result/091111_2XFH/2_waterfall_thumb.png</waterfall> <checklist>http://www.webpagetest.org/result/091111_2XFH/2_optimization_thumb.png</checklist> <screenShot>http://www.webpagetest.org/result/091111_2XFH/2_screen_thumb.jpg</screenShot> </thumbnails> <images> <waterfall>http://www.webpagetest.org/results/09/11/11/2XFH/2_waterfall.png</waterfall> <checklist>http://www.webpagetest.org/results/09/11/11/2XFH/2_optimization.png</checklist> <screenShot>http://www.webpagetest.org/results/09/11/11/2XFH/2_screen.jpg</screenShot> </images> <rawData> <headers>http://www.webpagetest.org/results/09/11/11/2XFH/2_report.txt</headers> <pageData>http://www.webpagetest.org/results/09/11/11/2XFH/2_IEWPG.txt</pageData> <requestsData>http://www.webpagetest.org/results/09/11/11/2XFH/2_IEWTR.txt</requestsData> </rawData> </firstView> <repeatView> <results> <URL>http://www.aol.com</URL> <loadTime>3113</loadTime> <TTFB>360</TTFB> <bytesOut>7426</bytesOut> <bytesOutDoc>7426</bytesOutDoc> <bytesIn>96163</bytesIn> <bytesInDoc>96163</bytesInDoc> <requests>11</requests> <requestsDoc>11</requestsDoc> <result>0</result> <render>682</render> <fullyLoaded>3113</fullyLoaded> <cached>1</cached> <web>1</web> <docTime>3113</docTime> <domTime>0</domTime> <score_cache>25</score_cache> <score_cdn>66</score_cdn> <score_gzip>100</score_gzip> <score_cookies>58</score_cookies> <score_keep-alive>77</score_keep-alive> <score_minify>100</score_minify> <score_combine>100</score_combine> <score_compress>100</score_compress> <score_etags>91</score_etags> <date>1257974152</date> </results> <pages> <details>http://www.webpagetest.org/result/091111_2XFH/2/details/cached/</details> <checklist>http://www.webpagetest.org/result/091111_2XFH/2/performance_optimization/cached/</checklist> <report>http://www.webpagetest.org/result/091111_2XFH/2/optimization_report/cached/</report> <breakdown>http://www.webpagetest.org/result/091111_2XFH/2/breakdown/</breakdown> <domains>http://www.webpagetest.org/result/091111_2XFH/2/domains/</domains> <screenShot>http://www.webpagetest.org/result/091111_2XFH/2/screen_shot/cached/</screenShot> </pages> <thumbnails> <waterfall>http://www.webpagetest.org/result/091111_2XFH/2_Cached_waterfall_thumb.png</waterfall> <checklist>http://www.webpagetest.org/result/091111_2XFH/2_Cached_optimization_thumb.png</checklist> <screenShot>http://www.webpagetest.org/result/091111_2XFH/2_Cached_screen_thumb.jpg</screenShot> </thumbnails> <images> <waterfall>http://www.webpagetest.org/results/09/11/11/2XFH/2_Cached_waterfall.png</waterfall> <checklist>http://www.webpagetest.org/results/09/11/11/2XFH/2_Cached_optimization.png</checklist> <screenShot>http://www.webpagetest.org/results/09/11/11/2XFH/2_Cached_screen.jpg</screenShot> </images> <rawData> <headers>http://www.webpagetest.org/results/09/11/11/2XFH/2_Cached_report.txt</headers> <pageData>http://www.webpagetest.org/results/09/11/11/2XFH/2_Cached_IEWPG.txt</pageData> <requestsData>http://www.webpagetest.org/results/09/11/11/2XFH/2_Cached_IEWTR.txt</requestsData> </rawData> </repeatView> </run> </data> </response> Cancelling TestsWith a test ID (and if required, API key) you can cancel a test if it has not started running. http://www.webpagetest.org/cancelTest.php?test=<testId>&k=<API key> Location informationYou can request a list of locations as well as the number of pending tests for each using the getLocations.php interface: http://www.webpagetest.org/getLocations.php?f=xml <response> <statusCode>200</statusCode> <statusText>Ok</statusText> <data> <location> <id>Dulles_IE7</id> <Label>Dulles, VA USA</Label> <Browser>IE 7</Browser> <default>1</default> <PendingTests> <Total>0</Total> <HighPriority>0</HighPriority> <LowPriority>0</LowPriority> </PendingTests> </location> <location> <id>Dulles_IE8</id> <Label>Dulles, VA USA</Label> <Browser>IE 8</Browser> <PendingTests> <Total>0</Total> <HighPriority>0</HighPriority> <LowPriority>0</LowPriority> </PendingTests> </location> </data> </response> |
Developer Interfaces >
