I'm developing a mobile app to connect with my Drupal Commerce (Kickstart) store, using a REST server.

When I do GET: endpoint/rest/product it retrieves the products list

<result is_array="true">
        <title>Tote Bag 1</title>
        <log />
        <data />
        <title_field>Tote Bag 1</title_field>
            <data>                <components />

Everything looks fine. I can even GET endpoint/rest/product?status=1 and it does filter well.

I'm trying to filter by commerce_price.amount:

GET endpoint/rest/product?commerce_price.amount=1600

but it's not working. I have no problems filtering by a first level key, but can't access second level ones and so on. What am I doing wrong?


From what I understand, querying only works on entity properties. That is why status works, commerce_price is a field and won't work. Checkout Services Entity API, it may do what you're looking for.

You may still be out of luck though. You alternatives will be to use services_views or write your own Services Resource.

  • Additionally, a commerce price is a different entity type to a commerce product. Being able to query by fields wouldn't be enough for this, you'd also need the api module to resolve the entity reference as well. Be nice, but I doubt anyone's gone to those lengths
    – Clive
    Apr 14 '15 at 14:24
  • @Clive I think you're exactly right. I updated my answer to mention services_views or a custom resource right after i posted my initial answer.
    – Cravecode
    Apr 14 '15 at 14:26

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.