What is the query string
The query string is the part of a URL immediately after the question mark:
https://someapiurl.com/endpoint/?api_key=1234567&user_id=456
The query string is used to add some type of data that will be readable and useable by the API that is receiving the request. In the example above, the API can check the api_key parameter and make sure this key is authenticated. It can then check the user_id parameter and only return the relevant data for user id 456.
How to add query string parameters
Adding query string parameters is possible by simply adding the parameters as name/value pairs into the Query String field within the endpoint, as shown below.
Adding the parameters as shown below will create a query string that looks exactly like this: ?api_key=1234567&user_id=456
When to use query string parameters
You should use query string parameters when your API documentation says so!
Using the query string is a very popular method for authentication as well as for many other different uses. But again, refer to your API’s documentation to know if you need to use the query string.
Going further
Sometimes you may need to use dynamic variables in the query string.
This means that you may need to, for example, change the user_id value depending on which user is logged in. This is possible when using the Pro Plugin, which adds a new attribute to the shortcode and template tag.
Here is a guide for using dynamic variables in the query string.