Usergrid: Queries not accepted in GET requests

125 views Asked by At

Using Postman when I issue a get request to my Usergrid backend I get a response back. For example:

When I run:

https://api.usergrid.com/gss/sandbox/summaries

I get a response:

{
    "action": "get",
    "application": "6e9204f0-71da-11e4-9a58-bd53db9c149b",
    "params": {},
    "path": "/summaries",
    "uri": "https://api.usergrid.com/gss/sandbox/summaries",
    "entities": [
        {
            "uuid": "7cd5c98a-7b16-11e4-9085-b5397738dcd5",
            "type": "summary",
            "created": 1417629724184,
            "modified": 1417629993800,
            "accountId": "123123",
            "accounts": [
                {
                    "id": "123123",
                    "type": "Individual",
                    "category": "Prepaid",
                    "numberOfLines": 2,
                    "balance": {...

However when I run the request with a query:

https://api.usergrid.com/gss/sandbox/summaries?ql=select * where id=123123

I get :

"action": "get",
    "application": "6e9204f0-71da-11e4-9a58-bd53db9c149b",
    "params": {
        "ql": [
            "select * where id=123123"
        ]
    },
    "path": "/summaries",
    "uri": "https://api.usergrid.com/gss/sandbox/summaries",
    "entities": [],
    "timestamp": 1418766878176,
    "duration": 7,
    "organization": "gss",
    "applicationName": "sandbox",
    "count": 0

I want to be able to get the complete response when I pass in an 'id' in the query as it is coming from my UI & get the response. Any ideas?

-S

1

There are 1 answers

0
brandonscript On

Your id property is a sub-key of accounts - when dealing with objects, you can use dot notation to reference sub-keys, like account.id. Unfortunately in your case, because you're using an array ([]) of accounts in a single entity (not an {} object), those are not queryable. I did notice though that the same property exists under accountId. You could try:

https://api.usergrid.com/gss/sandbox/summaries?ql=select * where accountId=123123

If not, I'd recommend you look at using a new collection to maintain your list of accounts, and use connections to manage the relationships between the entities.