Video: Using Non-Query Operations

This topic describes how you can use an operation other than a simple GET query in the Oracle Service Cloud REST API. These operations include DELETE, PATCH for updates, POST for creating new objects, and OPTIONS which shows you the REST verbs that can be used for a particular resource.


Do not use the code shown in this example in a production environment.
The following example shows a simplified PHP application to do a PATCH operation:
  1. Create a .php file using HTML and PHP by using a text editor such as Notepad++.
  2. In the .php file, inside the <body> tag and just before the <php> tag add a message. This message will indicate that the page has been loaded. For example:
    Patching contact 6

    Loading the page displays the message and runs the PHP REST call.


    Do not use the code shown in this example in a production environment. Some elements, such as resource record numbers and login credentials are hard-coded, because it is a demo. For example:

    $url = ""
  3. Set up the data that you want to update, using JSON. In this case, you are going to update the last name of contact number 6 to 'Ryder'.
    $json_data = '("name": ("last": "Ryder"))';
  4. Set up the CURL options.
    1. Set up the URL:
      curl_setopt($ch, CURLOPT_URL, $url);
    2. Set up the access. In this demo, the code is set to ignore the certificate, which you should not do in a production environment:
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    3. Set the verb to PATCH for the update:
      curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH");
    4. Set the JSON-encoded data:
      curl_setopt($ch, CURLOPT_POSTFIELDS, $jason_data);
  5. Add the commands to run the application and catch errors, if any:
    try {
    catch(Exception $e) {
       echo "Catch error message: " .$e->getMessage();
    if (curl_errno($ch)) {
       echo "Error accessing site: errno: ".curl_error($ch);
  6. Save and close the PHP file.
  7. Go to the Agent Desktop and verify the current last name of contact number 6. In this case, the current last name is 'Wright'.
  8. Open the PHP file in a web browser.
    This runs the PHP application.
  9. Refresh your Agent Desktop and verify that the last name of contact number 6 has been updated to 'Ryder'.