Search code examples
asanaasana-api

What is the correct type of the 'section' parameter in tasks/task_id/addProject?


I have the following task:

$ curl "https://app.asana.com/api/1.0/tasks/259676837324664" | jq
{
  "data": {
    "id": 259676837324664,
    "assignee": {
      "id": 202581546604537,
      "name": "Leonid"
    },
    "assignee_status": "inbox",
    "completed": false,
    "completed_at": null,
    "created_at": "2017-02-01T13:53:31.556Z",
    "custom_fields": [],
    "due_at": null,
    "due_on": "2017-02-02",
    "followers": [
      {
        "id": 190628515114637,
        "name": "Remco"
      },
      {
        "id": 202581546604537,
        "name": "Leonid"
      }
    ],
    "hearted": false,
    "hearts": [],
    "memberships": [
      {
        "project": {
          "id": 256988229703133,
          "name": "MS2: Private ICO"
        },
        "section": {
          "id": 256988229703195,
          "name": "Week 04"
        }
      }
    ],
    "modified_at": "2017-02-02T09:05:16.906Z",
    "name": "Test Web3 detection/operation in Parity/Metamask/Mist",
    "notes": "",
    "num_hearts": 0,
    "parent": null,
    "projects": [
      {
        "id": 256988229703133,
        "name": "MS2: Private ICO"
      }
    ],
    "tags": [],
    "workspace": {
      "id": 163713730991759,
      "name": "Neufund"
    }
  }
}

I want to move it to the bottom of section 'Week 04':

$ curl -X POST "https://app.asana.com/api/1.0/tasks/259676837324664/addProject"\
    -d "section=256988229703195&insertBefore=null&project=256988229703133" | jq
{
  "errors": [
    {
      "message": "section: Not the correct type",
      "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"
    }
  ]
}

I took the section.id and used it as the section parameter. This is how I understood the API documentation. The error suggests that this is incorrect.

What did I do wrong?

(Authentication token header left out for obvious reasons. I can move the task to the bottom in the web interface with the same account, so authorization is not an issue)


Solution

  • The functionality to deal with boards projects is currently behind a flag. I've enabled the flag for your organization, so please let us know if you still encounter issues.

    Note that you cannot specify both the section and insert_before parameters on the POST /tasks/:task/addProject endpoint.