Delete a phone
-------------------------


Overview
...........

This API DELETE call deletes a phone. 

``DELETE https://<hostname>/api/api/relation/SubscriberPhone/{Removal_Phone_PKID}``

Where ``{Removal_Phone_PKID}`` is the ID of the phone to delete.




.. rubric:: References:

* `OpenAPI example for relation/SubscriberPhone/{Removal_Phone_PKID} <ServiceNow-integration.html#/paths/paths/~1api~1relation~1SubscriberPhone~1%7BRemoval_Phone_PKID%7D/delete>`__
* `Model: relation/SubscriberPhone <https://documentation.voss-solutions.com/release_RELEASENUM/html/src/api-ref/relation_SubscriberPhone-Model.html>`__
* `API Reference for relation/SubscriberPhone <https://documentation.voss-solutions.com/release_RELEASENUM/html/src/api-ref/relation_SubscriberPhone-API.html>`__


Using relation/SubscriberPhone/{Removal_Phone_PKID}
....................................................

Using this API call involves the following tasks: 

1. Identify the customer and the customer's hierarchy.
2. Fetch all details of the phone to be deleted. 



Step 1: Identify Customer+Customer Hierarchy
'''''''''''''''''''''''''''''''''''''''''''''''

1. Fetch the list of customers to populate a drop-down list, and allow the user to select a 
   customer from the list. ``<Customer Name>``

   Refer to :ref:`tool-macro-customers-id` 

2. Fetch available hierarchies for the selected customer (``<Customer Name>``).

   Refer to :ref:`tool-macro-sites-belonging-to-the-customer-id`

3. Resolve ``<Customer Hierarchy>``.

   * ``<Customer Hierarchy>`` is the entry in the earlier step that ends with the ``<Customer Name>``. 

     For example, if ``<Customer Name>`` is Innovia, the ``<Customer Hierarchy>`` 
     will be ``sys.hcs.CS-P.CS-NB.Innovia``.


Step 2: Fetch all details of the phone to be deleted
''''''''''''''''''''''''''''''''''''''''''''''''''''''

1. Execute ``tool-macro-all-phones-belonging-to-the-customer-id`` (at Customer hierarchy) to fetch 
   all phones belonging to the customer.

2. User selects the phone to be deleted. 

3. Resolve the phone PKID of the selected phone, to ``<Removal_Phone_PKID>``

   .. note:: 

      There is no callback for DELETE. You will need to execute a 
      GET call containing data from the payload to confirm the status of the 
      call, for example: 
      
      ``GET https://<hostname>/api/tool/Transaction/9095e5a2-6b62-45f8-abbb-93bd908a8bef/``

      See the response sample output for this DELETE call 
      in the `OpenAPI example for relation/SubscriberPhone/{Removal_Phone_PKID} <ServiceNow-integration.html#/paths/~1api~1relation~1SubscriberPhone~1%7BRemoval_Phone_PKID%7D/delete>`__



