jswank / dnsme

Command line client for DNS Made Easy
MIT License
20 stars 5 forks source link

dnsme record uses "value" instead of "data" #5

Open markstos opened 9 years ago

markstos commented 9 years ago

The dnsme record subcommand collects and sends the -value option to the remote REST API, which is ignored because the REST API expects a 'data' parameter instead.

data is documented on page 4 in the official spec: http://www.dnsmadeeasy.com/wp-content/themes/appdev/pdf/API-Documentation-DM_20110921.pdf

Either the dnsme API needs to be updated to match what the server expects, or the code should be updated to continue to continue to collect '-value' here.

I recommend updating the code to use -data instead of -value. That's consistent with how the rest of the client mirrors the REST API. Also, there's not really a concern about backcompat here-- the -value option isn't doing anything anyway.

I'm part way done with a patch for this, so I'll go ahead and finish one up.

markstos commented 5 years ago

I never did submit that PR, but here's the diff I started:

diff --git a/records.go b/records.go
index 389c5f6..eaad484 100644
--- a/records.go
+++ b/records.go
@@ -41,7 +41,7 @@ func flagsRecords(f *flag.FlagSet) {
        f.String("type", "", "")
        f.String("name", "", "")
        f.String("nameContains", "", "")
-       f.String("value", "", "")
+       f.String("data", "", "")
        f.String("valueContains", "", "")
 }

@@ -55,7 +55,7 @@ func runRecords(cmd *Command, args []string) (err error) {
        domain := args[0]

        values := &url.Values{}
-       for _, param := range []string{"gtdLocation", "type", "name", "nameContains", "value", "valueContains"} {
+       for _, param := range []string{"gtdLocation", "type", "name", "nameContains", "data", "valueContains"} {
                if cmd.Flag.Lookup(param).Value.String() != "" {
                        values.Set(param, cmd.Flag.Lookup(param).Value.String())
                }