0

The documentation for tasks seems to imply that the POST method uses name/value pairs as the data payload (I'm assuming for a content type of application/x-www-form-urlencoded). Can it accept JSON instead, using the same format as the data returned from a GET call for tasks?

Also, the Memberships field is supposed to contain an array of projects and sections. There's already a Projects field for a task - do those projects need to be duplicated in the list of projects for Memberships or can just the sections be included?

Eric Legault
  • 5,706
  • 2
  • 22
  • 38

1 Answers1

1

Yep, it's totally possible to use a JSON payload (with the correct Content-Type: application/json) - in fact, in a number of scenarios - like this one - it's considerably easier.

I don't recall off of the top of my head the right way to get this going with form data (if I recall, we might have an outstanding bug filed about it :) ), but with JSON, you should be fine if you specify the project in both locations. I don't think you can get away with not specifying any values in projects (unless you specify a workspace, which might work).

I don't think you can specify only the section. Finally, I think if you specify a different project in each location, it will put it into both: into projects in the "no section" area for whichever ones are in the projects property and put it in the specified sections for those specified in memberships

Matt
  • 10,434
  • 1
  • 36
  • 45
  • Thanks Matt! I verified that passing JSON works. Also, specifying the workspace and not the project - but including the project in memberships - does work: {"data":{"assignee":null,"workspace":498346170860,"name":"API task test 1","notes":"foo","memberships":[{"project":196088968112497,"section":312569582206944}]}} – Eric Legault Apr 10 '17 at 01:41