While doing some research on the topic through https://clickup.com/api, I stumbled across some code. There are a couple of different ones for different things, I'd recommend the first, JavaScript (as that's whats closest to what your currently doing). In a comment you said it was for editing tasks so that's what this code is aimed for.
javascript
var request = new XMLHttpRequest();
request.open('PUT', 'https://api.clickup.com/api/v1/task/{task_id}');
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Authorization', '"access_token"');
request.onreadystatechange = function () {
if (this.readyState === 4) {
console.log('Status:', this.status);
console.log('Headers:', this.getAllResponseHeaders());
console.log('Body:', this.responseText);
}
};
var body = {
'name': 'New Task Name',
'content': 'New Task Content',
'assignees': {
'add': [
1
],
'rem': [
2
]
},
'status': 'Closed',
'priority': 3,
'due_date': '1508369194377'
};
request.send(JSON.stringify(body));
curl
curl --include \
--request PUT \
--header "Content-Type: application/json" \
--header "Authorization: "access_token"" \
--data-binary "{
\"name\": \"New Task Name\",
\"content\": \"New Task Content\",
\"assignees\": {
\"add\" : [
1
],
\"rem\" : [
2
]
},
\"status\": \"Closed\",
\"priority\": 3,
\"due_date\": \"1508369194377\"
}" \
'https://api.clickup.com/api/v1/task/{task_id}'
node.js
var request = require('request');
request({
method: 'PUT',
url: 'https://api.clickup.com/api/v1/task/{task_id}',
headers: {
'Content-Type': 'application/json',
'Authorization': '\'access_token\''
},
body: "{ \"name\": \"New Task Name\", \"content\": \"New Task Content\", \"assignees\": { \"add\": [ 1 ], \"rem\": [ 2 ] }, \"status\": \"Closed\", \"priority\": 3, \"due_date\": \"1508369194377\"}"
}, function (error, response, body) {
console.log('Status:', response.statusCode);
console.log('Headers:', JSON.stringify(response.headers));
console.log('Response:', body);
});
This is aimed for production let me know if you need mock server
or debugging proxy