Changing task section

Hello, I am trying to change a certain tasks section. I am using the following body while trying to do so.

"memberships": [{"project": 1131681448247237, "section": 1131889518013274}]

I have triple checked the project ID and the section ID as well but I constantly get the following error.

{"errors":[{"message":"No matching route for request","help":"For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors"}]}

Can anyone help me with this, cant figure out what I’m doing wrong?

Hi @Dylan4 and welcome to the forum!

That error indicates not that there is an issue with the IDs you’re passing but that there is a problem with the endpoint or the syntax of the request itself. Your best best for assistance therefore is to post the actual code you’re using to make the request.

@Phil_Seeman I am using the Requests library for python.

 headers = {'Authorization':'Bearer 0/XXXXXXXXXXXXXXXX}
 r2 = requests.post('https://app.asana.com/api/1.0/tasks/'+ str(item), headers=headers, data = {"memberships": [{"project": 1131681448247237, "section": 1131889518013274}]})

str(item) is the tasks ID, I have also tried to hardcode a specific ID into the request endpoint and the result is the same. I used this topic to help me.

The doc says you should use the /addProject endpoint, did you try?

3 Likes

Yeah, that was the issue. Must have missed that part of the documentation. Also had to change to data in the request to;

data = {"project": 1131681448247237, "section": 1131681448247243}

Instead of;

data = {"memberships": [{"project": 1131681448247237, "section": 1131889518013274}]}
2 Likes