Updating existing Consumer credentials or applications in Kong using its admin API

We are using Kong as Gateway( free opensource version ) & have exposed wrapper API internally calling Kong Admin API’s to create config into Kong database. Now we want to expose wrapper update all API which will update existing config in the database from source, by calling Admin API’s.

I have a issue finding Admin API for updating existing Consumer credentials or applications ( Basic-Auth/ Oauth2). I have checked the documentation for Admin API & OAuth 2.0 plugin, but couldn’t find API URI. The URI listed on the Oauth 2.0 plugin documentation for create is as below -

curl -X POST http://kong:8001/consumers/{consumer_id}/oauth2

I tried PUT & PATCH on the URI but it doesnt work, I get response saying method not allowed. Has anyone tried to update the credential for consumer in kong before using Admin API. I was thinking of deleting the credentials which are updated & then creating them with post API but there is no delete on credentials as well. The only way you can delete the credentials is to delete consumer & create consumer & its credentials again.

Please suggest any alternative approach if the API is not implemented for updating the same.

1 Like