Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Alternate resources: 

Testing Resources with cURL

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:05
    with Joe Shindelar
  • 0:06
    In this lesson, we're going to look at using the cURL,
  • 0:09
    or c URL, command line application to interact with our web services.
  • 0:14
    Tools like cURL give us additional options above and beyond what we
  • 0:17
    can type into the address bar of our browser, which make it
  • 0:21
    easy to control all of the components of the request we're
  • 0:23
    making of our web services, including things like setting HTTP
  • 0:27
    headers and any additional information the endpoint needs
  • 0:31
    to interpret the request.
  • 0:32
    Using cURL will also allow us to create basic post requests

Testing Resources with cURL

Loading...

While cURL may not be the simplest way to interact with a REST API it is the most ubiquitous and the one that is most often referenced in documentation through the web. So to ensure that students have at least a baseline of understanding, and will know how to read the documentation in the future, in this lesson Joe takes a quick look at how to test our API with cURL by retrieving, and creating data.

Example Commands:

`curl http://localhost/demos/services-7x/docroot/api/v1/node/1`

`curl --data '{"title":"hello world!","type":"page"}' --header "Content-Type:application/json" http://localhost/demos/services-7x/docroot/api/v1/node`