Questions tagged [query-string]

The part of a URL after the ? (question mark), containing parameter=value pairs separated by & (ampersand). In a request made to a web application at a particular URL, the parameter+value data in the query string is parsed/consumed by the web application on the backend that receives the request.

See also: https://en.wikipedia.org/wiki/Query_string

3924 questions
161
votes
3 answers

REST API Best practices: args in query string vs in request body

A REST API can have arguments in several places: In the request body - As part of a json body, or other MIME type In the query string - e.g. /api/resource?p1=v1&p2=v2 As part of the URL-path - e.g. /api/resource/v1/v2 What are the best practices…
Jonathan
  • 84,911
  • 94
  • 244
  • 345
153
votes
4 answers

Serialize object to query string in JavaScript/jQuery

I'm trying to find information on how to serialize an object to query string format, but all my searches are drowning in results on how to go the other way (string/form/whatever to JSON). I have { one: 'first', two: 'second' } and I…
Tomas Aschan
  • 53,075
  • 51
  • 214
  • 362
150
votes
9 answers

How to configure the web.config to allow requests of any length

I am building a site in which i would like to create a file client side from the value of a textarea element. I have the code in place to do this, but i am getting this error HTTP Error 404.15 - Not Found The request filtering module is …
some_bloody_fool
  • 4,305
  • 14
  • 35
  • 42
147
votes
5 answers

Node.js: Difference between req.query[] and req.params

Is there a difference between obtaining QUERY_STRING arguments via req.query[myParam] and req.params.myParam? If so, when should I use which?
user1598019
138
votes
13 answers

Sharing a URL with a query string on Twitter

I'm trying to put a Twitter share link in an email. Because this is in an email I can't rely on JavaScript, and have to use the "Build Your Own" Tweet button. For example, sharing a link to Google:
haydenmuhl
  • 5,462
  • 6
  • 23
  • 31
138
votes
27 answers

How can I delete a query string parameter in JavaScript?

Is there better way to delete a parameter from a query string in a URL string in standard JavaScript other than by using a regular expression? Here's what I've come up with so far which seems to work in my tests, but I don't like to reinvent…
Matthew Lock
  • 11,495
  • 11
  • 84
  • 122
134
votes
6 answers

Modifying a query string without reloading the page

I am creating a photo gallery, and would like to be able to change the query string and title when the photos are browsed. The behavior I am looking for is often seen with some implementations of continuous/infinite page, where while you scroll down…
Sonic Soul
  • 21,043
  • 31
  • 118
  • 190
131
votes
6 answers

In Go's http package, how do I get the query string on a POST request?

I'm using the httppackage from Go to deal with POST request. How can I access and parse the content of the query string from the Requestobject ? I can't find the answer from the official documentation.
Fabien
  • 9,808
  • 7
  • 37
  • 61
120
votes
19 answers

How to obtain the query string from the current URL with JavaScript?

I have URL like this: http://localhost/PMApp/temp.htm?ProjectID=462 What I need to do is to get the details after the ? sign (query string) - that is ProjectID=462. How can I get that using JavaScript? What I've done so far is this: var url =…
AbdulAziz
  • 4,948
  • 12
  • 51
  • 75
118
votes
11 answers

Fastest way to implode an associative array with keys

I'm looking for a fast way to turn an associative array in to a string. Typical structure would be like a URL query string but with customizable separators so I can use '&' for xhtml links or '&' otherwise. My first inclination is to use foreach…
matpie
  • 15,700
  • 9
  • 58
  • 80
114
votes
17 answers

How do I use regex in a SQLite query?

I'd like to use a regular expression in sqlite, but I don't know how. My table has got a column with strings like this: "3,12,13,14,19,28,32" Now if I type "where x LIKE '3'" I also get the rows which contain values like 13 or 32, but I'd like to…
cody
  • 5,377
  • 13
  • 47
  • 69
106
votes
15 answers

JavaScript query string

Is there any JavaScript library that makes a dictionary out of the query string, ASP.NET style? Something which can be used like: var query = window.location.querystring["query"]? Is "query string" called something else outside the .NET realm? Why…
core
  • 30,054
  • 41
  • 131
  • 189
106
votes
7 answers

What's valid and what's not in a URI query?

Background (question further down) I've been Googling this back and forth reading RFCs and SO questions trying to crack this, but I still don't got jack. So I guess we just vote for the "best" answer and that's it, or? Basically it boils down to…
John Leidegren
  • 56,169
  • 16
  • 118
  • 148
102
votes
2 answers

What is the difference between URL parameters and query strings?

I don't see much of a difference between the parameters and the query strings, in the URL. So what is the difference and when should one be used over the other?
Konst
  • 4,023
  • 5
  • 22
  • 35
97
votes
2 answers

How do I parse a URL query parameters, in Javascript?

Possible Duplicate: Use the get paramater of the url in javascript How can I get query string values in JavaScript? In Javascript, how can I get the parameters of a URL string (not the current URL)? like: www.domain.com/?v=123&p=hello Can I get…
user847495
  • 8,403
  • 15
  • 42
  • 47