Hi, guys! I´ve been trying to use Asana API with python in order to update a Goal Metric, but i received an error. Let´s try to explain the way that i´m doing:
CONTEXT:
- I have a goal (GID: 1202041473787511). The api is working properly when i try to use the method
client.goals.get_goal(‘1202041473787511’). The JSON that i received was:
{‘gid’: ‘1202041473787511’,
‘resource_type’: ‘goal’,
‘due_on’: None,
‘start_on’: None,
‘owner’: {‘gid’: ‘1143580484324821’,
‘name’: ‘Bruno Zamberlan’,
‘resource_type’: ‘user’},
‘html_notes’: ‘’,
‘name’: ‘Aumentar a base de Maacs de 10 para 20’,
‘notes’: ‘’,
‘status’: None,
‘metric’: {‘gid’: ‘1202053434811034’,
‘resource_type’: ‘goal_metric’,
‘resource_subtype’: ‘number’,
‘precision’: 0,
‘unit’: ‘percentage’,
‘currency_code’: None,
‘initial_number_value’: 0,
‘target_number_value’: 1,
‘current_number_value’: 0,
‘current_display_value’: ‘0%’},
‘team’: None,
‘time_period’: {‘gid’: ‘1200580615819595’,
‘resource_type’: ‘time_period’,
‘end_on’: ‘2022-06-30’,
‘start_on’: ‘2022-04-01’,
‘period’: ‘Q2’,
‘display_name’: ‘Q2 FY22’},
‘is_workspace_level’: True,
‘followers’: [{‘gid’: ‘1143580484324821’,
‘name’: ‘Bruno Zamberlan’,
‘resource_type’: ‘user’}],
‘workspace’: {‘gid’: ‘15292640478948’,
‘name’: ‘take.net’,
‘resource_type’: ‘workspace’},
‘liked’: False,
‘likes’: ,
‘num_likes’: 0,
‘current_status_update’: None}
PROBLEM: I´m trying to update the metric for this GOAL with the method client.goals.update_goal_metric
I´m using the example provided on Asana Developers guide in this way:
client.goals.update_goal_metric(‘1202041473787511’, {“current_number_value”: 8.12}), but i´m receiving this error message:
TypeError: update_goal_metric() takes from 1 to 2 positional arguments but 3 were give
I´ve also tried in this way:
client.goals.update_goal_metric(‘1202041473787511’, {“data”: {“current_number_value”:8.12}}), but i´m still receiving:
TypeError: update_goal_metric() takes from 1 to 2 positional arguments but 3 were given
What should I do? Have you guys tried to use this module with Python? Thanks a lot!