linode-cli icon indicating copy to clipboard operation
linode-cli copied to clipboard

Domain filter "Cannot filter on target"

Open oucil opened this issue 4 years ago • 7 comments

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?

oucil avatar May 31 '20 00:05 oucil

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.

Dorthu avatar Jun 05 '20 11:06 Dorthu

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!

oucil avatar Jun 05 '20 13:06 oucil

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.

Dorthu avatar Jun 17 '20 19:06 Dorthu

Hey @Dorthu, that's great news, thanks very much for the heads up!

oucil avatar Jun 25 '20 20:06 oucil

Just an update: filtering by tag was merged in and should ship with the next scheduled API release on 7/13

Dorthu avatar Jun 30 '20 11:06 Dorthu

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 :)

oucil avatar Jun 30 '20 18:06 oucil

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?

Dorthu avatar Aug 12 '20 17:08 Dorthu

Closing this issue since target is now a filterable field through the API. Feel free to tag me if this issue is still occurring 🙂

LBGarber avatar Sep 06 '22 17:09 LBGarber