Skip to content
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

[docs] Lua record usage with the API. #9310

Open
libesz opened this issue Jul 8, 2020 · 5 comments
Open

[docs] Lua record usage with the API. #9310

libesz opened this issue Jul 8, 2020 · 5 comments

Comments

@libesz
Copy link

libesz commented Jul 8, 2020

  • Program: Authoritative
  • Issue type: Bug report

Short description

I could not find Lua record usage description with the API explained in the documentation. I could figure out based on the generic SQL examples that the record type should be LUA instead of i.e. A and then the content should contain the record type, followed by the quoted script. However the record format in general is briefly explained, this is not straightforward. I would suggest to add this to the API docs here and here.

Environment

  • Operating system: Alpine 3.12
  • Software version: 4.2.2
  • Software source: alpine package
@ross
Copy link

ross commented Jun 1, 2022

@libesz were you able to figure out what the API wants here? I've tried sending in:

{
    "name": "lua.exxampled.com",
    "type": "LUA",
    "ttl": 3600,
    "changetype": "REPLACE",
    "records": [{
        "content": "A \\"\'1.2.3.4\'\\"",
        "disabled": false
    }]
}

And a bunch of other variants without any luck. I went into the DB backing my local pdns server and created the above record with SQL. When I query with dig it works as expected. When I list things in the API I get back:

{
    "comments": [],
    "name": "lua.exxampled.com.",
    "records": [{
        "content": "A \\"\'1.2.3.4\'\\"",
        "disabled": false
    }],
    "ttl": 3600,
    "type": "LUA"
}

which seems to match up afaict.

No matter what I do I end up getting a 422:

422 Client Error: Unprocessable Entity for url: http://127.0.0.1:8081/api/v1/servers/localhost/zones/exxampled.com.

/cc octodns/octodns-powerdns#7

@Habbie Habbie added this to the auth-4.8.0 milestone Nov 28, 2022
@Habbie Habbie modified the milestones: auth-4.8.0, auth-4.9.0 Apr 14, 2023
@KAloraifi
Copy link

I've tried the other way around, by creating a Lua record through an open-source solution like Poweradmin, then tried fetching the records using their API.

Unfortunately, the API responds with 500 Internal Server Error. @ross Did you manage to get it to work?

@zeha
Copy link
Collaborator

zeha commented Nov 2, 2023

Unfortunately, the API responds with 500 Internal Server Error. @ross Did you manage to get it to work?

What does the server log report in this case?

@ross
Copy link

ross commented Nov 2, 2023

Unfortunately, the API responds with 500 Internal Server Error. @ross Did you manage to get it to work?

It's been long enough that I don't really remember. I definitely wasn't hitting 500 errors though. My end conclusion was that the lua support in API wasn't particularly polished. Wonder if Poweradmin is using it. If so maybe it's worth looking at what it's doing.

@KAloraifi
Copy link

Unfortunately, the API responds with 500 Internal Server Error. @ross Did you manage to get it to work?

What does the server log report in this case?

Hello @zeha, I wasn't able to inspect the response body when I was trying. Will have to get back to you on that next week.

@Habbie Habbie modified the milestones: auth-4.9.0, auth-helpneeded Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants