【发布时间】:2019-06-01 16:38:44
【问题描述】:
我正在使用 dotnet Podio API 来获取和更新项目。每当我尝试使用 ItemService.UpdateItem() 函数更新具有应用关系的项目时,我都会遇到以下异常:
Invalid value {"files": [], "sharefile_vault_url": null, "title": "10", "app_item_id": 1, "app": {"status": "active", "sharefile_vault_url": null, ... "sharefile_vault_folder_id": null, "revision": 0} (object): must be integer
即使应用关系既未被访问也未被更改,也会发生这种情况。
似乎在使用关系更新项目时,关系必须是引用 id(或某个整数)并且不能是引用的对象本身,尽管在获取项目时提供了这一点。将关系设置为整数 id 没有帮助,并且会产生相同的异常。
如果项目模板具有应用关系,但单个项目的关系为空,则不会引发异常。
我尝试在 Podio 中重新创建应用程序,以查看应用程序的结构是否存在一些固有错误。
我尝试在更新项目之前将项目的关系更新为它已经引用的关系的 id。
我尝试过使用 ItemService.UpdateItemFieldValues() 函数。在这里,没有抛出异常,但也没有更新项目(如何在此函数中指定字段?)。
string clientId = "client";
string clientSecret = "secret";
int employeeAppId = 123456789;
var podio = new Podio(clientId, clientSecret);
podio.AuthenticateWithPassword("username", "password");
string employeeQrIdExternalId = "id";
Dictionary<string, object> filter = new Dictionary<string, object>
{
{employeeQrIdExternalId, "1234"}
};
var filteredItems = podio.ItemService.FilterItems(appId: employeeAppId, filters: filter);
Item employee = filteredItems.Items.First();
podio.ItemService.UpdateItem(employee); // exception is thrown
【问题讨论】: