Skip to content
You are viewing the latest documentation for Solo Enterprise for kgateway. To access the documentation for older versions, use the version switcher.

View and test APIs

Page as Markdown

Explore how to use the frontend app to view the API products you are subscribed to and try out sample API requests.

An API represents an API product that the Portal admin set up to bundle the APIs that you are able to access. The following restrictions apply:

  • APIs might be marked as private. Only authorized users can see the API in the frontend app.
  • Portal users can view the specification and documentation of public APIs in the API catalog. However, access to an API is denied until the following conditions are met:
    • The user’s team is subscribed to an API with an API subscription.
    • The API subscription is approved by a Portal admin.
    • The user self-serviced the appropriate credentials to access the API.
  • Portal users cannot change or remove APIs from the API catalog.

Before you begin

Portal admins must complete the following tasks:

  1. Set up a portal web server.
  2. Secure the login to the portal frontend.
  3. Optional: Set up API key or OAuth auth for the ApiProducts in the portal.

Portal users must complete the following tasks:

  1. Create a Team, an app, and a subscription to your app.
  2. Optional: If the API is protected with an API key or OAuth client, create the appropriate credentials.

View API specs and docs

  1. In your browser, open the portal frontend app, such as http://portal.example.com:8080/ and log in as a Portal user.
  2. In the frontend app, go to APIs.
  3. Find the API products that the Portal admin created and select the one you want to see the details for.
  4. Review the API’s specification (Spec) or documentation (Docs). You can also add the API product to an app by using the SUBSCRIBE button.

Test API access

You can test API access by using the UI or CLI by using a curl client.

UI

  1. In your browser, open the portal frontend app, such as http://portal.example.com:8080/ and log in as a Portal user.
  2. Select APIs, and find and select the API product that you are subscribed to. The API specification opens automatically using a Redoc View.
  3. Click Swagger View to change to the Swagger view.
  4. Click Authorize. Depending on how the Portal admin protected your API, you either see a window to enter an API key or an ID token.
  5. Enter the API key or access token that you created and click Authorize. To create credentials to access your APIs, see Create API credentials.
  6. Select an API that you want to try, such as GET httpbin/headers.
  7. Click Try it out, and then Execute. Verify that you get back a 200 HTTP response code. Note that the Portal admin might set up default rate limits for that API.

CLI with curl

Instead of using the portal frontend app, you can also send a curl request to the httpbin API to verify that your credentials are working.

Cloud Provider Load Balancer

curl -vik ${INGRESS_GW_ADDRESS}:8080/httpbin/headers \
   -H "host: api.example.com" 
   -H "api-key: $API_KEY"

Port-forward for local testing

curl -vik localhost:8080/httpbin/headers \
   -H "host: api.example.com" 
   -H "api-key: $API_KEY" 

Cloud Provider Load Balancer

curl -vik ${INGRESS_GW_ADDRESS}:8080/httpbin/headers \
   -H "host: api.example.com" 
   -H "Authorization: Bearer $ACCESS_TOKEN"

Port-forward for local testing

curl -vik localhost:8080/httpbin/headers \
   -H "host: api.example.com" 
   -H "Authorization: Bearer $ACCESS_TOKEN"