Usergrid:GET请求中不接受查询

时间:2014-12-16 21:56:45

标签: apigee usergrid mbaas

当我向Usergrid后端发出get请求时使用Postman我得到了回复。例如:

当我跑步时:

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

我收到回复:

{
    "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": {...

但是,当我使用查询运行请求时:

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

我明白了:

"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

我希望能够在查询中传入“id”时获得完整的响应,因为它来自我的UI&得到回应。有什么想法吗?

-S

1 个答案:

答案 0 :(得分:1)

您的id属性是accounts的子键 - 在处理对象时,您可以使用点表示法来引用子键,例如account.id。不幸的是,在您的情况下,因为您在单个实体(而不是[]对象)中使用了一个数组({}),所以这些不可查询。我确实注意到accountId下存在相同的属性。你可以尝试:

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

如果没有,我建议您使用新的集合来维护帐户列表,并使用connections来管理实体之间的关系。