I made the following request via GET: api/node?fields=nid,title,field_media

But I'm getting the errror: Invalid query provided, double check that the fields and parameters you defined are correct and exist. SQLSTATE[42S22]: Column not found: 1054 Unknown column 't.field_media' in 'field list'

I'm assuming its only looking at the node table, but how do you make it grab all the fields of this content type?

I couldn't easily find the documentation of these endpoints and how to call them properly. How is everyone figuring this out?

enter image description here

  • 1
    From my understanding the Entity Index resources can only return base fields, i.e. node id, title, language, status, etc, it (sadly) cannot return fields. I agree this sucks. Here's my old attempt at a workaround for this: drupal.org/node/2601764 – tyler.frankenstein Oct 2 '17 at 16:00
  • Correct me if I'm wrong here. So it looks like it can only return exactly what we see in the columns in the node table and none of the fields? – Patoshi パトシ Oct 2 '17 at 16:31
  • Correct. I'm open to a patch that allows other fields to be included in the results though, that'd be much cleaner and more efficient than just delivering the whole node. – tyler.frankenstein Oct 2 '17 at 16:37

Use Views Datasource or Views data export and create a page view that contains your fields in JSON, or XML, or whatever you want to use. Then simply do a GET to your view's URL.

| improve this answer | |
  • what about making a post to update or add to these fields in the same content type using services? – Patoshi パトシ Oct 3 '17 at 22:46
  • @duckx POST is a totally diff animal than GET. My answer here will solve your GET problem. Since this question is about GET the answer should only be about GET. – No Sssweat Oct 3 '17 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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