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.

Selecting a category  

Selecting a function  

HTTP GET:

https://api.aceproject.com/?fct=moveorcopytask&guid=b7740863-e586-413a-92b2-79df01c31fe8&fromprojectid=###&fromtaskid=###&toprojectid=###&move=False&newtasknumber=###&newestimatedstartdate=NULL&newestimatedenddate=NULL&weekendsallowed=False&newstatusid=###&newgroupid=###&newtypeid=###&newpriorityid=###&copycomments=False&copytaskdocuments=False&copyuserassignments=False&gettaskinreturn=False&format=DS


Function Details
Name Guid Required Description
MoveOrCopyTask True Moves an existing task to another project or copies an existing task to the same or another project.

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.
FromProjectId Integer False True Unique identifier of a project where the task is from.
FromTaskId Integer False True Unique identifier of a task to move or copy.
ToProjectId Integer False True Unique identifier of a project where the task is to be moved or copied.
Move Boolean False True or False False True Indicates whether to move or copy the task. If true, the task will be moved. If false, the task will be copied.
NewTaskNumber Decimal False Greater or equal to 0 True Unique number given to the new task. The number must be unique within the destination project.
NewEstimatedStartDate DateTime True NULL False Estimated start date of the new task.
NewEstimatedEndDate DateTime True NULL False Estimated end date of the new task.
WeekendsAllowed Boolean False True or False False True
NewStatusId Integer False True Unique identifier of a task status for the new task from the destination project.
NewGroupId Integer False True Unique identifier of a task group for the new task from the destination project.
NewTypeId Integer False True Unique identifier of a task type for the new task from the destination project.
NewPriorityId Integer False True Unique identifier of a task priority for the new task from the destination project.
CopyComments Boolean False True or False False True When Move is false, this parameter indicates whether to copy task comments to the new task.
CopyTaskDocuments Boolean False True or False False True When Move is false, this parameter indicates whether to copy task documents to the new task.
CopyUserAssignments Boolean False True or False False True When Move is false, this parameter indicates whether to copy user assignments to the new task.
GetTaskInReturn Boolean False True or False False True
Format String False RS: RecordSet
DS: DataSet
JSON: JSON
DS True Return Format

.Net Code:
Public Class Sample

    Public Sub CodeSample_moveorcopytask()
        Dim strXML As String = String.Empty

        Dim dsOutput As DataSet = Nothing
        Dim guid As String = String.Empty
        Dim sb As New System.Text.StringBuilder
        Try
            sb = New System.Text.StringBuilder
            'Building API QueryString
            sb.Append("fct=moveorcopytask")
            sb.Append(String.Format("&guid={0}", "c879daee-f503-4743-ac20-06eaaf35a776"))
            sb.Append(String.Format("&fromprojectid={0}", ###))
            sb.Append(String.Format("&fromtaskid={0}", ###))
            sb.Append(String.Format("&toprojectid={0}", ###))
            sb.Append(String.Format("&move={0}", False))
            sb.Append(String.Format("&newtasknumber={0}", ###))
            sb.Append(String.Format("&newestimatedstartdate={0}", "NULL"))
            sb.Append(String.Format("&newestimatedenddate={0}", "NULL"))
            sb.Append(String.Format("&weekendsallowed={0}", False))
            sb.Append(String.Format("&newstatusid={0}", ###))
            sb.Append(String.Format("&newgroupid={0}", ###))
            sb.Append(String.Format("&newtypeid={0}", ###))
            sb.Append(String.Format("&newpriorityid={0}", ###))
            sb.Append(String.Format("&copycomments={0}", False))
            sb.Append(String.Format("&copytaskdocuments={0}", False))
            sb.Append(String.Format("&copyuserassignments={0}", False))
            sb.Append(String.Format("&gettaskinreturn={0}", False))
            sb.Append(String.Format("&format={0}", "DS"))

            'Calling API
            strXML = CallHttp("https://api.aceproject.com/", sb.ToString)
            'Retreive Output structure generate by API
            dsOutput = Deserialize(Of DataSet)(strXML)
            If dsOutput IsNot Nothing AndAlso dsOutput.Tables.Count > 0 Then
                If dsOutput.Tables.Contains("dtAPIErrors") Then
                    Throw New Exception(String.Format("{0}: {1}", _
                                                      dsOutput.Tables(0).Rows(0).Item("ErrorNumber").ToString, _
                                                      dsOutput.Tables(0).Rows(0).Item("ErrorDescription").ToString))
                End If
            End If
        Catch ex As Exception
            Throw
        Finally
            If sb IsNot Nothing Then sb = Nothing
            If dsOutput IsNot Nothing Then
                dsOutput.Dispose()
                dsOutput = Nothing
            End If
        End Try
    End Sub

    Private Shared Function CallHttp( ByVal url As String, _ 
                                      ByVal params As String) As String
        Dim loHttp As System.Net.HttpWebRequest
        loHttp = CType(System.Net.WebRequest.Create(url), System.Net.HttpWebRequest)
        loHttp.Method = "POST"
        Dim requestWriter As System.IO.StreamWriter = New System.IO.StreamWriter(loHttp.GetRequestStream())

        If Not String.IsNullOrEmpty(params) Then
            requestWriter.Write(params)
        End If
        requestWriter.Close()
        loHttp.ContentType = "application/x-www-form-urlencoded"
        loHttp.Headers.Set("Pragma", "no-cache")
        loHttp.AllowAutoRedirect = True
        loHttp.KeepAlive = True
        loHttp.Timeout = 30 * 1000

        Dim loWebResponse As System.Net.HttpWebResponse = CType(loHttp.GetResponse(), System.Net.HttpWebResponse)
        Dim enc As Encoding = System.Text.Encoding.UTF8
        Dim loResponseStream As System.IO.StreamReader = New System.IO.StreamReader(loWebResponse.GetResponseStream(), enc)
        Dim lcHtml As String = loResponseStream.ReadToEnd()

        loWebResponse.Close()
        loResponseStream.Close()

        Return lcHtml
    End Function


    Private Shared Function Deserialize(Of T)( ByVal strXML As String) As T
        Dim objet As T = Nothing
        Dim objType As Type = GetType(T)
        Try
            If Not String.IsNullOrEmpty(strXML) Then
                Dim objSerializer As New System.Xml.Serialization.XmlSerializer(objType)
                Dim objText As New System.Text.StringBuilder()
                Dim objXmlReader As New System.IO.StringReader(strXML)
                objet = DirectCast(objSerializer.Deserialize(objXmlReader), T)
                objXmlReader.Close()
            End If
            Return objet
        Catch ex As Exception
            Throw
        Finally
            If objet IsNot Nothing Then objet = Nothing
        End Try
    End Function

End Class