Supported HTTP Methods

The most commonly used HTTP methods (or verbs) are GET, POST, PATCH, and DELETE. The building blocks of REST APIs, these methods define actions applied to REST resources using their URLs.

Note:

  • Oracle recommends that you periodically review if your REST request requirements have changed. Also check with your service administrator if any capacity adjustments or other changes are required in your service configuration.
  • Child resources usually inherit security privileges from their parent resource. Therefore, to use a method on a child resource, you may need to have access to use that method on the parent resource. However, there may be some child resources with different privilege requirements to access them.

The following table lists the methods supported in Oracle B2C Service REST API:

HTTP Method Description

GET

Retrieves data from a resource or object. For more information, see Examples of GET.

POST

Creates an object. For more information, see Examples of POST.

You can also use POST for Run Analytics Reports to Evaluate Trends and Measure Effectiveness.

PATCH

Updates an object. For more information, see Examples of PATCH.

Note:

If PATCH request is blocked or not supported, use HTTP Tunneling for updating your objects.

DELETE

Deletes an object. For more information, see Examples of DELETE.

OPTIONS

Returns a list of allowed verbs for an object type. For more information, see Examples of OPTIONS.

Note:

The PUT method isn't supported.

Examples of GET

Use the GET method to retrieve resource data.

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/accounts/10

returns the data for the account with ID 10:

{
    "id": 10,
    "lookupName": "Brenden Foster",

    "displayName": "Brenden Foster",
    "displayOrder": 3,
    "emailNotification": null,
    "emails": {
        "links": [
            {
                "rel": "self",
                "href": "https://mysite.example.com/services/rest/connect/v1.4/accounts/10/emails"
            },
            {
                "rel": "full",
                "href": "https://mysite.example.com/services/rest/connect/v1.4/accounts/10/emails/{email_id}",
                "templated": true
            }
        ]
    },
    "login": "bfoster",
    ...

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

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

This returns the following:

{
    "login": "bfoster"
}

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/accounts/10/phones"
            },
            {
                "rel": "full",
                "href": "https://mysite.example.com/services/rest/connect/v1.4/accounts/10/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 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"
        }
    ]
},

Examples of POST

Use the POST method to create new objects and to execute Analytics reports. To create new instances (that is, objects) of resources, such as accounts, use the following URL syntax with the POST method:

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

Using POST with the following URI:

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

with the following body:

{
  "login": "guest",
,
    "last": "Account"
  },
  "name": {
    "first": "Guest"  "profile": {
    "id": 12
  },
 "staffGroup": {
    "id": 100303
  }
}

returns the following account data:

{
{
  "id": 108,
  "lookupName": "Guest Account",
  "accountHierarchy": {
    "links": [
      {
        "rel": "self",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/accounts/108/accountHierarchy"
      }
    ]
  },
  "attributes": {  
...

Examples of PATCH

Use the PATCH method to update existing objects in your application.

Use the following syntax to partially update objects:

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

Include the data that you want to update in the request body. Only the fields present in the request JSON data are updated. All other fields remain the same.

For example, using PATCH with the following URI:

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

and the following body:

{
"login": "guest2"
}

returns the status 200 OK. A subsequent GET request for the login data for that account:

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

returns the following:

{
"login": "guest2"
}

The login for the account is updated from guest to guest2.

Examples of DELETE

Use the DELETE operation with the following syntax to delete records:

https://your_site_interface/services/rest/connect/v1.4/resource/resource_id

For example, deleting the account record with ID 9:

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

returns the status 200 OK. Then getting the list of account records returns the following:

...
        {
            "id": 8,
            "lookupName": "Lucy Bauer",
            "links": [
                {
                    "rel": "canonical",
                    "href": "https://mysite.example.com/services/rest/connect/v1.4/accounts/8"
                }
            ]
        },
        {
            "id": 10,
            "lookupName": "Andrew Larson",
            "links": [
                {
                    "rel": "canonical",
                    "href": "https://mysite.example.com/services/rest/connect/v1.4/accounts/10"
                }
            ]
        }
...

Note:

Account ID 9 no longer exists.

Examples of OPTIONS

Making an OPTIONS request against a particular resource returns the list of verbs allowed against that resource in the Allow header of the response. For example, using OPTIONS with accounts:

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

returns the following headers:

Allow -> OPTIONS, GET, HEAD, POST, PATCH, DELETE
Connection -> Keep-Alive
Content-Language -> en-US
Content-Type -> application/schema+json
Date -> Thu, 30 Apr 2015 19:42:07 GMT
F5_do_compression -> yes
Keep-Alive -> timeout=15, max=94
Link -> <https://mysite.example.com/services/rest/connect/v1.4/metadata-catalog/accounts>;
rel="describedby"
RNT-Machine -> 40.30
RNT-Time -> D=3924741 t=1430422927372450
Server -> Apache
Transfer-Encoding -> chunked
Vary -> User-Agent