Firebase App REST API-按日期范围过滤查询

时间:2019-03-14 13:58:25

标签: rest firebase api

我正在使用Firebase REST API,并向api/v1/invoices?apikey=abc123执行GET请求以检索返回以下内容的发票:

{
    "id": "gsdfg23648967ot",
    "userId": "456uhdfgh45645",
    "number": null,
    "clientId": "hgsdfgdsfjgkrt",
    "invoiceDate": "2018-06-18T16:00:00.000Z",
    "amountGross": 28,
    "amountNet": "26",
    "amountPaid": 28,
    "paidAt": "2018-08-08T16:00:00.000Z",
    "salaryReceivedAt": null,
    "approvalDate": null,
    "approver": null,
    "rateVAT": 7.7,
    "vatTypeCode": null,
    "comments": null,
    "statusCode": 3,
    "changedAt": null,
    "createdAt": null
},
{
    "id": "tuitueryurtyu",
    "userId": "454523453245235234",
    "number": null,
    "clientId": "zzzzzzzz",
    "invoiceDate": "2018-05-07T16:00:00.000Z",
    "amountGross": 22.22,
    "amountNet": "22",
    "amountPaid": 22.22,
    "paidAt": "2018-08-20T22:00:00.000Z",
    "salaryReceivedAt": null,
    "approvalDate": null,
    "approver": null,
    "rateVAT": 7.7,
    "vatTypeCode": null,
    "comments": null,
    "statusCode": 3,
    "changedAt": null,
    "createdAt": null
},

我现在需要能够按日期范围过滤查询,因此它只返回invoiceDate在我指定的2个日期之间的所有结果。到目前为止,我甚至无法在API文档中找到有关如何按日期范围进行查询的示例,即使使用REST API也可以进行查询?

1 个答案:

答案 0 :(得分:1)

documentation中所述,您应该使用范围查询,如下所示:

{
    "key": "ReportCode",
    "type": "select",
    "className": "form-group dropdown-children",
    "templateOptions": {
        "label": "Report Code",
        "options": {
            "tablename": "HttpRequestHere",
            "label": "Name",
            "value": "Name"
        },
        "required": true
    }
}