Skip to content

Usage Examples in API tab use placeholder hostname instead of HTTPRoute hostname #319

Description

@bugbiteme

Is your feature request related to a problem? Please describe.

The Usage Examples shown in the API tab of the dev portal use a hardcoded placeholder hostname rather than the actual HTTPRoute hostname associated with the API Product. This means the generated curl examples are incorrect and would fail if used as-is by a consumer.

Current (incorrect) output:

curl -X GET https://my-api-6fa8bd.apps.example.com/api/v1/endpoint \
  -H "Authorization: APIKEY <your-api-key>"

The hostname my-api-6fa8bd.apps.example.com does not reflect the actual route. The correct hostname is sourced from the HTTPRoute resource associated with the API Product.

Expected output (based on actual HTTPRoute):

curl -X GET https://my-rest-api-406.demo.leonlevy.lol/api/v1/endpoint \
  -H "Authorization: APIKEY <your-api-key>"

The HTTPRoute hostname is already surfaced in the API Product Details panel on the Overview tab (as the HOSTNAME field), confirming the data is available — it just isn't being used to populate the Usage Examples.

$ oc -n my-rest-api get httproute my-rest-api-406
NAME              HOSTNAMES                                 AGE
my-rest-api-406   ["my-rest-api-406.demo.leonlevy.lol"]   3d21h

Describe the solution you'd like

The Usage Examples in the API tab should dynamically populate the hostname from the HTTPRoute associated with the API Product, following this pattern:

curl -X GET https://<httproute-hostname>/api/v1/<endpoint> \
  -H "Authorization: APIKEY <your-api-key>"

Since the HOSTNAME field is already available in the API Product details (sourced from the HTTPRoute), the code generation for Usage Examples should reference that value instead of a static placeholder.

Describe alternatives you've considered

  • Displaying the correct hostname as a static read-only field near the Usage Examples (lower fidelity, but still better than a wrong placeholder)
  • Adding a note to the Usage Examples section indicating that consumers should replace the hostname with the one shown in the Overview tab, though this is a poor UX workaround

Additional context

Screenshots below show the discrepancy:

  • Image 1: API tab showing incorrect placeholder hostname in Usage Examples
Image
  • Image 2: API Product Details (consumer view) showing ROUTE but missing HOSTNAME
Image
  • Image 3: API Product Overview (admin/owner view) showing the correct HOSTNAME field populated from the HTTPRoute
Image

The fact that HOSTNAME appears in Image 3 but not Image 2 may indicate a secondary bug where the hostname is not exposed consistently across views.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttriage/acceptedReviewed, prioritised, and ready for work

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions