Time Entry API - Adding Time Issue


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:

var oTDXTimeEntry = new TeamDynamix.Api.Time.TimeEntry {
                                        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,
   var tdxTimeEntries = new List<TeamDynamix.Api.Time.TimeEntry> { oTDXTimeEntry };
   oHttpResponseMsgX = await oHttpClientX.PostAsJsonAsync("time", tdxTimeEntries);
   sResponse = oHttpResponseMsgX.Content.ReadAsStringAsync().Result;
    if (!oHttpResponseMsgX.IsSuccessStatusCode)
          Console.WriteLine("ERROR.  StatusCode=" + oHttpResponseMsgX.StatusCode + ", ReasonPhrase=" + oHttpResponseMsgX.ReasonPhrase + ".");
          Console.WriteLine("Response content = " + sResponse);
    TeamDynamix.Api.Time.BulkOperationResults timeEntryResult = JsonConvert.DeserializeObject<TeamDynamix.Api.Time.BulkOperationResults>(sResponse);
     foreach (var failed in timeEntryResult.Failed)
      foreach (var success in timeEntryResult.Succeeded)

I am hoping someone at TDX has an idea of what might be going on.

Tags c API timeentry time add-time
Asked by Christian Block on Wed 8/9/17 9:47 PM
Sign In to leave feedback or contribute an answer

Answers (3)

This answer has been marked as the accepted answer
Matt Sayers Thu 8/10/17 9:56 AM

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.

Matt Sayers

No feedback

Matt Sayers Thu 8/10/17 9:03 PM

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!

No feedback

Christian Block Thu 8/10/17 6:36 PM


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



No feedback