Work with Custom Oracle CX Objects

In this use case you can find examples of how to use REST APIs to view custom Oracle CX objects.

Example: View Trouble Tickets and Assignments

Consider a custom object resource called Trouble Ticket created in the common container crmRestApi. The Trouble Ticket custom object has a custom child object called Assignment. You can use public unique identifiers (PUID) to fetch records. In this example, we will use RecordNumber which is the PUID.

Trouble Ticket

Use a trouble ticket to track the detection, reporting, and resolution of various types of problem. You can use the Trouble Ticket object to view, create, or modify a trouble ticket. You can use the RecordNumber as the PUID to retrieve specific records. However, you must use it with the q parameter.

Resource Plural Label Trouble Tickets
Resource Name Trouble Ticket
API Name TroubleTicket_c

Tasks

The following table lists the tasks supported by this resource.

Task Request URI
Get all trouble tickets GET /crmRestApi/resources/<version>/TroubleTicket_c/
Get a trouble ticket GET /crmRestApi/resources/<version>/TroubleTicket_c?q=RecordNumber=<recordnumber>
Create a trouble ticket POST /crmRestApi/resources/<version>/TroubleTicket_c/
Update a trouble ticket PATCH /crmRestApi/resources/<version>/TroubleTicket_c/TroubleTicket_c?q=RecordNumber=<recordnumber>
Delete a trouble ticket DELETE /crmRestApi/resources/<version>/TroubleTicket_c/TroubleTicket_c?q=RecordNumber=<recordnumber>

Example URL

The following is the format of the resource URL.

DESCRIBE

/crmRestApi/resources/<version>/TroubleTicket_c/

Example Response

The following is an example of the response body in JSON format.

{
  "Resources" : 
   {
    "TroubleTicket_c" : 
     {
      "discrColumnType" : false,
      "title" : "TroubleTicket",
      "titlePlural" : "TroubleTicket",
      "attributes" : 
        [{
          "name" : "Id",
          "type" : "integer",
...
"item" : 
   {
          "links" : 
           [{
             "rel" : "child",
             "href" : "https://servername.fa.us2.oraclecloud.com/crmRestApi/
                       resources/11.13.18.05/TroubleTicket_c/<id>/child/
                       AssignmentCollection_c",
             "name" : "AssignmentCollection_c",
             "kind" : "collection",
             "cardinality" : 
               {
               "value" : "1 to *",
               "sourceAttributes" : "Id",
               "destinationAttributes" : "TroubleTicket_Id_c"
               }
              ...
             }]
   ...
}

Trouble Ticket: Assignment

The assignment child object is used to view, create, or modify the assignment information of a trouble ticket.

Resource Plural Label Assignments
Resource Name Assignment
API Name Assignment_c

Tasks

The following table lists the tasks supported by this resource.

Task Request URI
Get all assignments GET /crmRestApi/resources/<version>/TroubleTicket_c/<id>/child/AssignmentCollection_c
Get an assignment GET /crmRestApi/resources/<version>/TroubleTicket_c/<id>/child/AssignmentCollection_c/<id>
Create an assignment POST /crmRestApi/resources/<version>/TroubleTicket_c/child/AssignmentCollection_c
Update an assignment PATCH /crmRestApi/resources/<version>/TroubleTicket_c/<id>/child/AssignmentCollection_c/<id>
Delete an assignment DELETE /crmRestApi/resources/<version>/TroubleTicket_c/<id>/child/AssignmentCollection_c/<id>

View Trouble Tickets and Partners

Consider two object resources, Partner and Trouble Ticket, created in the crmRestApi container. A one-to-many reference relationship exists between the two objects. The describe operation on the Trouble Ticket object resource includes the foreign key PartnerProfile_Id_Partner_TT to the Partner object resource.

Example URL

The following is the format of the resource URL.

DESCRIBE

/crmRestApi/resources/<version>/TroubleTicket_c/<id>/child/AssignmentCollection_c

{
  "name" : "PartnerProfile_Id_Partner_TT",
  "type" : "integer",
  "updatable" : true,
  "mandatory" : false,
  "queryable" : false,
  "allowChanges" : "always",
  "precision" : 18,
  "properties" : 
    {
"ExtensibilityAnnotation" : "ViewAttribute added by Extensibility",
      "Indexed" : "Y",
      "AttributeType" : "ForeignKey",
      "ATTR_INTERNAL_USE" : "Y",
      "ExtensibilitySystemAttribute" : "ForeignKey",
      "ExtnCustom" : "Y"
     }
  ... 
}

The foreign key attribute in the Trouble Ticket response payload contains the primary key attribute value of the Partner associated with it. For example, the response payload for Trouble Ticket with Id 300100071287969 has the PartnerProfile_Id_Partner_TT value as 300010001256.

{
  "Id" : 300100071287969,
  "RowType" : "TroubleTicket_1201_c",
  "RecordName" : "TT-000001-150814",
  "CurcyConvRateType" : "Corporate",
  "CorpCurrencyCode" : "USD",
  "SourceType" : "TROUBLETICKET_1201_C",
  "AttachmentEntityName" : "TroubleTicket_1201_c",
  "PKProxy" : "300100071287969",
  "Status_c" : "In-Progress",
  "PartnerProfile_Id_Partner_TT" : 300010001256,
...
}