Search code examples
attaskworkfront-api

markDone on Task object


I am trying to utilize the markDone action on the Task Object. My guess is that this is a PUT, but I have tried a POST. I have yet to try the GET with the parameter of PUT or POST, that I will try next. However I would prefer not to go this route. I am fairly new to Web API's and this is my first attempt at writing an API that talks to another API, so that could be playing into the issue. I am utilizing the HttpClient object and have tried PostAsync and PutAsync. Below is what I have currently.

    using (var apiManagementSystem = new HttpClient())
    {
        apiManagementSystem.BaseAddress = new Uri("https://xxxxxxx.preview.workfront.com/attask/api/");
        apiManagementSystem.DefaultRequestHeaders.Clear();
        apiManagementSystem.DefaultRequestHeaders.Add("SessionID", "xxxxxxx");
        HttpContent httpContent = new StringContent("?ID=xxxxxxx&action=markDone&status=CPL");
        HttpResponseMessage responseMessage = apiManagementSystem.PutAsync("Task", httpContent).Result;
    }

Even if you don't know if the above code is right maybe you would know what the URL would be or the headers should be.


Solution

  • I will try to help here but I am mostly working in Python and Javascript/Node. Regarding marking a task as done via an action, this would be a PUT call. Here is an example URL using the API key authentication method. For session key you would just switch to sessionID

    https://xxx.attask-ondemand.com/attask/api/v6.0/task/582df5e700e6243a8656824931a495b7?apiKey=xxxxxxx&action=markDone
    

    The UID after /task/ is the ID number of the task.