A resource collection consists of Zendesk Support resource definitions. For example, a resource collection could define two different targets and one ticket field. You specify the resource collection the same way you specify the resource requirements for a Zendesk app.

Resource objects

The List Resource Collections and Show Resource Collection endpoints return a resources array. Each object in the resources array contains metadata for a resource in a resource collection.

Objects in the resources array have the following properties:

NameTypeRead-onlyMandatoryDescription
identifierstringtruefalseDescriptive name for the resource
resource_idintegertruefalseUnique id for the resource. Automatically assigned upon creation
typearraytruefalseResource type. Possible values are "automations", "channel_integrations", "custom_objects", "macros", "organization_fields", "targets", "ticket_fields", "triggers", "user_fields", "view", and "webhooks"
deletedbooleantruefalseIf true, the resource has been deleted

JSON format

Resource Collections are represented as JSON objects with the following properties:

NameTypeRead-onlyMandatoryDescription
created_atstringtruefalseWhen the resource collection was created
idintegertruefalseid for the resource collection. Automatically assigned upon creation
resourcesarraytruefalseArray of resource metadata objects. See Resource objects
updated_atstringtruefalseLast time the resource collection was updated

Example

{  "created_at": "2011-07-20T22:55:29Z",  "id": 35436,  "resources": [    {      "deleted": false,      "identifier": "email_on_ticket_solved",      "resource_id": 10824486485524,      "type": "triggers"    },    {      "deleted": false,      "identifier": "support_description",      "resource_id": 10824486482580,      "type": "ticket_fields"    }  ],  "updated_at": "2011-07-20T22:55:29Z"}

List Resource Collections

  • GET /api/v2/resource_collections

Lists resource collections for the account.

Allowed for

  • Admins

Parameters

NameTypeInRequiredDescription
per_pageintegerQueryfalseNumber of records to return per page. Note: Default and maximum values vary by endpoint. Check endpoint-specific documentation for limits.

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/resource_collections \  -H "Authorization: Bearer {access_token}"
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/resource_collections?per_page=50"	method := "GET"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/resource_collections")		.newBuilder()		.addQueryParameter("per_page", "50");String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("GET", null)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", basicAuth)		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'GET',  url: 'https://example.zendesk.com/api/v2/resource_collections',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },  params: {    'per_page': '50',  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requestsfrom requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/resource_collections?per_page=50"headers = {	"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(	"GET",	url,	auth=auth,	headers=headers)
print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/resource_collections")uri.query = URI.encode_www_form("per_page": "50")request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

200 OK
// Status 200 OK
{  "count": 0,  "next_page": null,  "previous_page": null,  "resource_collections": [    {      "created_at": "2015-09-09T01:57:24Z",      "id": 10002,      "resources": [        {          "deleted": false,          "identifier": "email_on_ticket_solved",          "resource_id": 10824486485524,          "type": "triggers"        },        {          "deleted": false,          "identifier": "support_description",          "resource_id": 10824486482580,          "type": "ticket_fields"        }      ],      "updated_at": "2015-09-09T01:57:24Z"    },    {      "created_at": "2015-09-10T02:01:03Z",      "id": 10002,      "resources": [        {          "deleted": false,          "identifier": "an_email_target",          "resource_id": 10827267902996,          "type": "targets"        }      ],      "updated_at": "2015-09-10T02:02:15Z"    }  ]}

Show Resource Collection

  • GET /api/v2/resource_collections/{resource_collection_id}

Retrieves details for a specified resource collection.

Allowed for

  • Admins

Parameters

NameTypeInRequiredDescription
resource_collection_idintegerPathtrueThe id of the resource collection

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/resource_collections/{resource_collection_id} \  -H "Authorization: Bearer {access_token}"
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/resource_collections/10002"	method := "GET"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/resource_collections/10002")		.newBuilder();String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("GET", null)		.addHeader("Content-Type", "application/json")		.addHeader(