In this lesson Joe will demontrate using additional parameters and arguments to refine the returned data when making requests from our API. As well as walking through the code that shows where the various parameters are defined and how you can find what options are available. Finally, we install the services tools module which provides some additional documentation.
Additional resources
Services implements resources for all of core's basic data types but sometimes the information returned in the response is either to much or to little and we want to make changes to the response data. In this lesson Joe will look at how we can write a simple custom module that implments basic hooks provided by the services module to allow us to alter the response returned by a request to the node resource.
Most of the actions we want to perform and data we want to retrieve from an API is likely restricted to authenticated users. This lesson will outline the process of making an authenticated request and walk the user through the configuration that is required for our services endpoint in order to start allowing session based authentication.
In this lesson Joe walks through making authenticated requests to our API with cURL. Although cURL can be a bit verbose when making authenticated requests it serves as a good way to talk about all the headers that are a required and a lowest common denominator for how you could accomplish authentication in just about any language or application.
Example commands
curl http://services-demo.lan/api/v1/user/login -d '{"name":"admin","pass":"admin"}' -H "Content-type: application/json" -H "Accept: application/json"
curl http://services-demo.lan/api/v1/system/connect -X POST
curl http://services-demo.lan/api/v1/system/connect -H "Cookie: SESS60f8c5b86739b7e326223b4ef35867b2=A86XHGJWlnDcMOGcArbOT-qHrsIi5P2NrcoNTXwWluw" -H "X-CSRF-Token: T77haXwD7JKOJsBlKP3p3kLbjQO96bQWvGJAE1_PUZM" -X POST
curl http://services-demo.lan/api/v1/user/login -X POST -H "Content-type: application/json" -H "Accept: application/json"
In this lesson Joe walks through making authenticated requests using the Chrome REST Console Plugin
Additional resources
The Chrome plugin demonstrated in this video is no longer available but there are many alternatives available. Use Postman or search for "REST client" to find tooling options.
All the power of views made available to your API. Really, what else is there to say? In this lesson Joe walks through installation and basic configuration of the services views module which provides the ability to expose views as resources via the services module.
Additional resources
In addition to using views to expose lists of things via our API we can also take advantage of views exposed filters to allow API consumers more control over the data they are receiving in a request. In this lesson Joe looks at accessing views exposed filters via REST requests by adding an exposed filter to both of the perviously created views and then walking through how the configuration of the view changes the behavior of the filter when used via the services API.
In addition to the built in support for core's data and actions the services module also provides a robust framework for exposing the data and actions of our custom modules as an API. In this lesson Joe writes a basic module which creates a custom resource for saving and retrieving a "checked in" status for an authenticated user.
Example commands:
Check a user's status
curl http://localhost/demos/services-7x-test/docroot/api/v1/drupalsquare/1 -H "Accept: application/json"
Check-in a user
curl http://localhost/demos/services-7x-test/docroot/api/v1/drupalsquare/checkin -X POST -H "Content-type: application/json" -H "Accept: application/json" -d '{"uid":1}'
Additional resources
An API that exposes data and actions to a 3rd party is only as good as the documentation for that API. Without good documentation no one will be able to make use of the API you just spent so much energy creating. In this lesson Joe shows some of his favorite API documentation examples and then walks through creating some basic documentation for the resource we created in the previous lesson.
Additional resources
Example - GitHub API Documentation
Example - Recurly Documentation
http://apiary.io - tool to assit in writing good documentation
This series taught you how to use two of Drupal’s fundamental “building block” modules: Field and Views. These modules constitute the cornerstone of Drupal’s power and are used extensively throughout the rest of the Using Drupal series. In this summary we'll take a tour the Epic University site we've built to discuss how we built it. We'll wrap things up with a review of the modules and resources we've covered in this series.
Additional resources
In this series we look at how to integrate rich media into your Drupal website. In our example we build out a fully functional website for a band. In this lesson we take a look at what our client's needs are: to share their music and videos with their fans, and have a blog and news site with contact information.
We take a look at the modules and tools – Drupal core, Views, the Media package, music players and image display tools – we need to build the site. We'll wrap things up by actually taking a tour of the finished website so that you can see what it is that we're aiming for in this series.
Note: This series covers Media Module version 1.x. To learn about Media Module 2.x, check out our Using Drupal Chapter 4: Media Management series.
Additional resources
Using Drupal, 2nd Edition book Media project on drupal.org Colorbox project on drupal.org Gallery formatter project on drupal.org Insert project on drupal.org Wysiwyg project on drupal.org jPlayer project on drupal.org Views project on drupal.org
Before we dive into the fun world of playing with media, we need to get some basic Drupal site-building set up to meet a few of our site needs. ---- In this lesson, we'll create a foundation for the rest of the site by setting up the following things:
- Bio page
- Contact form (enable, show default config, perms, add menu item)
- Front page blog
- Add a theme (business)
Note: This series is covering Media Module version 1.x. To learn about Media Module 2.x, check out our Using Drupal Chapter 4: Media Management series.
Additional resources
Drupal is a Content Management System and most often when we think of content, we tend to think of the text-based content we type into into web forms and see as a blog, or an about us page. Digital media creators, however, also have to deal with sound clips, videos, and images. Those things need to be stored, retrieved and displayed just like text, and understanding the needs and processes around this will make working with them in our site a better experience.
In this lesson, we're going to look at the major needs for media asset management in Drupal with:
- Uploading and storing files
- Retrieving files
- Displaying files
Note: This series is covering Media Module version 1.x. To learn about Media Module 2.x, check out our Using Drupal Chapter 4: Media Management series.
Additional resources
The history of working with media in Drupal is long and bumpy. The main goal of the Media module is to create a refined, centralized way of handling media on a Drupal site, and Media, version 1, is the main tool we'll be using to create our site. In this lesson we'll get an overview of the Media module and specifically take a look at:
- Unified interface
- Kinds of media
- Different versions (https://groups.drupal.org/node/215218)
Note: This series is covering Media Module version 1.x. To learn about Media Module 2.x, check out our Using Drupal Chapter 4: Media Management series.
Additional resources
Working with images can sound very straight-forward, but there are actually many, many ways that we use images on the web. You need to know what your use case is, and the right approach to meet those needs, to save yourself some headaches.
In this lesson, we're going to discuss the different ways we may need to use images and how to approach those with Drupal. We'll be discussing:
- In-line content
- Image fields
- Creating galleries
Note: This series is covering Media Module version 1.x. To learn about Media Module 2.x, check out our Using Drupal Chapter 4: Media Management series.
Additional resources
For our site, one of our main needs is photo galleries. We're going to create ours by using one node per gallery to give our site editors the simplest way to make a nice gallery. In this lesson, we're going to take a look at what our finished galleries will look like, and the get started building them. We'll review the modules we need and then make our Gallery content type.
Note: This series is covering Media Module version 1.x. To learn about Media Module 2.x, check out our Using Drupal Chapter 4: Media Management series.
Additional resources
We have some nice looking galleries now, but there still isn't a good way for people to find and view them. In this lesson, we're going to use Views to create a Photos list page, along with a menu item, and then we'll make a Photos home page block. That block will be created with Views as well, and when you click on it, you will go to our new Photos list page.
Note: This series is covering Media Module version 1.x. To learn about Media Module 2.x, check out our Using Drupal Chapter 4: Media Management series.
Additional resources
Aside from things like photo galleries or images for albums, our content creators on the site are going to want to be able to add images to blog posts and do things like put a bio picture on the bio page. The article content type already has an image field, but that doesn't help us very much with getting that image inside the body of our content. In this lesson we're going to add in-line images using the Insert module.
Note: This series is covering Media Module version 1.x. To learn about Media Module 2.x, check out our Using Drupal Chapter 4: Media Management series.
Additional resources
Probably the most important thing that our band wants to be able to do is upload their music! In this lesson we're going to create an Album content type with a title, cover art, description, and list of songs.
Note: This series is covering Media Module version 1.x. To learn about Media Module 2.x, check out our Using Drupal Chapter 4: Media Management series.