Time Entry API - Adding Time Issue
Hello,
I am hoping someone can help me figure out what might be going on with the TimeEntry Api. I am successful at pulling back time entries with the search and putting them into a C# object, then pulling back the values, however, I am having the hardest time adding a new entry.
So, if I use the object I just pulled back and make changes to it and then submit it via POST it works perfectly, but when creating a new object of type TeamDynamix.Api.Time.TimeEntry I get this error every time:
ERROR. StatusCode=InternalServerError, ReasonPhrase=Internal Server Error.
Response content = {"ID":1874641,"Message":"An error occurred. Please try again, and contact TeamDynamix support and reference the Error ID if the problem persists."}
I know for a fact that my entries, IDs, types... are correct since I am pulling everything back from a time entry I put in. Once again if I use a time entry that I pull back and then modify and send it in as a new entry it works well. I even tried sending all none required fields, with no luck. Here is my C# code for creating and sending the list of entries that is producing the error:
TimeId = 0,
ItemId = 0,
Uid = "80ec4dbb-9e43-e611-80cc-000d3a13db68",
TimeTypeID = 4538,
AppID = 0,
ModType = TeamDynamix.Api.Time.TimeEntryComponent.TimeOff,
TicketID = 0,
Minutes = 60,
ProjectID = 264993,
PlanID = 0,
TimeDate = DateTime.Now,
};
{
Console.WriteLine("ERROR. StatusCode=" + oHttpResponseMsgX.StatusCode + ", ReasonPhrase=" + oHttpResponseMsgX.ReasonPhrase + ".");
Console.WriteLine("Response content = " + sResponse);
return;
}
TeamDynamix.Api.Time.BulkOperationResults timeEntryResult = JsonConvert.DeserializeObject<TeamDynamix.Api.Time.BulkOperationResults>(sResponse);
{
Console.WriteLine(failed.ErrorMessage);
{
Console.WriteLine(success.ID);
I am hoping someone at TDX has an idea of what might be going on.
Answers (3)
Hi Christian,
I can help you out with this. It looks like your time entry object is not including a Description property at all. You have actually discovered a small bug in the Time API. If you do not at least include the Description property with a value of "" you will continue to experience this issue. The objects you are retrieving back through GET /api/time/{id} or POST /api/time/search have this property normalized to "" and thus when you send it straight back as a new item it works.
The short-term workaround is to include Description with a value of "". Let me know if that helps to resolve the issue.
I will also enter this a bug on your behalf. You should not have to provide a blank value for Description for the API to process new or edited entries. Null values should be perfectly acceptable.
Let me know if this does not fully explain or resolve the behavior you are seeing.
Sincerely,
Matt Sayers
TeamDynamix
Hi Christian,
It was no problem at all. There is also a bug in on your behalf to fix the API issue too. Once that is resolved you'll be notified when the fix will be released.
Thanks again for reporting this!
Matt,
You are a 110% right. Added the description and everything is working as expected. I figured it was one of the fields, since grabbing a current object and re-submitting was working. I tested with a few but must have not reached description. Thank you so much for saving me time and for getting back to me so quickly.
Thanks again!
Christian Block