4

I'm retrieving a URL parameter from a CloudPage. What is the difference between RequestParameter() and QueryParameter()? They appear to do the same thing. Are there scenarios where you would need to use one over the other?

7

The "query" of a page's life cycle is the stuff after the "?" character in a URL, while a request parameter is one placed in the body of the request (a "form post"). Let's look at an example of what a browser might send to a server:

POST /path/to/file?The-Query-String=Here&Query-Values=Are-In-The-Url HTTP/1.1
Host: myhost.com
Content-Length: 52
Content-Type: x-www-form-urlencoded

Request-Body=Here&Request-Values=Are-In-The-Form-Post

However, in the documentation for the RequestParameter, it explicitly states that it can return query parameters (the part in the URL), and values in the form's post.

You can use QueryParameter to ignore form values, while you'd want to use RequestParameter if you need to read the values from a form post. RequestParameter may return more values than QueryParameter, especially if the request is a form post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.