Delete

From API Documentation

Jump to: navigation, search

Deletes one or more objects of the same type. You can specify different types in different deletecalls, but each delete call must only apply to one type of object.

Contents

Syntax and Arguments

DeleteResult[] = delete(type, ID[]);

The arguments are as shown in the following table. For information on the field types, see Field Types.

Argument Description
type The type of object that you are deleting.
ids[] A list of one or more IDs for the objects you wish to delete.


Using This Call

You can call delete with a string type of zObject and a list of IDs of that type. It returns an array of DeleteResult, indicating the success or failure of deleting each object.

The following information applies to this call:

  • You will need to first determine the IDs for the objects you wish to delete.
  • You cannot pass in any null IDs.
  • You can pass in a maximum of 50 IDs at a time.
  • All objects in a specific delete call must be of the same type.

Response

DeleteResult

Faults

InvalidTypeFault

InvalidValueFault

UnexpectedErrorFault

Sample Code

The following sections provide examples of using delete.

Sample Code for Java

Delete delete = new Delete();
delete.setType("Account");
ID id = new ID();
id.setID("402881491bd3cc34011bd3eb0c300092");
delete.setIds(id);
ServiceStub.DeleteResponse res = stub.delete(delete, header);
ServiceStub.DeleteResult[] sr = res.getResult();

Sample SOAP Request to Delete a Single Object

<ns1:delete>
  <ns1:type>Usage</ns1:type>
  <ns1:ids>4028e699235ea4de0123777131fd5d68</ns1:ids>
</ns1:delete>

Sample SOAP Request to Delete Multiple Objects

<ns1:delete>
  <ns1:type>Usage</ns1:type>
  <ns1:ids>4028e699235ea4de0123777131fd5d68</ns1:ids>
  <ns1:ids>4028e699235ea4de0123777132125d6b</ns1:ids>
</ns1:delete>