Show TOC

Test the Delete OperationLocate this document in the navigation structure

Prerequisites

Use Firefox with REST Client Add-On for this test.

In addition, you must configure your REST Client Add-On to use the X-CSRF-Token (Cross-Site Request Forgery) protection.

You require authorization to change user data in the SAP backend system.

Process

A DELETE operation uses the HTTP DELETE method and is also called using the same URL as the READ (or UPDATE) operation. No request body is needed for the DELETE operation.

  1. Change the method to DELETE in the Firefox REST client.

    The URL should be set to the same one used for the READ or the UPDATE operation.

    Clear the request body. For a DELETE operation, a request body is not necessary as the object to delete is identified from the key fields in the URL.

    • Method: DELETE

    • URL: URL of the service, for example, .../sap/opu/odata/sap/z_user_bor/z_user_borCollection('Aviszovski')

    • Request Header: Click Add Request Header and add the HTTP header for the X-CSRF-Token protection as shown in the image below.

      Name

      Value

      X-CSRF-Token

      Paste the data for the token you have copied, for example, QXyUmor32424241243124mx==

      Content-Type

      Enter the following:application/atom+xml

  2. Click Send .

    Similar to an UPDATE operation, upon successful deletion you should receive an HTTP “Status Code: 204 No Content”.

    Delete operation results

  3. You can verify by executing a GET against the same URL.

    In the Response Header tab, the result shows an HTTP 400 “Bad Request”.

    In the Formatted XML tab, the error message shows that the user does not exist, and this confirms that the user was deleted.