WebPagetest Forums
REST API - how to override connectivity - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: WebPagetest (/forumdisplay.php?fid=7)
+--- Forum: Private Instances (/forumdisplay.php?fid=12)
+--- Thread: REST API - how to override connectivity (/showthread.php?tid=11543)



REST API - how to override connectivity - sabreB6 - 08-13-2012 09:21 PM

Hey!
I'm interested in overriding connectivity settings in REST API, I know that I can set bwDown, bwUp params but it would be nice to override them with single param.

I was looking at runtest.php and found that location param may hold optional settings like 'location:browser.connectivity'

Quote:
// Extract the location, browser and connectivity.
// location:browser.connectivity
if( preg_match('/([^\.:]+)[:]*(.*)[\.]+([^\.]*)/i', trim($req_location), $matches) ||
preg_match('/([^\.:]+)[:]*(.*)/i', trim($req_location), $matches))
{
$test['location'] = trim($matches[1]);
if (strlen(trim($matches[2])))
$test['browser'] = trim($matches[2]);
if (strlen(trim($matches[3])))
$test['connectivity'] = trim($matches[3]);
} else {
$test['location'] = trim($req_location);
}

For connectivity I should use values from conectivity.ini however I'm not sure about browser. I was submitting blank browser with 'Cable' connectivity and it works fine for IE but breaks for wptdriver - the test is submitted but never complete succesfully.

Is it supported or I should rather stick to bwDown, bwUp?


RE: REST API - how to override connectivity - sabreB6 - 08-14-2012 12:22 AM

I've found some examples on wiki:https://sites.google.com/a/webpagetest.org/docs/advanced-features/webpagetest-restful-apis

It looks like it's enough to append '.{connectivity}' to instance name and it works for me, ':{browser}' is optional.


RE: REST API - how to override connectivity - pmeenan - 08-15-2012 12:21 PM

yes, sorry. Browser is optional and not used for IE agents. For connectivity you can also specify custom and then pass the individual settings for bandwidth, latency and packet loss (though since it's a private instance you could also just define your own named-values).