Remove a Record by Key Fields

In the contract-based REST API, you can delete a record by the values of its key fields. 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.

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 known key fields, you use the DELETE HTTP method and the following URL.
DELETE http://<Base endpoint URL>/<Top-level entity>/<Key value 1>/<Key value 2>
The URL has the following components:
  • <Base endpoint URL> is 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>/.
  • <Top-level entity> is the name of the entity for which you are going to delete a record.
  • <Key value 1> and <Key value 2> are the values of the key fields of the record to be deleted. You use the number and order of key fields as they are defined on the corresponding MYOB Acumatica form.
    Note: You can pass the key fields separated by a vertical bar (|) instead of a slash (/). If the value of a key field contains a slash, you need to refer to a record by its entity ID instead of the values of its key fields.
For example, suppose that you want to delete the sales order with order type SO and order number 000123 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/SO/000123

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 the record by the values of its key fields or 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 CGFEEDER stock item by the value of the key field.
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 /CGFEEDER HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/StockItem
Accept: application/json
Content-Type: application/json