Skip to content

Latest commit

 

History

History
105 lines (74 loc) · 4.97 KB

CustomTypesApi.md

File metadata and controls

105 lines (74 loc) · 4.97 KB

Asana.CustomTypesApi

All URIs are relative to https://app.asana.com/api/1.0

Method HTTP request Description
getCustomType GET /custom_types/{custom_type_gid} Get a custom type
getCustomTypes GET /custom_types Get all custom types associated with an object

getCustomType

Get a custom type

Required scope: custom_types:read Returns the complete custom type record for a single custom type.

(more information)

Example

const Asana = require('asana');

let client = new Asana.ApiClient();
client.authentications.token.accessToken = '<YOUR_ACCESS_TOKEN>';

let customTypesApiInstance = new Asana.CustomTypesApi(client);
let custom_type_gid = "12345"; // String | Globally unique identifier for the custom type.
let opts = { 
    'opt_fields': "asana_created_type_identifier,name,status_options,status_options.color,status_options.completion_state,status_options.enabled,status_options.name"
};
customTypesApiInstance.getCustomType(custom_type_gid, opts).then((result) => {
    console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
    console.error(error.response.body);
});

Parameters

Name Type Description Notes
custom_type_gid String Globally unique identifier for the custom type.
opt_fields Object 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. [optional]

Return type

object

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json; charset=UTF-8

getCustomTypes

Get all custom types associated with an object

Required scope: custom_types:read Returns a list of all of the custom types associated with an object. Exactly one of project or workspace must be provided as a query parameter. When workspace is provided, all custom types in the workspace are listed, including types created by Asana products. Note that, as in all queries to collections which return compact representation, opt_fields can be used to include more data than is returned in the compact representation. See the documentation for input/output options for more information.

(more information)

Example

const Asana = require('asana');

let client = new Asana.ApiClient();
client.authentications.token.accessToken = '<YOUR_ACCESS_TOKEN>';

let customTypesApiInstance = new Asana.CustomTypesApi(client);
let opts = { 
    'project': "1331", 
    'workspace': "12345", 
    'limit': 50, 
    'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", 
    'opt_fields': "asana_created_type_identifier,name,offset,path,status_options,status_options.color,status_options.completion_state,status_options.enabled,status_options.name,uri"
};
customTypesApiInstance.getCustomTypes(opts).then((result) => {
    console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
    console.error(error.response.body);
});

Parameters

Name Type Description Notes
project String Globally unique identifier for the project, used as a filter when retrieving custom types. [optional]
workspace String The workspace to filter results on. [optional]
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]
opt_fields Object 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. [optional]

Return type

object

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json; charset=UTF-8