Creating new projects through API

Hi,

I am trying to create a new project in ASANA using API by calling https://app.asana.com/api/1.0/projects

Error displayed is “Must supply either text or html text for status update.”

Data passed to the API is as below.

data = {
“workspace”:"*****",
“team”: “",
“archived”: “false”,
“color”: “light-green”,
“current_status”: {
“author”: {
“name”: "

},
“color”: “green”,
“created_by”: {
“name”: “****”
},
“html_text”: “The project is moving forward according to plan”,
“modified_at”: “null”,
“text”: “The project is moving forward according to plan…”,
“title”: “Status Update - Apr 25”
},

"default_view": "calendar",
"due_date": "2020-04-30",
"due_on": "2020-04-30",
"followers": "Michael Andrew",
"html_notes": "These are things we need to purchase.",
"is_template": "false",
"name": "Stuff to buy",
"notes": "These are things we need to purchase.",
"owner": "******",
"public": "false",
"start_on": "2020-04-10"

}

Could you please let me know if I am missing something?

For current_status, specify either text or html_text but not both. (Same for notes and html_notes.)

Also, if you are going to specify html_text and/or html_notes, in your current formatting they’ll generate errors because the contents of those fields have to be provided in a simplified HTML format - at a minimum, those fields have to be wrapped in a <body></body> tag.

I tried including text or html_text with the text wrapped inside tag. Still receiving the same error.

data = {
“workspace”:"",
“team”: "
",
“archived”: “false”,
“color”: “light-green”,
“default_view”: “calendar”,
“due_date”: “2020-04-30”,
“due_on”: “2020-04-30”,
“followers”: “",
“is_template”: “false”,
“name”: “Stuff to buy 1”,
“html_notes”: “These are things we need to purchase.”,
“owner”: "
”,
“public”: “false”,
“start_on”: “2020-04-10”,
“current_status”: {
“author”: {
“name”: “"
},
“color”:“green”,
“created_by”: {
“name”: "
Preformatted text
},
“modified_at”: “null”,
“html_text”: “The project is moving forward according to plan…”,
“title”: “Status Update - Apr 25”
}
}

Sorry, body tag got removed while posting the code here. However the issue still exists.

Afraid I’m not sure what the specific issue is, then. @Ross_Grambo maybe you could take a look at this?

With your content, I never got the error you were getting. However that body did have some other errors (like workspace & team both being declared, html_notes & html_text not having tags, etc).

Here’s an updated body that works for me:

{
  "data": {
		"team": "{team_gid}",
		"archived": "false",
		"color": "light-green",
		"default_view": "calendar",
		"due_date": "2020-04-30",
		"due_on": "2020-04-30",
		"followers": "",
		"is_template": "false",
		"name": "Stuff to buy 1",
		"html_notes": "<body>These are things we need to purchase.</body>",
		"owner": "me",
		"public": "false",
		"start_on": "2020-04-10",
		"current_status": {
			"author": {
				"name": ""
			},
			"color": "green",
			"created_by": {
				"name": "Preformatted text"
			},
			"modified_at": "null",
			"html_text": "<body>The project is moving forward according to plan…</body>",
			"title": "Status Update - Apr 25"
		}
  }
}

If this doesn’t work for you, I imagine the tool you’re using to make requests may be editing the request. Try it in Postman or Insomnia.

Hope this helps!

1 Like

@Ross_Grambo @Phil_Seeman,

Thanks for the help.

I was able to pass the value for current_status using postman as below

current_status[0]=test@test.com
current_status[1]=green

When I try to pass the value using python code through Zapier application I get an error ‘Must supply either text or html text for status update’.

It looks like the tool is not supporting current_status. However if I remove the parameter ‘current_status’ from the data that I am passing to API , it works through Zapier tool.

1 Like