Can't update custom field value using Asana API

Please read this before posting


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
{ "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}" --data-urlencode "number_value=15.5"
The response is the same as above.

And this is node.js reques-promise:
 let uri = ''+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}'
                                    .then(function (parsedBody) {
                                       console.log('success!!!', parsedBody)
                                    .catch(function (err) {
                                        // POST failed...
Could someone please help me because i really don't know what am i doing wrong?

Hi @Nikola_Lucin,

Others have had this same issue - see this thread for more info:

@Ross_Grambo or @Joe_Trollo, maybe you can lend a hand here?

1 Like

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

PUT /tasks/<task-id>

  "data": {
    "custom_fields": {
      "1115652263994341": "10.5"
1 Like

Oh, sorry, @Joe_Trollo, personally I didn’t look closely enough before I summoned you :slight_smile: 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.


Thanks Joe_Trollo, that did the trick for me :slight_smile: