0

我正在尝试将我的模块的全部内容从 Zoho 获取到我们的本地服务器。洪水代码确实有效,因为它将通过 API 发送的数据返回给我。但是,一旦它到达 API,它就为空。任何的想法?

以下是洪水代码:

// Create a map that holds the values of the new contact that needs to be created
evaluation_info = Map();
evaluation_info.put("BulkData",zoho.crm.getRecords("Publishers"));

data = Map();
data.put(evaluation_info);

response = invokeurl
[
  url :"https://zohoapi.xxxxx.com/publisher/publish"
  type :POST
  parameters:data
  connection:"zohowebapi"
];
info data; (data returns all the data from publishers)

这是我的 ASP.NET 核心 restful API。它确实 ping 它并创建文件,但文件的内容为空。

Route("[controller]")]
[ApiController]
public class PublisherController : ControllerBase
{
    [HttpGet("[action]"), HttpPost("[action]")]
    
    public void Publish(string data)
    {
        (it's already null when it comes here. why?)

        string JSONresult = JsonConvert.SerializeObject(data);
        string path = @"C:\storage\journalytics_evaluationsv2.json";

        using (var file = new StreamWriter(path, true))
        {
            file.WriteLine(JSONresult.ToString());
            file.Close();
        }
    }
}

}

我错过了什么?谢谢

4

1 回答 1

0

联系 Zoho 支持后,他提供的解决方案是遍历数据以获取模块中的所有内容(如果它们超过 200 条记录。使用提供的解决方案,人们不再需要 deluge 代码,因为只要您在代码中将 ZOHO api 设置为您的帐户。这是我的最终解决方案。此解决方案根本不可扩展。最好使用 BULK CSV。

//  Our own ZohoAPI which lets us connect and authenticate etc. Yours may look slightly different
ZohoApi zohoApi = new ZohoApi();
zohoApi.Initialize();
ZCRMRestClient restClient = ZCRMRestClient.GetInstance();

 var allMedicalJournals = new List<ZCRMRecord>();
 for (int i = 1; i <= 30; i++)
 {
     List<ZCRMRecord> accountAccessRecords2 = 
    restClient.GetModuleInstance("Journals").SearchByCriteria("Tag:equals:MedicalSet", i, 200).BulkData.ToList();

    foreach (var newData in accountAccessRecords2) 
         allMedicalJournals.Add(newData);
 }
于 2020-11-03T01:32:57.010 回答