REST v2 - List All Custom Field IDs/Names

Is there a way to get all custom field IDs/Names via v2 of the REST API? My use case is resolving a CustomField ‘id’ by ‘Name’. The opposite works fine with the ‘GET /customfield/:id’ endpoint.

I can only create tickets with custom field entries using the CustomField ‘id’. This is fine but, ideally, I’d like to be able to resolve the ‘id’ behind the scenes and allow the users of my client library to use the field ‘Names’.

The same was also mentioned by user ‘craig’ in post Posting CustomFields with REST2 - #9 by Kaspar7 for reference.

Any help would be much appreciated. Thanks!

You could do a look up on all the custom fields that apply to tickets:

REST/2.0/customfields:
[ {"field" : "LookupType", "value" : "RT::Queue-RT::Ticket"} ]

Then when you get an array of custom fields:

{
   "per_page": 20,
   "page": 1,
   "count": 1,
   "items": [
      {
         "_url": "http://MyRT/REST/2.0/customfield/2",
         "type": "customfield",
         "id": "2"
      }
   ],
   "total": 1
}

You could loop through and get the names of the custom fields using GET /customfield/:id. Off the top of my head I do not know how to limit the queue to only one.

Thanks for the quick response! That will work.