I am new to Podio and consuming Podio API in c# .net. I am able to fetch item collections, create item using API and webhooks in .Net. But I am stuck up on updating item. I am using webhook on item update of ITEMX.Update. But I am getting error while updating the item.
While testing I have tried,
- To assign new values to fields.
- Just fetched item using ItemId and immediately called ItemUpdate() method without any change to fetched item
But still getting error. Last sentence of error message says:
"\\"item_id\\": 99999999, \\"revision\\": 0} (object): must be integer\",\"request\":{\"url\":\"http://api.podio.com/item/9999999\",\"query_string\":\"\",\"method\":\"PUT\"}}"}
I tried many things and refereed lot of documentation but didn't found solution. Can someone please help to get this done?
'
public static async Task<int> UpdateCalculationsInGMApp(int appItemId)
{
//Get related GMApp
try
{
var _Podio = new Podio(Helper.ApiClientId, Helper.ClientSecret);
AppMaster Ratesapp = Helper.GetAppToken("Costing Rates", "VikramTestWS");
await _Podio.AuthenticateWithApp(Ratesapp.AppId, Ratesapp.Token);
Item ratesPodioItem = await _Podio.ItemService.GetItem(appItemId);
//Item fetched successfully here
//thentried to set one of the field with new value. Later on commented and tested but didn't worked
//var pm_Rate = ratesPodioItem.Field<NumericItemField>("pm-rate");
//pm_Rate.Value = 100;
try
{
int x = (int)await _Podio.ItemService.UpdateItem(ratesPodioItem, null, null, true, true);
}
catch (Exception excp)
{
Logger.AddToLog(DateTime.Now, excp.Message, "Error: updating podio item" + ratesPodioItem.ItemId.ToString());
}
}
}'
You might be using the fetched item object itself to to update back to Podio. That will not work. You need to create a brand new Item object and do the update job. See the documentation here: http://podio.github.io/podio-dotnet/items/