Skip to content

[Bug] API - DNS - Edit an existing DNS record does not work as described #584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ejstreet opened this issue Feb 5, 2023 · 4 comments
Open
Assignees
Labels
bug Something doesn’t work properly dns Related to omg.lol’s DNS service

Comments

@ejstreet
Copy link

ejstreet commented Feb 5, 2023

Bug Description

When trying to update an existing record, a new one is created instead.

The request appears to ignore the record ID when passed. Any and no value can be passed at the end of the URL when using the PATCH method and a new record will be created as long as it is different to an existing record.

Steps to Reproduce

Create a DNS record:

curl --location --request POST --header "Authorization: Bearer $OMGLOL_API_KEY" 'https://api.omg.lol/address/elliott/dns' --data '{"type": "CNAME", "name": "foo", "data": "example.com"}'
{
    "request": {
        "status_code": 200,
        "success": true
    },
    "response": {
        "message": "Your DNS record was created successfully.",
        "data_sent": {
            "type": "CNAME",
            "priority": null,
            "ttl": null,
            "name": "foo.elliott",
            "content": "example.com"
        },
        "response_received": {
            "data": {
                "id": 41905981,
                "name": "foo.elliott",
                "content": "example.com",
                "ttl": 3600,
                "priority": null,
                "type": "CNAME",
                "created_at": "2023-02-05T05:50:43Z",
                "updated_at": "2023-02-05T05:50:43Z"
            }
        }
    }

Attempt to update the record using patch and the ID:

curl --location --request PATCH --header "Authorization: Bearer $OMGLOL_API_KEY" 'https://api.omg.lol/address/elliott/dns/41905546' --data '{"type": "CNAME", "name": "bar", "data": "example.com"}'
{
    "request": {
        "status_code": 200,
        "success": true
    },
    "response": {
        "message": "Your DNS record was created successfully.",
        "data_sent": {
            "type": "CNAME",
            "priority": null,
            "ttl": null,
            "name": "bar.elliott",
            "content": "example.com"
        },
        "response_received": {
            "data": {
                "id": 41905782,
                "name": "bar.elliott",
                "content": "example.com",
                "ttl": 3600,
                "priority": null,
                "type": "CNAME",
                "created_at": "2023-02-05T05:46:12Z",
                "updated_at": "2023-02-05T05:46:12Z"
            }
        }
    }
}

Note that the message is "Your DNS record was created successfully.", and the record has a different id. See that 2 records are now present either by GETing the DNS records or checking in the dashboard.

@ejstreet ejstreet added the bug Something doesn’t work properly label Feb 5, 2023
@ejstreet
Copy link
Author

ejstreet commented Feb 5, 2023

I think this issue could probably be part of #532, however that issue didn't mention this specific behaviour.

@wayneyaoo
Copy link

@ejstreet Hey I had this problem too but using some guesswork I workaround it. Basically for this particular API you need specify the id inside the body.

curl --location --request PATCH --header "Authorization: Bearer $OMGLOL_API_KEY" 'https://api.omg.lol/address/elliott/dns/41905546' --data '{"type": "CNAME", "name": "bar", "data": "example.com", **"id":"123456"**}'

Indeed this is weird and I'm not sure if it's by design. Behavior has been inconsistent in different apis but I do understand. Adam got many stuff on his plate :).

btw this issue #534 is related. We can track it there.

@ejstreet ejstreet changed the title [Bug] API - DNS - Edit an existing DNS record does not work [Bug] API - DNS - Edit an existing DNS record does not work as described Feb 5, 2023
@newbold newbold self-assigned this Feb 5, 2023
@newbold newbold added the dns Related to omg.lol’s DNS service label Feb 5, 2023
@newbold
Copy link
Member

newbold commented Feb 5, 2023

@wayneyaoo is correct, and I apologize for the inconsistencies here. Some of these endpoints are a bit of a mess, and I do need to invest the time in doing an overhaul and general tightening of things with an aim toward consistency and accuracy. Hopefully won’t be too much longer before I get to that.

@ejstreet
Copy link
Author

ejstreet commented Feb 5, 2023

Thanks @newbold, I appreciate the effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something doesn’t work properly dns Related to omg.lol’s DNS service
Development

No branches or pull requests

3 participants