WebPagetest Forums
Issues submitting urls via API - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: WebPagetest (/forumdisplay.php?fid=7)
+--- Forum: Bugs/Issues (/forumdisplay.php?fid=10)
+--- Thread: Issues submitting urls via API (/showthread.php?tid=826)



Issues submitting urls via API - cliff.crocker@gmail.com - 06-08-2011 07:19 AM

I'm having issues passing in a url to the http API when the url contains '&'.

What should i use in place of the & in order to pass this in the querystring?

For example:

http://www.webpagetest.org/runtest.php?url=http://www.samsclub.com/sams/shop/category.jsp?categoryId=1175\&navAction=jump\&iid=Header|All_Products|Cameras%20and%20Camcorders&location=Dulles_IE8&runs=3&fvonly=1&video=1&f=xml

Doesn't work. We've tried & for the url parameters, but this still doesn't work.

Any ideas?
Sorry - the \& in the previous email was another attempt at this that didn't work. This is the example I meant to paste:

http://www.webpagetest.org/runtest.php?url=http://www.samsclub.com/sams/shop/category.jsp?categoryId=1175&navAction=jump&iid=Header|All_Products|Cameras%20and%20Camcorders&location=Dulles_IE8&runs=3&fvonly=1&video=1&f=xml


RE: Issues submitting urls via API - pmeenan - 06-08-2011 10:40 AM

You need to URLEncode the query parameter. Here's a good online encoder: http://meyerweb.com/eric/tools/dencoder/ but realistically, whatever language you are using to automate should have a built-in urlencode() function that will do it for you (individually for each query parameter, though the url is usually the one that causes issues).

Here is what it looks like encoded: http://www.webpagetest.org/runtest.php?url=http%3A%2F%2Fwww.samsclub.com%2Fsams%2Fshop%2Fcategory.jsp%3Fcat​egoryId%3D1175%26navAction%3Djump%26iid%3DHeader%7CAll_Products%7CCameras%2520an​d%2520Camcorders&location=Dulles_IE8&runs=3&fvonly=1&video=1&f=xml&k=<key> (make sure to insert your actual API key and please don't post them :-) )


RE: Issues submitting urls via API - cliff.crocker@gmail.com - 06-08-2011 03:12 PM

Great - thanks Pat!