# Issue posting custom\_fields updates through Asana RestAPI

**URL:** <https://forum.asana.com/t/issue-posting-custom-fields-updates-through-asana-restapi/202405>\
**Category:** API & Developers\
**Tags:** custom-fields, tasks\
**Created:** [16 September 2022 11:17 UTC](https://forum.asana.com/t/issue-posting-custom-fields-updates-through-asana-restapi/202405 "2022-09-16T11:17:19Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon8946397](https://luna1.co/8d76cd.png) [@anon8946397](https://forum.asana.com/u/anon8946397)\
**Post date:** [16 September 2022 11:17 UTC](https://forum.asana.com/t/issue-posting-custom-fields-updates-through-asana-restapi/202405/1 "2022-09-16T11:17:19Z")

</div>

I am updating a task filed in a test project to reflect the time elapsed since creation in a clear way.

I am using the client.tasks.update(task[‘gid’], params=data) function to post this data format:

```auto
{
    "data": {
        "custom_fields": [
            {
                "gid": "1202936345777676",
                "enabled": true,
                "multi_enum_values": [
                    {
                        "gid": "1202936345777694",
                        "resource_type": "enum_option",
                        "enabled": true,
                        "name": "< 1 Month",
                        "color": "indigo"
                    }
                ],
                "name": "Age",
                "description": "",
                "created_by": {
                    "gid": "1202108515356173",
                    "name": "Carlo A. Fernandez Benedetto",
                    "resource_type": "user"
                },
                "display_value": "< 1 Month",
                "resource_subtype": "multi_enum",
                "resource_type": "custom_field",
                "type": "multi_enum"
            }
        ]
    }
}

```

The Asana.error I get is: “ValueError: dictionary update sequence element #0 has length 1; 2 is required”

Any help on the solution would be greatly appreciated

---

<div class="post-metadata">

**Author:** ![Bastien\_Siebman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/bastien_siebman/32/172354_2.png) [@Bastien\_Siebman](https://forum.asana.com/u/Bastien_Siebman)\
**Post date:** [16 September 2022 11:38 UTC](https://forum.asana.com/t/issue-posting-custom-fields-updates-through-asana-restapi/202405/2 "2022-09-16T11:38:48Z")

</div>

Hi,

Here’s the expected format to update a task’s custom fields:

```auto
{
 '123455':'a value',
'90364':'42'
}

```

the first number is the field gid, the second value is the actual value you want, either a dropdown option gid, a text, a number…

Make sure to check out [the body parameter on the right of the documentation.](https://developers.asana.com/docs/update-a-task)

Does this help?

---

<div class="post-metadata">

**Author:** ![anon8946397](https://luna1.co/8d76cd.png) [@anon8946397](https://forum.asana.com/u/anon8946397)\
**Post date:** [16 September 2022 14:24 UTC](https://forum.asana.com/t/issue-posting-custom-fields-updates-through-asana-restapi/202405/4 "2022-09-16T14:24:20Z")

</div>

Hi Bastien!

Thank you for your answer! Not sure what you mean on the 3rd line of your json, maybe you could help me with the context of my data? It is a custom drop down menu I created to display text in a column of the list view.

I tried with

```auto
{
    "data": {
        "custom_fields": {
            "1202936345777676": "1 Month or ++"
        }
    }
}

```

And with:

```auto
{
    "data": {
        "custom_fields": {
            "1202936345777676": "1202936345777694"
        }
    }
}

```

Both return the same issue.

“ValueError: dictionary update sequence element #0 has length 1; 2 is required”

What would be the 2nd level required?

`"Age" : "< 1 Month"` ?

---

<div class="post-metadata">

**Author:** ![Bastien\_Siebman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/bastien_siebman/32/172354_2.png) [@Bastien\_Siebman](https://forum.asana.com/u/Bastien_Siebman)\
**Post date:** [16 September 2022 18:30 UTC](https://forum.asana.com/t/issue-posting-custom-fields-updates-through-asana-restapi/202405/5 "2022-09-16T18:30:04Z")

</div>

I am not 100% sure but try the following:

```auto
{
custom_fields:{
'1202936345777676':['1202936345777694']
}
}

```

I’ll explain if it works 🙂

---

<div class="post-metadata">

**Author:** ![anon8946397](https://luna1.co/8d76cd.png) [@anon8946397](https://forum.asana.com/u/anon8946397)\
**Post date:** [19 September 2022 06:49 UTC](https://forum.asana.com/t/issue-posting-custom-fields-updates-through-asana-restapi/202405/6 "2022-09-19T06:49:42Z")

</div>

Hi Bastian,

Thank you again, but no luck with that either, I tried with this validated json:

```auto
{
  "data": {
    "custom_fields": {
      "1202936345777676": [
        "1202936345777680"
      ]
    }
  }
}

```

& with only:

```auto
{
  "custom_fields": {
    "1202936345777676": [
      "1202936345777680"
    ]
  }
}

```

---

<div class="post-metadata">

**Author:** ![anon8946397](https://luna1.co/8d76cd.png) [@anon8946397](https://forum.asana.com/u/anon8946397)\
**Post date:** [19 September 2022 06:51 UTC](https://forum.asana.com/t/issue-posting-custom-fields-updates-through-asana-restapi/202405/7 "2022-09-19T06:51:03Z")

</div>

I still get the same json lenght issue:

```auto
ValueError: dictionary update sequence element #0 has length 1; 2 is required

```

---

<div class="post-metadata">

**Author:** ![Bastien\_Siebman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/bastien_siebman/32/172354_2.png) [@Bastien\_Siebman](https://forum.asana.com/u/Bastien_Siebman)\
**Post date:** [19 September 2022 10:04 UTC](https://forum.asana.com/t/issue-posting-custom-fields-updates-through-asana-restapi/202405/8 "2022-09-19T10:04:10Z")

</div>

Can you use Postman for example to validate the format and numbers are correct before moving to another tech stack?

---

<div class="post-metadata">

**Author:** ![anon8946397](https://luna1.co/8d76cd.png) [@anon8946397](https://forum.asana.com/u/anon8946397)\
**Post date:** [20 September 2022 08:01 UTC](https://forum.asana.com/t/issue-posting-custom-fields-updates-through-asana-restapi/202405/9 "2022-09-20T08:01:45Z")

</div>

The numbers for the custom fields are taken from the full task view that displays them and are correct. According to this: [https://community.zapier.com/featured-articles-65/how-to-update-custom-fields-on-an-asana-task-9381](https://community.zapier.com/featured-articles-65/how-to-update-custom-fields-on-an-asana-task-9381)

```auto
{
  "data": {
    "custom_fields": {
      "1202936345777676": "1202936345777680"
    }
  }
}

```

Should work, but according to the asana error, my dictionary here on pos 0 (“data”) has a lenght of 1 when 2 is needed, so I don’t know what is expected. We dont have time to download Postman and check for this, but is a simple dict. length (ie. format) error. Is there any example or logs on how other users update this?

Could I please contact your API product owner, devs or support?

---

<div class="post-metadata">

**Author:** ![Bastien\_Siebman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/bastien_siebman/32/172354_2.png) [@Bastien\_Siebman](https://forum.asana.com/u/Bastien_Siebman)\
**Post date:** [20 September 2022 14:19 UTC](https://forum.asana.com/t/issue-posting-custom-fields-updates-through-asana-restapi/202405/10 "2022-09-20T14:19:23Z")

</div>

You can email _[api-support@asana.com](mailto:api-support@asana.com)_, the Asana dev team almost never answers here.

---

<div class="post-metadata">

**Author:** ![anon8946397](https://luna1.co/8d76cd.png) [@anon8946397](https://forum.asana.com/u/anon8946397)\
**Post date:** [12 October 2022 13:01 UTC](https://forum.asana.com/t/issue-posting-custom-fields-updates-through-asana-restapi/202405/11 "2022-10-12T13:01:52Z")

</div>

In case anyone runs into this, for custom fileds:

**Incorrect:**  
`{`  
` "data": {`  
` "custom_fields": {`  
` "1203012693580045": "1203012693586629"`  
` }`  
` }`  
`}`

**Correct:**  
`{`  
`"custom_fields": {`  
`"1203012693580045": "1203012693586629"`  
`}`  
`}`

Issue solved, thank you again!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/system/32/276370_2.png) [@system](https://forum.asana.com/u/system)\
**Post date:** [30 May 2025 18:56 UTC](https://forum.asana.com/t/issue-posting-custom-fields-updates-through-asana-restapi/202405/12 "2025-05-30T18:56:23Z")

</div>

Closed on 30 May 2025 18:56 UTC


