Goals
Create a goal metric
Creates and adds a goal metric to a specified goal. Note that this replaces an existing goal metric if one already exists.
post/goals/{goal_gid}/setMetric
Request
- Base URL: https://app.asana.com/api/1.0
- URL: https://app.asana.com/api/1.0/goals/{goal_gid}/setMetric
- Auth: one of:
- HTTP bearer
- OAuth 2 (authorization code, authorization URL https://app.asana.com/-/oauth_authorize, token URL https://app.asana.com/-/oauth_token)
Query parameters
opt_fieldsstring[]
This endpoint returns a resource which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. Properties can include nested fields. To learn more, see the input/output options guide.
Request body
Example request
{
"data": {
"gid": "12345",
"resource_type": "task",
"resource_subtype": "number",
"precision": 2,
"currency_code": "EUR",
"initial_number_value": 5.2,
"target_number_value": 10.2,
"current_number_value": 8.12,
"current_display_value": "8.12",
"progress_source": "manual"
}
}Response
Successfully created a new goal metric.
Example response
{
"data": {
"gid": "12345",
"resource_type": "goal",
"name": "Grow web traffic by 30%",
"html_notes": "<body>Start building brand awareness.</body>",
"notes": "Start building brand awareness.",
"due_on": "2019-09-15",
"start_on": "2019-09-14",
"is_workspace_level": true,
"likes": [
{
"gid": "12345",
"user": {
"gid": "12345",
"resource_type": "user",
"name": "Greg Sanchez"
}
}
],
"num_likes": 5,
"team": {
"gid": "12345",
"resource_type": "team",
"name": "Marketing"
},
"workspace": {
"gid": "12345",
"resource_type": "workspace",
"name": "My Company Workspace"
},
"followers": [
{
"gid": "12345",
"resource_type": "user",
"name": "Greg Sanchez"
}
],
"time_period": {
"gid": "12345",
"resource_type": "time_period",
"end_on": "2019-09-14",
"start_on": "2019-09-13",
"period": "Q1",
"display_name": "Q1 FY22"
},
"metric": {
"gid": "12345",
"resource_type": "task",
"resource_subtype": "number",
"precision": 2,
"currency_code": "EUR",
"initial_number_value": 5.2,
"target_number_value": 10.2,
"current_number_value": 8.12,
"current_display_value": "8.12",
"progress_source": "manual",
"can_manage": true
},
"owner": {
"gid": "12345",
"resource_type": "user",
"name": "Greg Sanchez"
},
"current_status_update": {
"gid": "12345",
"resource_type": "status_update",
"title": "Status Update - Jun 15",
"resource_subtype": "project_status_update"
},
"status": "green",
"privacy_setting": "public_to_workspace",
"default_access_level": "editor",
"custom_fields": [
{
"gid": "12345",
"resource_type": "custom_field",
"name": "Status",
"enum_options": [
{
"gid": "12345",
"resource_type": "enum_option",
"name": "Low",
"enabled": true,
"color": "blue"
}
],
"enabled": true,
"representation_type": "number",
"id_prefix": "ID",
"input_restrictions": [
"task"
],
"date_value": {
"date": "2024-08-23",
"date_time": "2024-08-23T22:00:00.000Z"
},
"enum_value": {
"gid": "12345",
"resource_type": "enum_option",
"name": "Low",
"enabled": true,
"color": "blue"
},
"multi_enum_values": [
{
"gid": "12345",
"resource_type": "enum_option",
"name": "Low",
"enabled": true,
"color": "blue"
}
],
"number_value": 5.2,
"text_value": "Some Value",
"display_value": "blue"
}
],
"custom_field_settings": [
{
"gid": "12345",
"resource_type": "custom_field_setting",
"project": {
"gid": "12345",
"resource_type": "project",
"name": "Stuff to buy",
"resource_subtype": "default_project"
},
"parent": {
"gid": "12345",
"resource_type": "project",
"name": "Stuff to buy",
"resource_subtype": "default_project"
},
"custom_field": {
"gid": "12345",
"resource_type": "custom_field",
"name": "Status",
"enum_options": [
{
"gid": "12345",
"resource_type": "enum_option",
"name": "Low",
"enabled": true,
"color": "blue"
}
],
"enabled": true,
"representation_type": "number",
"id_prefix": "ID",
"input_restrictions": [
"task"
],
"date_value": {
"date": "2024-08-23",
"date_time": "2024-08-23T22:00:00.000Z"
},
"enum_value": {
"gid": "12345",
"resource_type": "enum_option",
"name": "Low",
"enabled": true,
"color": "blue"
},
"multi_enum_values": [
{
"gid": "12345",
"resource_type": "enum_option",
"name": "Low",
"enabled": true,
"color": "blue"
}
],
"number_value": 5.2,
"text_value": "Some Value",
"display_value": "blue",
"description": "Development team priority",
"precision": 2,
"format": "custom",
"currency_code": "EUR",
"custom_label": "gold pieces",
"custom_label_position": "suffix",
"is_global_to_workspace": true,
"has_notifications_enabled": true,
"asana_created_field": "priority",
"created_by": {
"gid": "12345",
"resource_type": "user",
"name": "Greg Sanchez"
},
"people_value": [
{
"gid": "12345",
"resource_type": "user",
"name": "Greg Sanchez"
}
],
"reference_value": [
{
"gid": "12345",
"resource_type": "task",
"name": "Bug Task"
}
],
"html_text_value": "<body>Some Value</body>",
"privacy_setting": "public_with_guests",
"default_access_level": "user",
"resource_subtype": "text"
}
}
]
}
}Changes
No recorded changes to this operation across all 2 revisions of this API.