Batch Project Duplication Error

I am trying to create a whole bunch of projects using the Batch API, the project duplication endpoint, and PowerShell. Unfortunately I’m getting this error on the batch request:
{
“errors”: [
{
“message”: “name: Missing input”,
“help”: “For more information on API status codes and how to handle them, read the docs on errors: https://developers.asana.com/docs/errors
}
]
}

I have checked the documentation and verified the content.
Sample payload:
{

    "data": {

        "actions": [

            {

                "method": "post",

                "relative_path": "/projects/0000000000000000/duplicate",

                "data": {

                    "schedule_dates": {

                        "start_on": "2021-02-01",

                        "should_skip_weekends": false

                    },

                    "name": "Name of project here",

                    "include": [

                        "members",

                        "task_subtasks",

                        "task_dependencies",

                        "task_projects",

                        "task_dates"

                    ],

                    "team": "1111111111111111"

                }

            }

        ]

    }

}

Hi @Juan_Perez_Perez and welcome to the forum!

Offhand your syntax does look correct for the duplication request.

@Ross_Grambo or @Jeff_Schneider, any thoughts on what this issue might be?

No idea what the issue is here, but I think we can blame powershell. I’m using Insomnia and your request works just fine for me:

https://app.asana.com/api/1.0/batch

{
	"data": {
		"actions": [
			{
				"method": "post",
				"relative_path": "/projects/123456789/duplicate",
				"data": {
					"schedule_dates": {
							"start_on": "2021-02-01",
							"should_skip_weekends": false
					},
					"name": "Name of project here",
					"include": [
							"members",
							"task_subtasks",
							"task_dependencies",
							"task_projects",
							"task_dates"
					],
					"team": "123456789"
				}
			}
		]
	}
}
1 Like

Why would you say Powershell works differently against the batch API from the regular duplication, task, and project endpoints? I’ve recently used those endpoints successfully.

Let me clarify the previous:
I’ve been using PowerShell with Asana without issues previously. I don’t see how it should be any different with the batch API. the main thing tripping me up is the error:

{
“errors”: [
{
“message”: “name: Missing input”,
“help”: “For more information on API status codes and how to handle them, read the docs on errors: https://developers.asana.com/docs/errors”
}
]
}

What does name: Missing input mean? What name? Where? What is PowerShell dropping that is batch endpoint specific?

name: Missing input is saying that name was missing from your request. The “Missing Input” errors are sometimes deceiving, because they can be caused by malformed json.

Because I validated that your json is valid and the request works with a different tool, I’m choosing to blame Powershell. I could be wrong, but that’s my conclusion so far.

That being said, I have no idea what Powershell could be doing differently. Perhaps It doesn’t like triple tabs, perhaps it’s escaping something in the request that it shouldn’t be (maybe the relative url?), or maybe it’s adding some additional header that’s causing this bug only for the Batch endpoint.

I’d recommend a few options to debug. Either:

  1. Log the raw http request being sent. This lets you see what’s truly being sent.
  2. Log the request with a proxy see what exactly is sent. ngrok works pretty well for this.
  3. Build the json 1 line at a time to see what section causes it to break.

If you’re able to get a log of the raw request and nothing looks incorrect, send it to me and I can help/better re-create the issue.

1 Like

Unfortunately I’m unable to get the raw request without procuring additional software and taking the additional time to trouble shoot that. I’ve opted to forego the batch API and use the duplication API directly. Unfortunately this means the task will take 5x as long since I wont be writing the concurrency code. Bang for buck kinda call.

1 Like