api
api copied to clipboard
Patch request of completed task works on http request , but not update on app
I try to use the patch request to complete my task and I get a response for task completion, but it doesn't update on the wunderlist app. I did about 9 revision. I get a response that shows completion, but when I return to the app it shows no update. Here my response from the request:
{ "id": 3898040341, "created_at": "2018-06-01T10:20:00.703Z", "created_by_id": 24870738, "created_by_request_id": "worker:w:w:recurring_task_creator:parent-3858561041", "recurrence_type": "day", "recurrence_count": 1, "due_date": "2018-06-02", "completed": true, "completed_at": "2018-06-18T12:30:20.547Z", "completed_by_id": 24870738, "starred": false, "list_id": 350926181, "revision": 9, "title": "Turn on computer", "type": "task" }
It says I completed it today, but the apps didn't update on either my phone, tablet, or completed. Please help. Thanks.
Hi @RichardTwit I am trying to update the title of my task. can you share your patch CURL command please. I am trying with API nodejs. using code below.
updateTaskProperties(data) {
let updated_title = data.title + "#taskId:" + data.id + "";
data.title = updated_title;
console.log("updated_title data", data);
var update_data = {
'id': parseInt(data.id),
'title': updated_title
};
return new Promise(function (resolve, reject) {
wunderlistAPI.http.tasks.update(update_data)
.done(function (updatedTask) {
console.log("updateTaskProperties response", updatedTask);
resolve(updatedTask);
})
.fail(function (err) {
console.error('updateTaskProperties error', err);
reject(err);
});
})
}
its throwing an error.
updateTaskProperties error { errors: [ 'Error: Updating a resource requires an id of type number.' ] }
Update:
I was doing wrong.
here is the code which worked for me like a charm :)
updateTaskProperties(data) {
let original_title = data.title;
let updated_title = original_title + "#taskId:" + data.id + "";
data.title = updated_title;
var update_data = {
'title': updated_title
};
return new Promise(function (resolve, reject) {
wunderlistAPI.http.tasks.update(data.id, data.revision, update_data)
.done(function (updatedTask) {
console.log("updateTaskProperties response", updatedTask);
resolve(updatedTask);
})
.fail(function (err) {
console.error('updateTaskProperties error', err);
//reject(err);
data.title = original_title;
that.updateTaskProperties(data);
console.error('------Retrying update task title-------');
});
})
}