WebPagetest Forums
Using API for scripting - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: WebPagetest (/forumdisplay.php?fid=7)
+--- Forum: General Discussion (/forumdisplay.php?fid=25)
+--- Thread: Using API for scripting (/showthread.php?tid=15318)

Using API for scripting - kk123 - 04-05-2018 09:23 AM


I am trying to use the REST API for executing a script.
referring here - https://sites.google.com/a/webpagetest.org/docs/advanced-features/webpagetest-restful-apis

however there are no examples for this.
I have a multiline script which I need to execute using the rest api.

RE: Using API for scripting - pmeenan - 04-06-2018 10:33 PM

It is just like any other parameter. script=<url-encoded script>

You need to make sure you are url-encoding all of your API parameters if you are passing them in the URL. Most of them won't really change but the test URL and script can often have characters that MUST be encoded.

RE: Using API for scripting - psadasivuni - 07-11-2018 11:19 PM

I am new to this.

I tried several ways to put my script (which actually do login for me) into the URL but all my efforts are in vain.

Can you please help me with one example?

http://www.webpagetest.org/runtest.php?&runs=1&f=json&url=https://beta-xxxxxxxxxxxxxx.ccccom? setValue id=username someuser@aol.com setValue id=password somepassword submitForm name=AOLLoginForm&k=A.c99e36xxxxxxxxxxx679c500410f

RE: Using API for scripting - pmeenan - 07-12-2018 12:06 AM

You need to urlencode the script and pass it as script=xxxxxxx.