Examples of GET

Use the GET method to retrieve resource data. You can use the GET method for the following:

Retrieving a List of Instances of a Resource

Use GET with the following syntax to list all instances (objects) of a particular resource type:

https://your_site_interface/services/rest/connect/version/resource

For example:

https://mysite.example.com/services/rest/connect/v1.4/accounts

returns the list of accounts:

{
    "items": [
    {
        "id": 1,
        "lookupName": "Administrator",
        "links": [
        {
            "rel": "canonical",
            "href": "https://mysite.example.com/services/rest/connect/v1.4/accounts/1"
            }
            ]
        },
    {
        "id": 2,
        "lookupName": "Snowball Cat",
        "links": [
        {
            "rel": "canonical",
            "href": "https://mysite.example.com/services/rest/connect/v1.4/accounts/2"
            }
            ]
        },
    ...
    {
        "id": 254,
        "lookupName": "Random User",
        "links": [
        {
            "rel": "canonical",
            "href": "https://mysite.example.com/services/rest/connect/v1.4/accounts/254"
            }
            ]
        }
    ],
    "links": [
    {
        "rel": "self",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/accounts"
        },
    {
        "rel": "canonical",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/accounts"
        },
    {
        "rel": "describedby",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/metadata-catalog/accounts"
        },
    {
        "rel": "alternate",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/accounts",
        "mediaType": "application/schema+json"
        }
    ]
}

Retrieving Data for an Object

Use GET with the following syntax to retrieve data for a specific instance of a resource (that is, an object):

https://your_site_interface/services/rest/connect/version/resource/resource_id

For example, using GET with the following URI:

https://mysite.example.com/services/rest/connect/v1.4/contacts/2

returns the data for the contact with ID 2:

{
    "id": 2,
    "lookupName": "Fred Flintstone",
    "createdTime": "2008-04-16T19:36:50.000Z",
    "updatedTime": "2015-03-06T17:35:53.000Z",
    "address": {
        "city": "Bozeman",
        ...
}

You can also retrieve specific fields (child resources) in the object record, for example, the contact's city:

https://mysite.example.com/services/rest/connect/v1.4/contacts/2/address/city

This returns the following:

{
    "city": "Bozeman"
}

In the May 2016 release, the full relational link was added to show the URIs of the full representations of child resources, for example:

...

 "phones": {
    "links": [
      {
        "rel": "self",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/contacts/2/phones"
      },
      {
        "rel": "full",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/contacts/2/phones/{phone_id}",
        "templated": true
      }
    ]
  },

...

Retrieving Expanded Resource Data

You can use the expand query parameter to retrieve a fully expanded version of a particular subresource. You can specify a comma-separated list of subresources to expand multiple subresources in one GET request. A comma is the only separator that's allowed.

Note:

The default GET request against a resource doesn't return details about the following:
  • List subresources, such as threads, notes, or fileAttachments
  • Hierarchy subresources, such as categories or products

Use GET with the following query syntax:

https://your_site_interface/services/rest/connect/version/resource/
resource_id?expand=sub-resource|all

The following table describes the request path parameter in the GET request.

Name Description
sub-resource Lists subresource or hierarchy subresource

For example, a default GET request for the incident created in the complex Examples of POST request returns the following data for the threads subresource:

"threads": {
    "links": [
    {
        "rel": "self",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/incidents/35/threads"
        }
    ]
}

Using this GET request:

https://mysite.example.com/services/rest/connect/v1.4/incidents/35?expand=threads

returns the following data for the threads sub-resource:

"threads": {
    "items": [
    {
        "rel": "canonical",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/incidents/35/threads/24"
        },
    {
        "rel": "canonical",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/incidents/35/threads/23"
        }
    ],
    "links": [
    {
        "rel": "self",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/incidents/35/threads"
        },
    {
        "rel": "canonical",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/incidents/35/threads"
        },
    {
        "rel": "describedby",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/metadata-catalog/incidents/threads"
        },
    {
        "rel": "alternate",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/incidents/35/threads",
        "mediaType": "application/schema+json"
        }
    ]
},