I'm working with services 7.x-3.12, I need to create a web service in order to get a kind of "associative request" between : books(table stored in db) and categories(another table) those two tables are linked by entity_id

I can GET books (retreive, index) same for categories, but how to get Book A -> categorie A ? or the book list of category A

How can I make it work (the get service)? P.S. book is a content type (node), categories are taxonomy(taxonomy_term)

1 Answer 1


The short answer is, you can't. I have an issue posted to hopefully make this, and other filters, a reality soon.

In the mean time, you can however create a custom service resource that uses POST, and from there build a custom callback function to return your desired results.

Alternatively, you can use the Views JSON module (a sub module of Views datasource) or Services Views to easily create a View (with contextual filters, normal filters, sorts, etc) that returns JSON data to you via GET.

  • Thank you tyler, I think I'll follow you on creating a custom service resource
    – Mitch
    Jul 27, 2015 at 20:28
  • Here where I'm now (following "create a custom service resource") I've got my_module resource displayed with the action you made in your example (get_user_count). in my case I want the CRUD (only the create) to be displayed, I now I'm supposed to implement the hook resource with the function that insert into my table (db) but what's the best way to make it work? can I perform it with : db_merge ?
    – Mitch
    Jul 28, 2015 at 9:06
  • CRUD is only for entities, so your custom callback can do whatever you want. If you need to insert stuff into the database that is fine, you can use any Database API functions to make that happen. Jul 28, 2015 at 12:03
  • Sorry tyler, I know you've got enough of my questions I'm sorry, I just want db_insert (or db_merge) in my callback function (the function that create a new record in my custom table) it's a table that contains a list of customers, a customer must create an account by filling out a form (on a mobile app) this form contains exactly what the table "customers" contain of course, i've added args to function customers_services_resources(), args are : name,sexe,age. now how the function customers_create($name, $sexe, $age) could be ? $query = db_merge('cutomers','c') [what next??]
    – Mitch
    Jul 28, 2015 at 15:43
  • 1
    This page should be helpful: drupal.org/node/310079 Jul 29, 2015 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.