简体   繁体   English

如何使用REST API直接执行Zuora ZOQL查询

[英]How to execute Zuora ZOQL query directly using REST API

zuora-soap API provides ZOQL through query() and returns query results in that response itself. zuora-soap API通过query()提供ZOQL,并在该响应中返回查询结果。

I am looking for the same feature in zuora REST API. 我在zuora REST API中寻找相同的功能。 But it supports executing query through "export" or "batch-query" api. 但它支持通过“export”“batch-query” api执行查询。 Those API allows me to fetch the query results through another request using either by exportId or batchJobId. 这些API允许我使用exportId或batchJobId通过另一个请求获取查询结果。

But I am interested to received the query results in single request similar to zuora-soap. 但我有兴趣在单一请求中收到类似于zuora-soap的查询结果。 Is there any feature available in zuora REST API zuora REST API中是否有任何可用功能

POST /v1/action/query REST endpoint accepts ZOQL through queryString in JSON body. POST /v1/action/query REST端点通过JSON正文中的queryString接受ZOQL。 Here is an example HTTP request representing select Id, Name from Account ZOQL query 以下是一个示例HTTP请求,表示select Id, Name from Account ZOQL查询的select Id, Name from Account

POST /v1/action/query HTTP/1.1
Host: rest.apisandbox.zuora.com
apiAccessKeyId: some@example.com
apiSecretAccessKey: ************
Accept: application/json
Content-Type: application/json

{
    "queryString": "select Id, Name from Account"
}

which returns 返回

{
    "records": [
        {
            "Name": "DP test sync account 1",
            "Id": "2c92c0f85fde706c015feef1b4ca6e11"
        },
        {
            "Name": "001g000001nHTIoAAO",
            "Id": "2c92c0f85fde706c015ffd8d488b5e46"
        },
        ...

    ],
    "queryLocator": "2c92c0f867067b440167087646951e86-2000",
    "size": 2239,
    "done": false
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM