RouterOS Version=7.18.2
i have a script i wrote that interfaces with cloudflare API.
the api endpoint is # "https://api.cloudflare.com/client/v4/accounts/<your_account_id>/rules/lists/<your_list_id>/items"
I can push payloads to this api endpoint just fine everything works as expected via /tool fetch
I can also pulll data just fine from the api endpoint via /tool fetch
The issues is when i try to use method http-method=delete the issue is not with /tool fetch i just can not figure out how to escape and format the correct request via json in mikrotik.
how you would do this via curl is
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: Bearer "<your_api_token>" \
-d '{"items": [{"id": "uuid_of_item_to_delete"}]}' \
"https://api.cloudflare.com/client/v4/accounts/<your_account_id>/rules/lists/<your_list_id>/items"
Mikrotik $vars for reference
:local accountId "<your_account_id>"
:local listId "<your_list_id>"
:local apiToken "<your_api_token>"
## list item id to be used in json payload.
:local ID 'e629fa7764a44ead90dd0d62bb9f9a66'
:local apitUrl ("https://api.cloudflare.com/client/v4/accounts/" . $accountId . "/rules/lists/" . $listId . "/items")
thank you to anyone who is willing to shed some light on this.
I should note that I use :deserialize to make the json easier to parse . With :deserialize and :serialize functions being so new and not yet documented in unsure how to use :serialize function to perform this task .