Unable to create task in workspace using python.

I have been pulling my hair out trying to create new tasks from a csv file and keep running into an asana error using the python-asana libraries: asana.error.InvalidRequestError: Invalid Request: Could not parse request data, invalid JSON…

Here is the code that is causing it.:

`self.df2 = pd.read_csv(self.reportPath+‘AsanaUpdate.csv’)

    for self.index, self.row in self.df2.iterrows():
        self.address = self.row['Address']
        self.siteFunction = self.row['Site Function']
        self.siteOem = self.row['OEM']
        self.whid = self.row['Name']
        self.dueDate = self.row['Due Date']
       # task_gid = self.row['gid']
        
        self.client.tasks.create_in_workspace(workspace,params = {'projects':self.demo,'resource_subtype':'milestone','name': self.whid,'due_on':self.dueDate,'custom_fields':{'1201681921644513':self.address,'1201283412998288':self.siteFunction,'1201283413026744': self.siteOem }}, opt_pretty = False)`

I understand that it is something with the formatting of my request but I am having a changing time sorting it out with the docs.

workspace is a global variable

Can you paste the full JSON object resulting from the code here?
I believe the error is that projects expects an array of string. Is that the case?

1 Like