Remove a Record by ID

In the contract-based REST API, you can delete a record by its session identifier. To delete a record from MYOB Acumatica, you access the needed URL address with the DELETE HTTP method. See the following sections for details on the request and the response.

Any REST API response contains the _links/self field for every top-level entity it returns. The value of this field is part of the URL of a GET request to retrieve this top-level entity by its ID. The same URL can be used in a DELETE request to delete this entity.

Note: If you need to delete a detail line of a record, you should use the PUT HTTP method, as described in Update a Record.

HTTP Method and URL

If you need to delete a record with a known entity ID, you use the DELETE HTTP method and the following URL. For details about entity IDs, see Retrieve a Record by ID.
DELETE http://<Base endpoint URL>/<Top-level entity>/<Entity ID>

You replace <Base endpoint URL> with the URL of the contract-based endpoint through which you are going to work with MYOB Acumatica, which has the following format: http://<MYOB Acumatica instance URL>/entity/<Endpoint name>/<Endpoint version>/. You replace <Top-level entity> with the name of the entity for which you are going to retrieve the list of records. You replace <Entity ID> with the entity ID (which is the GUID that you can obtain from the ID property of an entity returned from MYOB Acumatica).

For example, suppose that you want to delete the sales order with entity ID 03efa858-2351-4bd5-ae06-3d9fb3b3c1e6 from a local MYOB Acumatica instance with the name AcumaticaDB by using the system endpoint with the name Default and Version 23.200.001. You should use the following HTTP method and URL to delete the sales order.

DELETE http://localhost/AcumaticaDB/entity/Default/23.200.001/SalesOrder/03efa858-2351-4bd5-ae06-3d9fb3b3c1e6

Parameters

You use no parameters when you remove a record.

Request Headers

You do not specify any header in the request.

Response Status Codes

The following table lists the HTTP status codes that the system returns for a request that removes a record by its entity ID.

Code Description
204 The request has been completed successfully. The record is removed.
401

The user is not signed in to the system.

403

The user has insufficient rights to access the MYOB Acumatica form that corresponds to the entity.

429

The number of requests has exceeded the limit imposed by the license (see License Restrictions for API Users).

500

An internal server error has occurred.

Example

The following request shows an example of the removal of the sales order with the ID 286F2AF0-21F5-EB11-9DF1-9828A61840C3.
Tip: In the request example below, <MYOB Acumatica instance URL> is the URL of the MYOB Acumatica instance (such as https://my.acumatica.com/MyInstance). You can omit the instance name in the URL (that is, you can use https://my.acumatica.com) if the instance is installed in the root of the website.
DELETE /286F2AF0-21F5-EB11-9DF1-9828A61840C3 HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/SalesOrder
Accept: application/json
Content-Type: application/json