HTTP GET with Query Params

Back to HTTP Tutorial Index

An HTTP GET with query params has one or more name=value query params in the URL after a "?" char that marks the end of the path.
For example: https://example.com/path/to/page?name=ferret&color=purple

Here's an example of a GET request with query params. Each param value is URL encoded.

GET https://youtubeanalytics.googleapis.com/v2/reports?endDate=2015-12-31&filters=video%3D%3Djb42oy5_ruI&ids=channel%3D%3DMINE&metrics=views%2Ccomments%2Clikes%2Cdislikes%2CestimatedMinutesWatched%2CaverageViewDuration&startDate=2015-01-01&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Host: youtubeanalytics.googleapis.com

CURL

A CURL statement to send the above HTTP request is shown here. You can generate source code from a CURL statement using Chilkat's online tool at https://tools.chilkat.io/curlHttp

In the CURL statement, no URL encoding is needed because each name=value pair is enclosed in double-quotes.

curl -G https://youtubeanalytics.googleapis.com/v2/reports \
  -d "ids=channel==MINE" \
  -d "endDate=2015-12-31" \
  -d "metrics=views,comments,likes,dislikes,estimatedMinutesWatched,averageViewDuration" \
  -d "startDate=2015-01-01" \
  -d "filters=video==jb42oy5_ruI" \
  -d "key=[YOUR_API_KEY]" \
  -H "Authorization: Bearer [YOUR_ACCESS_TOKEN]" \
  -H "Accept: application/json" \
  -H "Host: youtubeanalytics.googleapis.com"

Chilkat Examples Implementing the Above HTTP GET

You can use Chilkat's online tool at https://tools.chilkat.io/curlHttp to generate code from a CURL statement. Copy/paste the CURL statement into the online tool, choose your programming language, and click the "Generate Code" button.