Using $resource for REST calls.