Manage Custom Pages in Developer Portal

Do you want to create a personalized page in Oracle API Platform Cloud Developer Portal? You can include new custom pages like About page, Home page, a page with FAQ or any page that suits your business needs. Oracle API Platform Cloud Service allows you to add and manage custom pages in the Developer Portal using REST API.

A custom page consists of two parts, metadata and content data (content.zip). The metadata contains all the information the Developer Portal needs to load and embed the content data. The content data itself is a self-contained package that contains the code of the custom page.

Using REST API, you can add a custom page, update the page when required, download the zipped content of a custom page and delete the custom pages when not in use. To update a page, you'll have to edit the content or metadata file and submit it using REST API.

Note: The example described in this topic provides instructions to add a personalized Home page in Developer Portal, which lists the APIs.

To add and manage a custom page in Developer Portal:
  1. Create a JSON document that defines the metadata of the custom page, metadata.json and note down the urlScheme value, which is the name of the custom page.

    In this example, the name of the custom page is Home.

    The following is the sample of the metadata.json file:

    {
      "homePage": "always",
      "module": {
        "urlScheme": "home",
        "documentationUrl": "https://docs.oracle.com/en/cloud/paas/api-platform-cloud/apfdv/index.html",
        "implementation": {
          "document": "index.html",
          "requirejs": {
            "path": "home",
            "start": "js/start"
          },
          "css": ["css/main.css"]
        }
      },
      "button": {
        "order": 500,
        "text": {
          "root": "Home"
        },
        "icon": {
          "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAYCAYAAAAxkDmIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABARJREFUeNrsmkloU0EcxpNQi1U8ueDdiwso9lIXtIJ68KAgovasHjyoFYsiolWxaEGL68ENFD14cgEVqxQXXE5KRbBV8SAIKoi0LkWsts/fhH/C9GVe3mTeC01KBj7ykkx/+cI3M/95kyY9z0tU2shtVa1tx4PeW4S2o/loFOpG59BZlB0VO5sanT74YMcXK35Y23fncyT//W2znfy/7n4Ti/8Z06ZG8h/WUgGvb0P30Rx0E11G49BpdB3VyHPXcIvKL7Z/wi0b/8lDR475X1uIHqIOtAb1Zvqi/WiP1vc9OqXETB6wDNeJjwYsZ7ATn5k8YBlurP4NMzhWvingW2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TkSuQmCC"
        }
      }
    }
  2. Create a content data (content.zip) that defines the content of the custom page.

    The content.zip file typically consists of the following files:

  3. Create a custom page in the Developer Portal using the HTTP PUT method.

    In this example, you'll create a custom page named Home.

    curl -i -X PUT
    -H 'Authorization: Bearer access_token'
    -H 'Content-Type: multipart/form-data' 
    -F 'content=@content.zip' 
    -F 'metadata=@metadata.json' 
    http://example.com/developers/services/v1/portal/customization/pages/{pageId}

    Specify the following options on the cURL command line:

    • -i option to include the HTTP header in the output.

    • -X option to indicate the type of request (PUT).

    • -H Content-Type to identify the content type as multipart/form-data.

    • -H Authorization to specify the access token for the Oracle API Platform Cloud Service account. See Security, Authentication and Authorization.

    • -F content to specify the name of the content data zipped file. For example, -F 'content=@content.zip'.

    • -F metadata to specify the name of the metadata file. For example, -F 'metadata=@metadata.json'.

    • Request URL: http://example.com/developers/services/v1/portal/customization/pages/{pageId}

      where, example.com is the host where Oracle API Platform Cloud Service is running and v1 is the REST API version.

    • {pageId} is the name of the custom page. For example Home. The name should be same as mentioned in the metadata.json file, "urlScheme": "Home".

    The following status in the response header indicates that the custom page is successfully created.

    Status 204 No Content
  4. Sign in to Oracle API Platform Developer Portal and note that a new tab, Home, is created. Click the new tab, Home and verify the content of the page.
    The new Home tab on the Oracle API Platform Developer Portal
  5. (Optional) If you have changes to the metadata, edit the metadata.json file. Follow the steps to update the metadata file:
    1. (optional) Retrieve the custom page metadata file using the HTTP GET method.
      curl -i -X GET 
      -H 'Authorization: Bearer access_token' 
      -H 'Content-Type: application/json' 
      http://example.com/developers/services/v1/portal/customization/pages/{pageId}/metadata

      Specify the following options on the cURL command line:

      • -i option to include the HTTP header in the output.

      • -X option to indicate the type of request (GET).

      • -H Content-Type to identify the content type as application/json.

      • -H Authorization to specify the access token for the Oracle API Platform Cloud Service account. See Security, Authentication and Authorization.

      • Request URL: http://example.com/developers/services/v1/portal/customization/pages/{pageId}/metadata.

        where, example.com is the host where Oracle API Platform Cloud Service is running and v1 is the REST API version.

      • {pageId} is the name of the custom page. For example Home.

      This returns the response header as Status 200 OK and the content of the metadata file in the response body. The following is the sample response body:

      {
          "button": {
              "icon": {
                  "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAYCAYAAAAxkDmIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABARJREFUeNrsmkloU0EcxpNQi1U8ueDdiwso9lIXtIJ68KAgovasHjyoFYsiolWxaEGL68ENFD14cgEVqxQXXE5KRbBV8SAIKoi0LkWsts/fhH/C9GVe3mTeC01KBj7ykkx/+cI3M/95kyY9z0tU2shtVa1tx4PeW4S2o/loFOpG59BZlB0VO5sanT74YMcXK35Y23fncyT//W2znfy/7n4Ti/8Z06ZG8h/WUgGvb0P30Rx0E11G49BpdB3VyHPXcIvKL7Z/wi0b/8lDR475X1uIHqIOtAb1Zvqi/WiP1vc9OqXETB6wDNeJjwYsZ7ATn5k8YBlurP4NMzhWvingW2gemoJ6DH9zGP2VZWOZ8iijarVNyASc5e9aMrmH59Z805cwBOzs3yZkAs7yCaeH55H8GwJ29m/im5boOnQ3AJ6QurBLHmeiA2glaqaeT7CYBGm+CrdQPrLmu/ivbuq05qtwS82/ia8HXI9uS6eflrViEO1FT+UDvhJyF2owzNx6FJmPulCDoW8s/gm5CzUYZm49Knn/fn4m4C3ogRT1S+iJ7W6AZdmTEdUoo2k0ukLILVq4znzZMebwUYvWx5nPsmzkE3KLFm7J+g/jqxpcJyPgEVqlFXXbgIc8J9ixPFyQmrB4cNbaPp3P0tzrm9mF7jCH8KnBfVH8+2+TCHYIv3NDzRA+S3Ovb2ZH8g8vkv8wfkq25L99O7bA+2a0VNb88QGBK8PrpIZs1vn+cF34tEB+HP4JPJDvD7cU/fv5KVkW1Lb8m8Xo2ITuoWvoap5Z/UtGZG2GT7ix8Wk5/Dj9E3IOn3DLxr/OT8mo+GM5/R+jf3J93qI2VPjDzFcf8BItkOIc1tRx2Xe57grqRB0eIzfszzN8am1sfFoOP07/1OEcPrW2bPzr/JScb05CR+W0JGg0eLK+Z9b+F+o1wvR84abkZEX1O6PzCblgvuHcNZDv4p8wPV+4gXxCLjn/YXy1PNxAF9FGNF3OPZ+FjBD9qOyTBDuRhxVoPZqLTlKL22WnnOVzneZTkwvi03L4qF3ei+yfYHP41OJ22Sln+Vyn+dTkkvIfxK+SN9WLb9EOGVHd8mFenlGlNgW1hJi5Kd8t93PqZnsrOqH1NfIJO5Sv3fQXzLfxT4jOfMIedv9h/CrtRKQVtcnZ5g+L0fPRd+LSLKPvFaH36x2ZrWk+gcbCVxtdw4lObP4Jvd93XpzmE2hZ+Nf5ph8b/Gt/MmH+/VFBlqN3BPrB5Y5cm8F5+SiQn+f3YGv/BOrkX5vBzv7z/B5s7T8fvyrCiUm1HIon8iwjiQp/ePmpRKWN6GY7g5O2Z9GOLVnk75m0PYsuN/9xBOwV+YtV+EXkJyv/VTmyW6UGj/D2X4ABAHDgwM81lh4xAAAAAElFTkSuQmCC"
              },
              "text": {
                  "root": "Home"
              },
              "order": 500
          },
          "module": {
              "documentationUrl": "https://docs.oracle.com/en/cloud/paas/api-platform-cloud/apfdv/index.html",
              "urlScheme": "home",
              "implementation": {
                  "css": [
                      "css/main.css"
                  ],
                  "document": "index.html",
                  "requirejs": {
                      "path": "home",
                      "start": "js/start"
                  }
              }
          },
          "homePage": "always"
      }
    2. Make the required updates to the metadata file. In this example, you'll learn how to rename the custom page to API Catalog.

      Rename the urlScheme and root attribute value to API Catalog. The following sample shows the updated value in the metadata.json file:

      {
        "homePage": "always",
        "module": {
          "urlScheme": "API Catalog",
          "documentationUrl": "https://docs.oracle.com/en/cloud/paas/api-platform-cloud/apfdv/index.html",
          "implementation": {
            "document": "index.html",
            "requirejs": {
              "path": "API Catalog",
              "start": "js/start"
            },
            "css": ["css/main.css"]
          }
        },
        "button": {
          "order": 500,
          "text": {
            "root": "API Catalog"
          },
          "icon": {
            "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAA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RhxVoPZqLTlKL22WnnOVzneZTkwvi03L4qF3ei+yfYHP41OJ22Sln+Vyn+dTkkvIfxK+SN9WLb9EOGVHd8mFenlGlNgW1hJi5Kd8t93PqZnsrOqH1NfIJO5Sv3fQXzLfxT4jOfMIedv9h/CrtRKQVtcnZ5g+L0fPRd+LSLKPvFaH36x2ZrWk+gcbCVxtdw4lObP4Jvd93XpzmE2hZ+Nf5ph8b/Gt/MmH+/VFBlqN3BPrB5Y5cm8F5+SiQn+f3YGv/BOrkX5vBzv7z/B5s7T8fvyrCiUm1HIon8iwjiQp/ePmpRKWN6GY7g5O2Z9GOLVnk75m0PYsuN/9xBOwV+YtV+EXkJyv/VTmyW6UGj/D2X4ABAHDgwM81lh4xAAAAAElFTkSuQmCC"
          }
        }
      }
    3. Update the metadata file using the HTTP PUT method.
      curl -i -X PUT  
      -H 'Authorization: Bearer access_token'  
      -H 'Content-Type: application/json' 
      -d @metadata.json  
      http://example.com/developers/services/v1/portal/customization/pages/{pageId}/metadata

      Specify the following options on the cURL command line:

      • -i option to include the HTTP header in the output.

      • -X option to indicate the type of request (PUT).

      • -H Content-Type to identify the content type as application/json.

      • -H Authorization to specify the access token for the Oracle API Platform Cloud Service account. See Security, Authentication and Authorization.

      • -d @metadata.json to identify the content type as application/json.

      • Request URL: http://example.com/developers/services/v1/portal/customization/pages/{pageId}/metadata.

        where, example.com is the host where Oracle API Platform Cloud Service is running and v1 is the REST API version.

      • {pageId} is the name of the custom page. For example Home. The name should be same as mentioned in the metadata.json file. "urlScheme": "API Catalog".

      The following in the response header indicates that the custom page is successfully updated.

      Status 204 No Content
    4. Sign in to Oracle API Platform Developer Portal and note that the name of the tab you created is now renamed to API Catalog.
  6. (Optional) Edit the content data files for any updates in the content or style of the custom page. Follow the steps to update the content.zip files.
    1. Download and view the content data for the custom page from the Developer Portal using the HTTP GET method.
      curl -i -X GET 
      -H 'Authorization: Bearer access_token' 
      -H 'Content-Type: application/octet-stream' 
      -o yourfolder/content.zip 
      http://example.com/developers/services/v1/portal/customization/pages/{pageId}/content

      Specify the following options on the cURL command line:

      • -X option to indicate the type of request (GET).

      • -H Content-Type to identify the content type as application/octet-stream.

      • -H Authorization to specify the access token for the Oracle API Platform Cloud Service account. See Security, Authentication and Authorization.

      • -o yourfolder/content.zip to specify the location of the content.zip file to which you wish to download.

      • Request URL: http://example.com/developers/services/v1/portal/customization/pages/{pageId}/content

        where, example.com is the host where Oracle API Platform Cloud Service is running and v1 is the REST API version.

      • {pageId} is the name of the custom page. For example Home.

      The following in the Response Header indicates that the custom page is successfully created.

      Status 204 No Content
    2. Make the required updates in the content data and update the content data in the Developer portal using the PUT method:
      curl -i -X PUT  
      -H 'Authorization: Bearer access_token'  
      -H 'Content-Type: application/octet-stream' 
      -d @content.zip  
      http://example.com/developers/services/v1/portal/customization/pages/{pageId}/content

      Specify the following options on the cURL command line:

      • -i option to include the HTTP header in the output.

      • -X option to indicate the type of request (PUT).

      • -H Content-Type to identify the content type as application/octet-stream.

      • -H Authorization to specify the access token for the Oracle API Platform Cloud Service account. See Security, Authentication and Authorization.

      • Request URL: http://example.com/developers/services/v1/portal/customization/pages/{pageId}/content.

        where, example.com is the host where Oracle API Platform Cloud Service is running and v1 is the REST API version.

      • {pageId} is the name of the custom page. For example Home.

      The following in the response header indicates that the custom page is successfully updated.
      Status 204 No Content
  7. If you want to delete the custom page, use the DELETE method:
    curl -i -X DELETE 
    -H 'Authorization: Bearer access_token'  
    http://example.com/developers/services/v1/portal/customization/pages/{pageId}

    Specify the following options on the cURL command line:

    • -i option to include the HTTP header in the output.

    • -X option to indicate the type of request (DELETE).

    • -H Content-Type to identify the content type as application/json.

    • -H Authorization to specify the access token for the Oracle API Platform Cloud Service account. See Security, Authentication and Authorization.

    • Request URL: http://example.com/developers/services/v1/portal/customization/pages/{pageId}/content

      where, example.com is the host where Oracle API Platform Cloud Service is running and v1 is the REST API version.

    • {pageId} is the name of the custom page. For example Home.