I’m trying to update custom field value using ```
PUT /custom_fields/{custom_field_gid}
but for some reason i can't update its value. The thing is that i get 200 as a response, but the custom field value is not updated. I tried using postman, curl and node.js request-promise but the result is always the same. in postman i'm using PUT https://app.asana.com/api/1.0/custom_fields/1115652263994341
{ "data": { "number_value": 10.5}}
and this is the response i get:
{
"data": {
"gid": "1115652263994341",
"id": 1115652263994341,
"resource_type": "custom_field",
"resource_subtype": "number",
"type": "number",
"name": "sum hours",
"description": "",
"is_global_to_workspace": true,
"precision": 1
}
}
this is my cURL: curl --request PUT -H "Authorization: Bearer {token}" https://app.asana.com/api/1.0/custom_fields/1115652263994341 --data-urlencode "number_value=15.5"
The response is the same as above.
And this is node.js reques-promise:
let uri = 'https://app.asana.com/api/1.0/custom_fields/'+singleCustomField.gid;
const options = {
method: 'PUT',
uri: uri,
body: {
data: {
number_value: singleCustomField.number_value + tasks.tracked
}
},
json: true, // Automatically stringifies the body to JSON
headers: {
'User-Agent': 'Request-Promise',
'Content-Type': 'application/json',
'Authorization': 'Bearer {token}'
}
};
rp(options)
.then(function (parsedBody) {
console.log('success!!!', parsedBody)
})
.catch(function (err) {
// POST failed...
console.log(err);
});
Could someone please help me because i really don't know what am i doing wrong?
The issue here is that you’re trying to update the definition of a custom field, not the value of a custom field on a task. The API call you want is something like
Oh, sorry, @Joe_Trollo, personally I didn’t look closely enough before I summoned you and assumed it was the same issue as that other thread.
For future reference, perhaps you could take a look at that other thread? We were never able to get it to work using CURL - it returns the task we updated and returns a 200, but the returned object doesn’t contain the change we submitted.
Hi Joe, any chance you can have a look on my problem. I see that your suggestion helps others but for some reason I keep hetting errors. This is what I did to test it in Postman:
Thank you Ross for the quick reply here!
I tried to paste your syntax to Postman and get an error again. Any chance you can guide me on what should I put in the Postman (Raw) box? I’m not a developer so just need the correct template in order to use on my integration tool. Once I’ll have it I’ll place the future values dynamically inside. Thanks!
It might not be a popular opinion, but does anyone know how to do this in R? I have been able to create, update tasks in Asana through R but not able to figure out how to assign value to a custom field.
Any help will be much appreciated!! Thanks!
Using Asana package in R and using access token, so yes. This is my first time doing it. I primarily do it to create bulk tasks and then there is a custom field that needs to be assigned to a member.