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:

Name Type Read-only Mandatory Description
identifier string true false Descriptive name for the resource
resource_id integer true false Unique id for the resource. Automatically assigned upon creation
type array true false Resource type. Possible values are "automations", "channel_integrations", "custom_objects", "macros", "organization_fields", "targets", "ticket_fields", "triggers", "user_fields", "view", and "webhooks"
deleted boolean true false If true, the resource has been deleted

JSON format

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

Name Type Read-only Mandatory Description
created_at string true false When the resource collection was created
id integer true false id for the resource collection. Automatically assigned upon creation
resources array true false Array of resource metadata objects. See Resource objects
updated_at string true false Last 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
curl
curl https://{subdomain}.zendesk.com/api/v2/resource_collections.json \  -v -u {email_address}:{password}

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

Name Type In Required Description
resource_collection_id integer Path true The id of the resource collection
curl
curl https://{subdomain}.zendesk.com/api/v2/resource_collections/{resource_collection_id}.json \  -v -u {email_address}:{password}

Example response(s)

200 OK
// Status 200 OK
{  "resource_collection": {    "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"  }}

Create Resource Collection

  • POST /api/v2/resource_collections

Creates a resource collection from a provided payload object. The payload object is specified the same way as the content of a requirements.json file in a Zendesk app. See Specifying Apps Requirements in the Zendesk Apps framework docs.

The response includes a job status for creation of the specified resources.

Allowed for

  • Admins
curl
curl https://{subdomain}.zendesk.com/api/v2/resource_collections.json \  -v -u {email_address}:{password} -X POST \  -H "Content-Type: application/json" \  -d '{  "payload": {    "ticket_fields": {      "support_description": {        "type": "text",        "title": "Support description"      }    },    "triggers": {      "email_on_ticket_solved": {        "title": "Email on ticket solved Trigger",        "all": [          {            "field": "status",            "operator": "is",            "value": "solved"          }        ],        "actions": [          {            "field": "notification_user",            "value": [              "all_agents",              "[{{ticket.account}}] {{ticket.title}}",              "A ticket (#{{ticket.id}}) by {{ticket.requester.name}} has been received. It is unassigned.\n\n{{ticket.comments_formatted}}"            ]          }        ]      }    }  }}'

Example response(s)

200 OK
// Status 200 OK
{  "job_status": {    "id": "0a3e49b038c40133d7380242ac110031",    "message": null,    "progress": null,    "results": null,    "status": "queued",    "total": null,    "url": "https://company.zendesk.com/api/v2/job_statuses/0a3e49b038c40133d7380242ac110031.json"  }}

Update Resource Collection

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

Updates a resource collection using a provided payload object. The payload object is specified the same way as the content of a requirements.json file in a Zendesk app. See Specifying Apps Requirements in the Zendesk Apps framework docs.

The response includes a job status for the resource updates.

Allowed for

  • Admins

Parameters

Name Type In Required Description
resource_collection_id integer Path true The id of the resource collection
curl
curl https://{subdomain}.zendesk.com/api/v2/resource_collections/{resource_collection_id}.json \  -v -u {email_address}:{password} -X PUT \  -H "Content-Type: application/json" \  -d '{    "payload": {      "targets": {        "an_email_target": {          "title": "Send notification email",          "type": "email_target",          "email": "[email protected]",          "subject": "Hey, something happened!"        }      }    }  }'

Example response(s)

200 OK
// Status 200 OK
{  "job_status": {    "id": "4555831038d20133d7390242ac110031",    "message": null,    "progress": null,    "results": null,    "status": "queued",    "total": null,    "url": "https://company.zendesk.com/api/v2/job_statuses/4555831038d20133d7390242ac110031.json"  }}

Delete Resource Collection

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

Deletes a specified resource collection.

The response includes a job status for deletion of the collection's resources.

Allowed for

  • Admins

Parameters

Name Type In Required Description
resource_collection_id integer Path true The id of the resource collection
curl
curl https://{subdomain}.zendesk.com/api/v2/resource_collections/{resource_collection_id}.json \  -v -u {email_address}:{password} -X DELETE

Example response(s)

200 OK
// Status 200 OK
{  "job_status": {    "id": "2ee570d0398e0133e26e0242ac110017",    "message": null,    "progress": null,    "results": null,    "status": "queued",    "total": null,    "url": "https://company.zendesk.com/api/v2/job_statuses/2ee570d0398e0133e26e0242ac110017.json"  }}