All URIs are relative to https://app.asana.com/api/1.0
Method | HTTP request | Description |
---|---|---|
addSupportingRelationship | POST /goals/{goal_gid}/addSupportingRelationship | Add a supporting goal relationship |
getGoalRelationship | GET /goal_relationships/{goal_relationship_gid} | Get a goal relationship |
getGoalRelationships | GET /goal_relationships | Get goal relationships |
removeSupportingRelationship | POST /goals/{goal_gid}/removeSupportingRelationship | Removes a supporting goal relationship |
updateGoalRelationship | PUT /goal_relationships/{goal_relationship_gid} | Update a goal relationship |
Add a supporting goal relationship
Creates a goal relationship by adding a supporting resource to a given goal. Returns the newly created goal relationship record.
const Asana = require('asana');
let client = Asana.ApiClient.instance;
let token = client.authentications['token'];
token.accessToken = '<YOUR_ACCESS_TOKEN>';
let goalRelationshipsApiInstance = new Asana.GoalRelationshipsApi();
let body = {"data": {"<PARAM_1>": "<VALUE_1>", "<PARAM_2>": "<VALUE_2>",}}; // Object | The supporting resource to be added to the goal
let goal_gid = "12345"; // String | Globally unique identifier for the goal.
let opts = {
'opt_fields': "contribution_weight,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name"
};
goalRelationshipsApiInstance.addSupportingRelationship(body, goal_gid, opts).then((result) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
console.error(error.response.body);
});
Name | Type | Description | Notes |
---|---|---|---|
body | Object | The supporting resource to be added to the goal | |
goal_gid | String | Globally unique identifier for the goal. | |
opt_fields | Object | This endpoint returns a compact 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. | [optional] |
object
- Content-Type: application/json; charset=UTF-8
- Accept: application/json; charset=UTF-8
Get a goal relationship
Returns the complete updated goal relationship record for a single goal relationship.
const Asana = require('asana');
let client = Asana.ApiClient.instance;
let token = client.authentications['token'];
token.accessToken = '<YOUR_ACCESS_TOKEN>';
let goalRelationshipsApiInstance = new Asana.GoalRelationshipsApi();
let goal_relationship_gid = "12345"; // String | Globally unique identifier for the goal relationship.
let opts = {
'opt_fields': "contribution_weight,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name"
};
goalRelationshipsApiInstance.getGoalRelationship(goal_relationship_gid, opts).then((result) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
console.error(error.response.body);
});
Name | Type | Description | Notes |
---|---|---|---|
goal_relationship_gid | String | Globally unique identifier for the goal relationship. | |
opt_fields | Object | This endpoint returns a compact 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. | [optional] |
object
- Content-Type: Not defined
- Accept: application/json; charset=UTF-8
Get goal relationships
Returns compact goal relationship records.
const Asana = require('asana');
let client = Asana.ApiClient.instance;
let token = client.authentications['token'];
token.accessToken = '<YOUR_ACCESS_TOKEN>';
let goalRelationshipsApiInstance = new Asana.GoalRelationshipsApi();
let supported_goal = "12345"; // String | Globally unique identifier for the supported goal in the goal relationship.
let opts = {
'limit': 50,
'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9",
'resource_subtype': "subgoal",
'opt_fields': "contribution_weight,offset,path,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name,uri"
};
goalRelationshipsApiInstance.getGoalRelationships(supported_goal, opts).then((result) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
console.error(error.response.body);
});
Name | Type | Description | Notes |
---|---|---|---|
supported_goal | String | Globally unique identifier for the supported goal in the goal relationship. | |
limit | Number | Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] |
offset | String | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. Note: You can only pass in an offset that was returned to you via a previously paginated request. | [optional] |
resource_subtype | String | If provided, filter to goal relationships with a given resource_subtype. | [optional] |
opt_fields | Object | This endpoint returns a compact 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. | [optional] |
object
- Content-Type: Not defined
- Accept: application/json; charset=UTF-8
Removes a supporting goal relationship
Removes a goal relationship for a given parent goal.
const Asana = require('asana');
let client = Asana.ApiClient.instance;
let token = client.authentications['token'];
token.accessToken = '<YOUR_ACCESS_TOKEN>';
let goalRelationshipsApiInstance = new Asana.GoalRelationshipsApi();
let body = {"data": {"<PARAM_1>": "<VALUE_1>", "<PARAM_2>": "<VALUE_2>",}}; // Object | The supporting resource to be removed from the goal
let goal_gid = "12345"; // String | Globally unique identifier for the goal.
goalRelationshipsApiInstance.removeSupportingRelationship(body, goal_gid).then((result) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
console.error(error.response.body);
});
Name | Type | Description | Notes |
---|---|---|---|
body | Object | The supporting resource to be removed from the goal | |
goal_gid | String | Globally unique identifier for the goal. |
object
- Content-Type: application/json; charset=UTF-8
- Accept: application/json; charset=UTF-8
Update a goal relationship
An existing goal relationship can be updated by making a PUT request on the URL for that goal relationship. Only the fields provided in the data
block will be updated; any unspecified fields will remain unchanged. Returns the complete updated goal relationship record.
const Asana = require('asana');
let client = Asana.ApiClient.instance;
let token = client.authentications['token'];
token.accessToken = '<YOUR_ACCESS_TOKEN>';
let goalRelationshipsApiInstance = new Asana.GoalRelationshipsApi();
let body = {"data": {"<PARAM_1>": "<VALUE_1>", "<PARAM_2>": "<VALUE_2>",}}; // Object | The updated fields for the goal relationship.
let goal_relationship_gid = "12345"; // String | Globally unique identifier for the goal relationship.
let opts = {
'opt_fields': "contribution_weight,resource_subtype,supported_goal,supported_goal.name,supported_goal.owner,supported_goal.owner.name,supporting_resource,supporting_resource.name"
};
goalRelationshipsApiInstance.updateGoalRelationship(body, goal_relationship_gid, opts).then((result) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
console.error(error.response.body);
});
Name | Type | Description | Notes |
---|---|---|---|
body | Object | The updated fields for the goal relationship. | |
goal_relationship_gid | String | Globally unique identifier for the goal relationship. | |
opt_fields | Object | This endpoint returns a compact 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. | [optional] |
object
- Content-Type: application/json; charset=UTF-8
- Accept: application/json; charset=UTF-8