linode-cli
linode-cli copied to clipboard
Domain filter "Cannot filter on target"
Because the API is not idempotent, I have to issue a GET
request to the domain records to see if an A record exists, and is pointed to the correct IP address. I don't want to have to analyze the answer, I only want to know if a record is returned when I make the request. However when I issue:
curl -XGET -H 'Authorization: Bearer ###REMOVED###' -H 'X-Filter: {"type":"A","target":"###REMOVED###"}' https://api.linode.com/v4/domains/###REMOVED###/records
... I'm getting the error response ...
{"errors": [{"reason": "Cannot filter on target", "field": "X-Filter"}]}
Why can't I filter against the target
field?
Sorry I missed this. I don't see any good reason why that field isn't filterable - I'll forward this request along to our API development team to see if it can get added into the next release.
Hey @Dorthu, appreciate that thank you!
While you're at it, I've come across a similar issue, where filter is not available on the tag
field when working with the https://api.linode.com/v4/domains/1234567/records
endpoint and specifically the CAA
record type.
This is important, as there are often multiple CAA records in a zone with different tags for different purposes, and without being able to filter by tag on the values issue, issuewild, or iodef, you get all CAA records in the result set and have to iterate over them all to see if the one you really wanted actually exists.
Cheers!
Hey, wanted to follow up here - target is now a filterable field for the domain records collection. The call you posted above should work.
I've still got the tag
field on my list of things to do, sorry it's not out yet.
Hey @Dorthu, that's great news, thanks very much for the heads up!
Just an update: filtering by tag was merged in and should ship with the next scheduled API release on 7/13
That's super @Dorthu, very much appreciated! If you happen to be in Canada, happy Canada Day tomorrow, and if not, enjoy the rest of your week :)
I know it's been a while, but I think everything in this issue has shipped and should be working. Is this issue ready to be closed?
Closing this issue since target
is now a filterable field through the API. Feel free to tag me if this issue is still occurring 🙂