
This assumes Kong has been secured with Role Based Access Control (RBAC) and you have created your Kong-Admin-Token. The following curl command can be used to list the endpoints that can be used with the API.
curl --header "Kong-Admin-Token: abc123" --request GET "https://kong.example.com/endpoints"
Something like this should be returned. Notice that the /workspaces/<workspace name> endpoint can be used.
{
"data": [
"/",
"/acls",
"/acls/{acls}",
"/acls/{acls}/consumer",
"/workspaces",
"/workspaces/{workspaces}",
"/workspaces/{workspaces}/meta"
]
}
The following curl command can be used to list the workspace named "default".
curl --header "Kong-Admin-Token: abc123" --request GET "https://kong.example.com/workspaces/default"
This could also be seen using the Kong web browser console. Notice the default workspace has Set up Dev Portal.
Something like this should be returned. Notice portal: false, which means the Kong Dev Portal is not enabled for the "default" workspace.
{
"data": [
{
"comment": null,
"config": {
"meta": null,
"portal": false,
"portal_access_request_email": null,
"portal_approved_email": null,
"portal_auth": null,
"portal_auth_conf": null,
"portal_auto_approve": null,
"portal_cors_origins": null,
"portal_developer_meta_fields": "[{\"label\":\"Full Name\",\"title\":\"full_name\",\"validator\":{\"required\":true,\"type\":\"string\"}}]",
"portal_emails_from": null,
"portal_emails_reply_to": null,
"portal_invite_email": null,
"portal_is_legacy": null,
"portal_reset_email": null,
"portal_reset_success_email": null,
"portal_session_conf": null,
"portal_token_exp": null
},
"created_at": 1607443774,
"id": "649b4959-5046-4862-9e0a-1aa8c14dc82c",
"meta": {
"color": null,
"thumbnail": null
},
"name": "default"
}
]
}
The following curl command can be used to enable the Kong Dev Portal for a workspace.
curl --header "Kong-Admin-Token: abc123" --request PATCH "https://kong.example.com/workspaces/default" --data "config.portal=true"
Reissue the following curl command.
curl --header "Kong-Admin-Token: abc123" --request GET "https://kong.example.com/workspaces/default"
Notice portal: true, which means the Kong Dev Portal is now enabled for the "default" workspace.
{
"data": [
{
"comment": null,
"config": {
"meta": null,
"portal": true,
"portal_access_request_email": null,
"portal_approved_email": null,
"portal_auth": null,
"portal_auth_conf": null,
"portal_auto_approve": null,
"portal_cors_origins": null,
"portal_developer_meta_fields": "[{\"label\":\"Full Name\",\"title\":\"full_name\",\"validator\":{\"required\":true,\"type\":\"string\"}}]",
"portal_emails_from": null,
"portal_emails_reply_to": null,
"portal_invite_email": null,
"portal_is_legacy": null,
"portal_reset_email": null,
"portal_reset_success_email": null,
"portal_session_conf": null,
"portal_token_exp": null
},
"created_at": 1607443774,
"id": "649b4959-5046-4862-9e0a-1aa8c14dc82c",
"meta": {
"color": null,
"thumbnail": null
},
"name": "default"
}
]
}
Did you find this article helpful?
If so, consider buying me a coffee over at