You’ve done an amazing job navigating through making XHR GET and POST requests! Take some time to review the core concepts before moving on to the next lesson.
There are many HTTP request methods, two of which are GET and POST.
GET requests only request information from other sources.
POST methods can introduce new information to other sources in addition to requesting it.
new, setting the
responseType, creating a function that will handle the response object, and opening and sending the request.
To add a query string to a URL endpoint you can use
?and include a parameter.
To provide additional parameters, use
&and then include a key-value pair, joined by
Determining how to correctly write the requests and how to properly implement them requires carefully reading the documentation of the API with which you’re working.
Play around with the browser and code to make GET and POST requests. If you’re going to make POST requests, make sure you assign
apiKey your Rebrandly API key and run the code!
If you want to challenge yourself:
- Manipulate the object that is returned to display something different in the browser.
- Use a different API to make a GET or POST request.
- Create query strings to yield different results.