Multiline Script in API call

We just started testing with the API, but I can’t figure out how we can add a script to the test.
We want to set a cookie, so we measure our website without the cookie pop-up. But to do that you have to:

  • Set the cookie
  • navigate to the %URL%

But I can’t figure out how to do this, because when I add the script to the api call, it says:
“Invalid Script (make sure there is at least one navigate command and that the commands are tab-delimited). Please contact us if you need help with your test script.”

So here I am :slight_smile:

When I manually run the test I add the script:

setCookie {ourURL} {cookievalue}
navigate %URL%

But how do I add this to a HTTP request API call? The documentation doesn’t mention this, only single line scripts.

Thanks in advance!

Just url-encode the full script (including the \n line separator).

i.e.

script=setCookie%20%7BourURL%7D%20%7Bcookievalue%7D%0Anavigate%20%25URL%25

For the record, if you are passing API params through a GET request (instead of a POST), you should url-encode all of the params.