Bookmark this page

Guided Exercise: Creating an API Developer Portal

In this exercise, you will publish and customize the content in your Developer Portal.

Outcomes

You should be able to:

  • Publish your Developer Portal.

  • Create a new user in the Developer Portal.

  • Create restricted content in the Developer Portal.

  • Grant select users access to the restricted content.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

[student@workstation ~]$ lab start portal-creating

Procedure 5.1. Instructions

  1. Navigate to the Developer Portal.

    1. Log in to RHOCP:

      [student@workstation ~]$ oc login \
      -u=admin -p=redhat --server=https://api.ocp4.example.com:6443
      ...output omitted...
    2. In a new browser tab, log in to the 3scale tenant Admin Portal as the admin user.

      Execute the following command to see the ADMIN_PASSWORD:

      [student@workstation ~]$ oc get secret system-seed -n 3scale \
        -o json | jq -r .data.ADMIN_PASSWORD | base64 -d; echo
      ...output omitted...
    3. Click Dashboard > Audience, select Developer Portal, and click Content.

    4. Click Open your Portal to the world and select Ok. Then, in the left side menu, click Visit Portal.

  2. Create a new Developer Portal user.

    1. Click Signup to plan Basic.

    2. Provide the following details:

      • Organization/group name: GLS

      • Username: portal-user

      • Email: gls@redhat.com

      • Password: redhat

      • Password confirmation: redhat

      Then, click Sign up.

    3. In the Admin Portal, click Accounts > Listing. Then, click Activate to enable the portal-user account.

  3. Explore the created user.

    1. Click the GLS link. Note that the registration created an application for the user.

    2. Click the GLS's App link. Note that the user uses the Basic application plan, and has access to the API product.

  4. Create a restricted page on the Developer Portal.

    1. Click Developer Portal > Content. Then, click the arrow next to New Page and select New Section.

      Enter the following details:

      • Title: Restricted section

      • Public: unchecked

      Then, click Create Section.

    2. Then, click the arrow next to New Section and select New Page.

      Enter the following details:

      • Title: Restricted page

      • Section: Restricted section

      • Path: /restricted

      Enter <h1>Welcome to the Restricted Section</h1> as the HTML content of the page. Then, click Create Page and Publish.

  5. Verify that the /restricted page is not visible.

    1. Open a new browser window in an incognito mode, for example by pressing ctrl+shift+n in Firefox.

      Note

      If you visit the restricted section when logged in to the Admin Portal then you will see the content. You must either log out of the Admin Portal, open a different browser, or open a new browser window in the incognito mode.

    2. Navigate to https://3scale.apps.ocp4.example.com/restricted. You are presented with a Not found error screen.

  6. Allow the portal-user user to view the restricted content.

    1. In the Admin Portal, click Developer Portal > Groups.

    2. Click Create Group and provide the following details:

      • Name: privileged

      Then, click Create Group.

    3. Click Privileged. Then, select the Restricted section and click Save.

      Note

      There is currently a bug that prevents selected sections from being properly assigned to a group. You must open the group, select the section, and then update the group.

    4. Click Accounts > Listing. Then, click GLS.

    5. Click 0 Group Memberships. Then, select the privileged group and click Save.

  7. Verify that the portal-user can view the restricted content.

    1. Navigate to https://3scale.apps.ocp4.example.com/ and log in as the portal-user with the redhat password.

    2. Navigate to https://3scale.apps.ocp4.example.com/restricted. You are presented with the content.

Finish

On the workstation machine, use the lab command to complete this exercise. This is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish portal-creating

This concludes the guided exercise.

Revision: do240-2.11-40390f6