POST /goals/{goal_gid}/setMetric

Creates and adds a goal metric to a specified goal. Note that this replaces an existing goal metric if one already exists.

Servers

Path parameters

Name Type Required Description
goal_gid String Yes

Globally unique identifier for the goal.

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Query parameters

Name Type Required Description
opt_pretty Boolean No

Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.

opt_fields[] Array No

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.

Request body fields

Name Type Required Description
data Object No

A generic Asana Resource, containing a globally unique identifier.

data.progress_source String No

This field defines how the progress value of a goal metric is being calculated. A goal's progress can be provided manually by the user, calculated automatically from contributing subgoals, projects, or tasks, or managed by an integration with an external data source, such as Salesforce.

Valid values:

  • "manual"
  • "external"
  • "subgoal_progress"
  • "task_completion"
  • "project_task_completion"
  • "project_milestone_completion"
data.resource_type String No

The base type of this resource.

data.currency_code String No

ISO 4217 currency code to format this custom field. This will be null if the unit is not currency.

data.gid String No

Globally unique identifier of the resource, as a string.

data.target_number_value Number No

This number is the end value of a goal metric of type number. This number cannot equal initial_number_value.

data.current_display_value String No

This string is the current value of a goal metric of type string.

data.is_custom_weight Boolean No

Conditional. Only relevant if metric.progress_source is one of subgoal_progress, project_task_completion, project_milestone_completion, or task_completion. If true, we use the supporting object's custom weight to calculate the goal's progress. If false, we treat all supporting objects as equally weighted

data.resource_subtype String No

The subtype of this resource. Different subtypes retain many of the same fields and behavior, but may render differently in Asana or represent resources with different semantic meaning.

Valid values:

  • "number"
data.precision Integer No

Conditional. Only relevant for goal metrics of type Number. This field dictates the number of places after the decimal to round to, i.e. 0 is integer values, 1 rounds to the nearest tenth, and so on. Must be between 0 and 6, inclusive. For percentage format, this may be unintuitive, as a value of 0.25 has a precision of 0, while a value of 0.251 has a precision of 1. This is due to 0.25 being displayed as 25%.

data.current_number_value Number No

This number is the current value of a goal metric of type number.

data.initial_number_value Number No

This number is the start value of a goal metric of type number.

data.unit String No

A supported unit of measure for the goal metric, or none.

Valid values:

  • "currency"
  • "none"
  • "percentage"

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.