【发布时间】:2022-10-04 21:49:32
【问题描述】:
我现在遇到的问题是通过调用 ZohO GET 方法,然后我可以获得一次调用 - 200 个帐户,但是当我再次尝试调用时,我得到相同的 200 个帐户,我怎么能得到我所有的帐户?
我的代码:
RecordOperations recordOperations = new RecordOperations();
ParameterMap paramInstance = new ParameterMap();
paramInstance.Add(GetRecordsParam.APPROVED, "both");
paramInstance.Add(GetRecordsParam.SORT_ORDER, "asc");
paramInstance.Add(GetRecordsParam.PAGE, 1);
paramInstance.Add(GetRecordsParam.PAGE, 2);
paramInstance.Add(GetRecordsParam.PER_PAGE, 200);
paramInstance.Add(SearchRecordsParam.CRITERIA, "Account:equals:" + "Customer");
paramInstance.Add(SearchRecordsParam.CRITERIA, "Account:equals:" + "Sub-customer");
HeaderMap headerInstance = new HeaderMap();
APIResponse<ResponseHandler> response = recordOperations.GetRecords(moduleAPIName, paramInstance, headerInstance);
int totalAccounts = 0;
if (response != null)
{
ResponseHandler responseHandler = response.Object;
if (responseHandler is ResponseWrapper)
{
//Get the received ResponseWrapper instance
ResponseWrapper responseWrapper = (ResponseWrapper)responseHandler;
List<Record> records = responseWrapper.Data;
foreach (Record record in records)
{
totalAccounts++;
ZohoAccount account = new ZohoAccount(record);
accounts.Add(account.Account_Name.ToString(), account);
object accountName = record.GetKeyValue("Account_Name");
accountNamez.Add(accountName);
}
}
}
我试图使用 for 循环,但我每次都得到相同的帐户。然后我试图这样说: 第一次调用:
paramInstance.Add(GetRecordsParam.PAGE, 1);
paramInstance.Add(GetRecordsParam.PAGE, 2);
paramInstance.Add(GetRecordsParam.PER_PAGE, 200);
第二次调用:
paramInstance.Add(GetRecordsParam.PAGE, 3);
paramInstance.Add(GetRecordsParam.PAGE, 4);
paramInstance.Add(GetRecordsParam.PER_PAGE, 200);
它也不起作用,所以问题不在页面上。
有谁知道如何调用其他帐户?
Zoho 文档 API: https://www.zoho.com/crm/developer/docs/csharp-sdk/v2/record-samples.html? 你可以找到:获取一个模块的所有记录。
【问题讨论】:
-
为什么要设置参数 PAGE 两次?尝试为每个请求创建自己的“paramInstance”并设置 PAGE 一次。
-
@pakeha_by 因为通常每页有 100 个帐户,所以在第一次通话中我得到 200 个帐户,但下一个我得到完全相同的 200 个帐户,我试图弄清楚,但不要知道怎么做。