API Call Samples

We reserve the right to log and verify your API calls and to contact you if we detect abuse on your part. For example:
  • the requests takes too long to return
  • the requests return too much data at a time
  • The requests are too frequent
We strongly suggest using the date filter parameters to return only the data that is relevant.
Best practice for SaveWorkItem function

These parameters are exclusive to Timeclocks:

  • InDateTime
  • OutDateTime

If you try to pass those parameters for a normal time entry, you'll receive an error, even if you pass a NULL value.


Select category  

Select function  

Function Details
Name Guid Required Description
SaveWorkItem True Creates a time sheet entry (work item) if no TimesheetLineId is specified, or updates an existing time sheet entry (work item) when a valid TimesheetLineId is specified.

Code Sample (Visual Basic, Dotnet Framework 4.x):
Public Class Sample
	
	Public Sub CodeSample_saveworkitem()
		Dim params = New NameValueCollection From {
					{"fct", "saveworkitem"},
					{"guid", "###"},
					{"timesheetlineid", "NULL"},
					{"weekstart", "NULL"},
					{"timetypeid", "NULL"}
		}

		Dim jsonText = apiCall(params)

		' https://www.newtonsoft.com/json suggested for JSON parsing to DotNet framework 4.x
		Dim jsonObj = Newtonsoft.Json.Linq.JObject.Parse(jsonText)

		Dim success = jsonObj.Item("status").ToString <> "fail"
		Dim jResults = DirectCast(jsonObj.Item("results"), Newtonsoft.Json.Linq.JArray)

		
	End Sub
	    
	Function apiCall(_param As NameValueCollection) As String

		Dim wc As New System.Net.WebClient With {
			.Encoding = System.Text.Encoding.UTF8
		}

		' may be needed on some machines
		Net.ServicePointManager.SecurityProtocol = CType(Net.SecurityProtocolType.Tls12, Net.SecurityProtocolType)

		_param.Item("format") = "iso8601" ' json, with dates formatted as ISO8601 string

		Dim responseBytes = wc.UploadValues("https://api.aceproject.com", "POST", _param)
		Return System.Text.Encoding.UTF8.GetString(responseBytes)

	End Function

End Class

Parameter Details
Name DataType Is Nullable Max length Domain Values Default Value Is Required
(Insert)
Is Required
(Update)
Is Required Description
Guid String False True Unique identifier for the authenticated user. The GUID has an expiry date and time which is managed automatically by the API.
UserId Integer True NULL False Auto-generated unique identifier of a user. The time item is created for that user. If nothing, the item will be created for the current user (guid)
TimesheetLineId Integer True NULL False True Auto-generated unique time sheet entry (work item) identifier.
WeekStart DateTime True NULL True False Date of start of the week on which the item will be created or updated time. If the date is not the first day of the week as specified in the account information, the system finds the first day of the week including the specified date.
ProjectId Integer True NULL False Auto-generated unique identifier of a project. Optional if TaskId exists.
TaskId Integer True NULL False Auto-generated unique identifier of a task.
TimetypeId Integer True NULL True False Auto-generated unique identifier of a time type.
HoursDay1 Decimal True 0 to 24 NULL False Number of hours for the time sheet entry (work item) on the first day of the week.
HoursDay2 Decimal True 0 to 24 NULL False Number of hours for the time sheet entry (work item) on the second day of the week.
HoursDay3 Decimal True 0 to 24 NULL False Number of hours for the time sheet entry (work item) on the third day of the week.
HoursDay4 Decimal True 0 to 24 NULL False Number of hours for the time sheet entry (work item) on the forth day of the week.
HoursDay5 Decimal True 0 to 24 NULL False Number of hours for the time sheet entry (work item) on the fifth day of the week.
HoursDay6 Decimal True 0 to 24 NULL False Number of hours for the time sheet entry (work item) on the sixth day of the week.
HoursDay7 Decimal True 0 to 24 NULL False Number of hours for the time sheet entry (work item) on the seventh day of the week.
InDatetime DateTime True NULL False Start datetime of the time clock.
OutDatetime DateTime True NULL False End datetime of the time clock.
Comments String True NULL False Any user-defined comment related to the time sheet entry (work item).
Format String False RS: RecordSet
DS: DataSet
JSON: JSON
DS True Return Format