[Extending Admin API] Overriding generated admin api (partially) #7497
Replies: 3 comments 3 replies
-
hoping for an acknowledgement / possible solution |
Beta Was this translation helpful? Give feedback.
-
@TVenuMadhav part of the trouble you are experiencing is due to the fact that the Admin API "hooks" have not been properly formalized yet. As a result, the docs are not up to date so it is very difficult to understand how things work. Is your plugin code available somewhere? If it isn't possible for you to share it, could you include the parts around this?
The code surrounding that will define when/how that route is added. |
Beta Was this translation helpful? Give feedback.
-
You cannot just use anything like See: https://github.com/Kong/kong/blob/master/kong/api/endpoints.lua#L413-L414 |
Beta Was this translation helpful? Give feedback.
-
In lua plugin development, we have an option to define our own custom schema(s) and while doing that we also have an option to generate admin api by setting the
generate_admin_api = true
in schema config (daos.lua)Now let's say the admin api generated are 'list, create, retrieve, update & delete' on an entity and the usage of these admin api are as follows,
Examples:
List => GET /abc/
Retrieve => GET /abc/:id/
Create => POST /abc/
Update => PUT /abc/:id/
Delete => DELETE /abc/:id/
Now suppose if I want to override the DELETE admin api (to include some additional functionality for example), i would generally need to define the custom admin api implementation in api.lua file which goes something like,
What I expect
Now that we have overridden the DELETE admin api only, I expect all the other methods (Retrieve, update) to work as generated by default.
What I am experiencing
😕 But that is not the case, instead it looks like all the admin api methods that involve the uri signature
/abc/:id
stand overridden.Now only DELETE works are I have defined but GET '/abc/:id' & PUT '/abc/:id/' are undefined. I get method not allowed error on calling the retrieve and update admin apis!
Hope this makes sense!
I would love to get some help regarding this as the documentation isn't very clear on this [Ref] 🙏🏻
Beta Was this translation helpful? Give feedback.
All reactions