Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

I am looking for the same feature in zuora REST API. But it supports executing query through "export" or "batch-query" api. Those API allows me to fetch the query results through another request using either by exportId or batchJobId.

But I am interested to received the query results in single request similar to zuora-soap. Is there any feature available in zuora REST API

like image 931
Achaius Avatar asked Nov 08 '22 00:11

Achaius


1 Answers

POST /v1/action/query REST endpoint accepts ZOQL through queryString in JSON body. Here is an example HTTP request representing select Id, Name from Account ZOQL query

POST /v1/action/query HTTP/1.1
Host: rest.apisandbox.zuora.com
apiAccessKeyId: [email protected]
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
}
like image 152
Mario Galic Avatar answered Nov 15 '22 06:11

Mario Galic