Extending (not replacing) RRSet via REST API

Hello

How to extend RRSet via REST API? For example I currently have Apex domain xyz.com with 3 TXT records “A”, “B”, “C”.

How do I extend and add 4th record “D”, without using “A”, “B” , “C”, ie how do I extend (not replace) the RRSet?

My unsuccesful attempts:
curl -X PUT ‘https://desec.io/api/v1/domains/xyz.com/rrsets/
–header “Authorization: Token TOKEN”
–header “Content-Type: application/json” --data @- <<<
‘[{“subname”: “”, “type”: “TXT”, “ttl”: 3600, “records”: [“"D"”]}]’

Above example replaces previous records and adds just D ( A , B and C are gone)

I know I can use “records”: [A, B, C, D] but let’s presume I don’t know what currently is stored in the RRSet, so I would like to use REST API command to add one element to the set, without affecting its previous members.

Best regards!

  1. Read
  2. Modify
  3. Write

There is no other way because the records are only identified by their content.

1 Like

Hi jan77,

Thank you for your message, and welcome to deSEC! :slight_smile:

Our REST API currently does not support addressing individual records (just record sets).

The main reason for this is that, if you wanted to delete or modify a particular record from a set, then what should be the URL path that identifies that record? It’s not easily possible to encode record values as part of the URL. Alternatively, we could introduce IDs (as we have for API tokens, for example), but we’re not sure this is easy enough so that it actually will be used.

There are other decisions to be made, such as: what if a record is added which is already present in the set? Is this an error, or silently accepted?

This issue is being tracked at Add Record-Level API · Issue #540 · desec-io/desec-stack · GitHub.

Stay secure,
Peter

1 Like

If that is an option for your use case, look into the various API clients out there. I know of at least one that does the “read, modify, write” for you:

By the way, the same goes for removing a single record from an existing set, should you require this as well.

1 Like

Thanks for the replies. Read,modify,write was my solution, thanks :slight_smile: