Community discussions

MikroTik App
 
wire
just joined
Topic Author
Posts: 3
Joined: Tue Nov 15, 2022 10:29 am

REST API delete/disable/modify a list of items

Tue Nov 15, 2022 10:47 am

Hello,
I am attempting at writing a connector for the v7 REST API. Currently wondering if there is any mechanism for deleting/changing a list of similar items.
Documentation for the DELETE verb only mentions deleting by key.
A POST at the (say) ip/address/disable or ip/address/destroy with a .query selector return an empty array [] and not an error, but also don't seem to do anything. (while a print with the same .query does work.

Any help is appreciated.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7042
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: REST API delete/disable/modify a list of items

Wed Nov 16, 2022 8:50 am

QUERY is not supposed to work that way.
You should use query to get item IDs, and then use those ids to execute delete.
 
wire
just joined
Topic Author
Posts: 3
Joined: Tue Nov 15, 2022 10:29 am

Re: REST API delete/disable/modify a list of items

Wed Nov 16, 2022 9:33 am

QUERY is not supposed to work that way.
You should use query to get item IDs, and then use those ids to execute delete.

Ah, so there is no way to atomically delete a collection of matching items? And why it returns an empty array [ ] if the query isn't allowed?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7042
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: REST API delete/disable/modify a list of items

Wed Nov 16, 2022 9:38 am

because delete returns ids that i has deleted, since you did not delete anything array is empty.

Who is online

Users browsing this forum: alexantao and 21 guests