REST List API Delete
Delete all objects returned by a report
URL Pattern |
/list/{entity-identifier}/{report-name} |
Method |
DELETE |
Parameters |
Only the parameters of the specified entity report are available. |
Content-Type |
application/x-www-form-urlencoded |
Media types |
application/json, application/xml |
Result |
A protocol containing information about the number of retrieved and deleted items and a list of errors and warnings. |
Result
A protocol is returned as result. The protocol consists of a list of counters (number of errors, warnings and retreived and deleted objects), a list of errors and warnings (members of the field entries) and a list of created and updated objects (members of the field objects).
Properties of a counters element |
|||
Field |
Data type |
Description |
|
errors |
Integer |
Total number of errors |
|
warnings |
Integer |
Total number of warnings |
|
retrievedObjects |
Integer |
Number of objects retrieved by the report |
|
deletedObjects |
Integer |
Number of deleted objects |
The properties of an entries element are the same as when writing values and is described at REST List API Write for Root Entities.
Warning
Be aware that when deleting objects via the List API, all objects belonging to the specified report will be deleted at once. So once the deletion request is fired, there will NOT appear any "Are you really sure..?" confirmation dialog !
Limit delete rights of Rest users as much as possible
As a best practise, it is recommended to restrict the delete rights of users accessing the Product Manager via Rest Service API as much as possible.
Delete sub entity records of objects returned by a report
For example "delete all prices for a specific customer from all items of the master catalog"
Since (PIM 8.0)
URL Pattern |
/list/{entity-identifier}/{sub-entity-identifier}/{report-name} |
Method |
DELETE |
Content-Type |
application/x-www-form-urlencoded |
Media types |
application/json, application/xml |
Result |
A protocol containing information about the number of retrieved and deleted items and a list of errors and warnings. |
Parameters |
||||
Parameter |
Required |
Default |
Datatype |
Parameter description |
report parameters |
no |
String |
Parameters of the specified entity report. |
|
qualificationFilter |
no |
String |
This parameter allows to restrict the deletion to certain qualifications. An example would a filter so that only Euro and Dollar prices for the customer Heiler are deleted. The filter string is a comma-separated list of qualification settings. A qualification setting is a qualification name followed by a comma-separated list of values which is put into parentheses . The qualification name is defined in the repository and is included in the Meta-API. Example for prices in Euro and US-Dollar and customer Heiler: |
Result
A protocol is returned as result. The protocol consists of a list of counters (number of errors, warnings and retreived and deleted objects), a list of errors and warnings (members of the field entries) and a list of created and updated objects (members of the field objects).
Properties of a counters element |
||
Field |
Data type |
Description |
errors |
Integer |
Total number of errors |
warnings |
Integer |
Total number of warnings |
retrievedObjects |
Integer |
Number of objects retrieved by the report |
deletedObjects |
Integer |
Number of deleted objects |
The properties of an entries element are the same as when writing values and is described at REST List API Write for Root Entities.
Warning
Be aware that when deleting objects via the List API, all objects belonging to the specified report will be deleted at once. So once the deletion request is fired, there will NOT appear any "Are you really sure..?" confirmation dialog!
Examples
Delete all item in the supplier catalog TOOLS
curl -u rest:heiler -H
"Accept: application/json"
-H
"Content-Type: application/x-www-form-urlencoded"
-X DELETE http:
//localhost:1501/rest/V1.0/list/Article/byCatalog?catalog=TOOLS
The returned protocol looks like
{
"counters"
: {
"retrievedObjects"
:
3
,
"warnings"
:
0
,
"errors"
:
0
,
"deletedObjects"
:
3
},
"entries"
: []
}
EntityItemReference toolsCatalogRef = EntityItemReferenceFactory.createByIdentifier(
"TOOLS"
);
ReportQuery reportQuery =
new
ReportQuery(
"byCatalog"
);
reportQuery.addParameterValue(
"catalog"
, toolsCatalogRef );
ListDeleteRequest deleteRequest = getRestClient().createListDeleteRequest();
DeleteProtocol protocol = deleteRequest.deleteRootItems(
"Article"
, reportQuery );
Delete all sales prices with currency USD in the supplier catalog TOOLS
curl -u rest:heiler -H
"Accept: application/json"
-H
"Content-Type: application/x-www-form-urlencoded"
-X DELETE http:
//localhost:1501/rest/V1.0/list/Article/ArticlePriceSales/byCatalog?catalog=TOOLS&qualificationFilter=currency(USD)
EntityItemReference toolsCatalogRef = EntityItemReferenceFactory.createByIdentifier(
"TOOLS"
);
ReportQuery reportQuery =
new
ReportQuery(
"byCatalog"
);
reportQuery.addParameterValue(
"catalog"
, toolsCatalogRef );
ListDeleteRequest deleteRequest = getRestClient().createListDeleteRequest();
DeleteProtocol protocol = deleteRequest.deleteSubItems(
"Article"
,
"ArticlePriceSales"
, reportQuery,
"currency(USD)"
);