Mashery Support Portals Forums

Mashery API

RSS Feed

Doc Example of query not working

  1. Greetings all:
    When I run this query
    ["SELECT username, applications.name, applications.keys from members"]

    I get this as a response

    400 Bad Request
    {
    "error": {
    "code": 3000,
    "message": "Cannot nest \"to many\" relationships"
    },
    "id": 1,
    "result": null
    }


    This query is right in the middle of the page - http://support.mashery.com/docs/read/mashery_api/Query_Language

    SELECT username, applications.name, applications.keys FROM members

    Any insight to what is going wrong here? I would prefer not having to query for usernames and then query for each of their API keys.

    Message edited by Steve CP 2 years ago

  2. davidlin2 years ago

    Thanks for pointing this out!

    This is an error in the documentation. Since applications and keys hold a many to many relationship with each other, this type of query is not allowed to prevent recursive querying.

    You can achieve a similar result by doing:

    SELECT username, keys.application.name, keys.apikey FROM members

    This will return the list of members and the keys that they have along with the application name associated with that key. *Note* The singularity of "application" from keys.application is the signifier for a single mapping.

    We'll get the documentation fixed right away. Sorry for the inconvenience.

    Hope that helps!

    - David

  3. Steve CP2 years ago

    Yup - works like a charm - thanks
    BTW, I have a python example of working with your APIs - would you like me to ship it to you when I finish it?

  4. Kelly Miyashiro2 years ago

    I would like that.

  5. Steve CP2 years ago

    Hey Kelly - you can look at my blog and see the example there:
    http://thesteve0.wordpress.com/2011/01/14/example-of-python-with-json-rpc/

  6. Kelly Miyashiro2 years ago

    Cool, I will put it in the examples page that I'm about to make right now. Thanks!

[ Page 1 of 1 ]