I am struggling a little in my project with Attask. My aim is to update the alignmentValues of a project using custom form data.. I have been able to create new alignment values to update but I am unable to execute it using put method... the request I want to execute is
PUT /attask/api/project/4c7...?updates=
{
alignmentValues: [
{
scoreCardOptionID: "2222...54d0",
scoreCardQuestionID : "8897...54d1",...
},....
]
}
my code snippet is
var request = new RestRequest("project/{id}", Method.PUT);
request.AddUrlSegment("id", pid);
request.RequestFormat = DataFormat.Json;
JObject _putData = new JObject();
_putData.Add("alignmentValues",newAnswers);
and for updates object I tried few combinations
request.AddParameter("updates",_putData,ParameterType.RequestBody); //no effect
request.AddBody(new {name = "updates", value = _putData}); //no effect
With this body approach I am even unable to update the name of project. But when I supply the parameters as query string, it successfully updates the name but fails for alignment values as the url becomes too large
var request = new RestRequest("project/{id}?updates=" + _putData , Method.PUT);
Above works if _putData is small...like name = "TEST"..but fails for big json array..
Any suggestions on how to update values using addbody/addobject/addjsonobject/addparameter...because I need to send request in body because of its large size...
Thanks in advance.