Bootstrap FreeKB - Kong Enterprise Edition (KongEE) - Create workspace using REST API
Kong Enterprise Edition (KongEE) - Create workspace using REST API


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 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 create a workspace.

curl --header "Kong-Admin-Token: abc123" --request PUT "https://kong.example.com/workspaces/my-workspace"

 

Something like this should be returned.

{
    "comment": null,
    "config": {
        "meta": null,
        "portal": false,
        "portal_access_request_email": null,
        "portal_application_request_email": null,
        "portal_application_status_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_smtp_admin_emails": null,
        "portal_token_exp": null
    },
    "created_at": 1659000291,
    "id": "a4788452-48b5-4013-bfb2-260ee4bcfe64",
    "meta": {
        "color": null,
        "thumbnail": null
    },
    "name": "my-workspace"
}

 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 89a7e3 in the box below so that we can be sure you are a human.