Configuring AppHub

Making Global Configuration Settings From the Command Line

You can make global configuration settings for your AppHub instance from the command line.

About This Task

Global configuration settings include:

  • Display name and logo
  • Theme
  • Enabled or disabled application chrome
  • JavaScript injection

To make global configuration settings from the command line, you use the POST command to send a JSON payload to the URL for your configuration service.

Procedure

To make global configuration settings, use the following JSON payload.
curl -s -X POST <apphub-config-url>/globalconfig \
  -H "authorization: bearer <uaa-client-token>" \
  -H "content-type: application/json" \
  -H "predix-zone-id: <apphub-service-zone-id>" \
  -d '{
       "name": "<apphub-display-name>",
       "logo": true | false,
       "logoUri": "<logo-uri>",
       "applicationChrome": true | false,
       "globalScripts": [<script-url>]
   }'
Table 1. Global Configuration JSON Options
KeyValueDescription
authorization: bearer<uaa-client-token>The token for the UAA client for your AppHub instance.
predix-zone-id<apphub-service-zone-id>The zone ID for your AppHub instance.
name<apphub-display-name>The name for your AppHub instance that you want to show at the top of each microapp page.
logotrue or falseSet to true to show a custom logo at the top of each AppHub microapp page, or false to disable logo display. If you leave this option empty, the default AppHub logo appears.
logoUri<logo-uri>The URI to an image file to use as a logo next to the instance name.
applicationChrometrue or falseSet to true to show the left navigation pane, or false to hide it.
globalScripts<script-url>The fully qualified URL to a JavaScript file you want to inject into your AppHub instance.

About Configuring Themes From the Command Line

You can add, configure, and maintain themes from the command line.

Whether you use ARCS or another configuration service for your AppHub instance, you can perform the following theme configuration and maintenance tasks from the command line:

If you are using ARCS, you can also perform many of these tasks by using the Settings microapp.

Adding Themes From the Command Line

You can add themes to your AppHub instance from the command line.

About This Task

To add themes from the command line, you use the POST command to send a JSON payload to the URL for your AppHub instance. If ARCS is your configuration service, you can also use the Settings microapp to add themes.

Procedure

Use the following JSON payload:
[
    {
       "baseUri": "<apphub-uri>",
       "main": "<main-template>",
       "error": "<error-template>",
       "errorChromeless": "<errorchromeless-template>",
       "options": {
           "<option-name>": "<option-value>"
       },
       "displayName": "<theme-name>",
       "demoLink": "<theme-demo>",
       "description": "<theme-description>"
   }
]

You can use the following cURL command:

curl -X POST \
  <arcsurl>/themes \
  -H 'authorization: <uaa-token>' \
  -H 'cache-control: cache | no-cache' \
  -H 'content-type: application/json' \
  -H 'predix-zone-id: <apphub-service-zone-id>' \
  -d '[
     {
       "baseUri": "<apphub-uri>",
       "main": "<main-template>",
       "error": "<error-template>",
       "errorChromeless": "<errorchromeless-template>",
       "options": {
           "<option-name>": "<option-value>"
       },
       "displayName": "<theme-name>",
       "demoLink": "<theme-demo>",
       "description": "<theme-description>"
    }
]'
Table 2. Themes Configuration Options
KeyValueDescription
baseUri<apphub-uri>The URI where your AppHub instance is hosted.
main<main-template>The relative path to the HTML template to use for the main page view for the microapp.
error<error-template>The relative path to the HTML template to use for errors.
errorChromeless<errorchromeless-template>The relative path to the HTML template to use for chromeless errors.
optionsArray of <option-name> and <option-value>Names and values of theme options, for example, "color":"dark". You can defiine multiple options.
displayName<theme-name>The name to use for this theme in the UI.
demoLink<theme-demo>The URL to a demo AppHub instance with this theme applied.
arcsurl<arcsurl>The URL for your ARCS server or other configuration service.
description<theme-description>A brief description of the theme.
authorization<uaa-token>The token for the UAA client for your AppHub instance.
cache-controlcache or no-cacheSet cache to enable caching or no-cache to disable caching for this microapp.
predix-zone-id<apphub-service-zone-id>The zone ID for your AppHub instance.

Updating Themes From the Command Line

You can ujpdate themes in your AppHub instance from the command line.

About This Task

To update themes from the command line, you use the PUT command to send a JSON payload to the URL for your AppHub instance. If ARCS is your configuration service, you can also use the Settings microapp to update themes.

Procedure

Do one of the following:
  • Use the following JSON payload:
    [
        {
           "uri": <theme-uri>",
           "baseUri": "<apphub-uri>",
           "main": "<main-template>",
           "error": "<error-template>",
           "errorChromeless": "<errorchromeless-template>",
           "options": {
               "<option-name>": "<option-value>"
           },
           "displayName": "<theme-name>",
           "demoLink": "<theme-demo>",
           "description": "<theme-description>"
       }
    ]
  • Use the following cURL command:
    curl -X PUT \
      <arcsurl>/themes \
      -H 'authorization: <uaa-token>' \
      -H 'cache-control: cache | no-cache' \
      -H 'content-type: application/json' \
      -H 'predix-zone-id: <apphub-service-zone-id>' \
      -d '[
         {
           "baseUri": "<apphub-uri>",
           "main": "<main-template>",
           "error": "<error-template>",
           "errorChromeless": "<errorchromeless-template>",
           "options": {
               "<option-name>": "<option-value>"
           },
           "displayName": "<theme-name>",
           "demoLink": "<theme-demo>",
           "description": "<theme-description>"
        }
    ]'
Table 3. Themes Update Options
KeyValueDescription
uri<theme-uri>The URI where the theme is hosted.
baseUri<apphub-uri>The URI where your AppHub instance is hosted.
main<main-template>The relative path to the HTML template to use for the main page view for the microapp.
error<error-template>The relative path to the HTML template to use for errors.
errorChromeless<errorchromeless-template>The relative path to the HTML template to use for chromeless errors.
optionsArray of <option-name> and <option-value>Names and values of theme options, for example, "color":"dark". You can defiine multiple options.
displayName<theme-name>The name to use for this theme in the UI.
demoLink<theme-demo>The URL to a demo AppHub instance with this theme applied.
description<theme-description>A brief description of the theme.
arcsurl<arcsurl>The URL for your ARCS server or other configuration service.
authorization<uaa-token>The token for the UAA client for your AppHub instance.
cache-controlcache or no-cacheSet cache to enable caching or no-cache to disable caching for this microapp.
predix-zone-id<apphub-service-zone-id>The zone ID for your AppHub instance.

Retrieving Theme Configuration Settings

You can retrieve theme configuration settings for your AppHub instance from the command line.

About This Task

To retrieve theme configuration settings for your AppHub instance, you use cURL with the GET command to send a JSON payload to the ARCS URL for your instance.

Procedure

Use the following cURL command:
curl -X GET \
  <arcsurl>/themes \
  -H 'authorization: <uaa-token>' \
  -H 'cache-control: cache | no-cache' \
  -H 'content-type: application/json' \
  -H 'predix-zone-id: <apphub-service-zone-id>'
 
Table 4. Themes Configuration Options
KeyValueDescription
arcsurl<arcsurl>The URL for your ARCS server or other configuration service.
authorization<uaa-token>The token for the UAA client for your AppHub instance.
cache-controlcache or no-cacheSet cache to enable caching or no-cache to disable caching for this microapp.
predix-zone-id<apphub-service-zone-id>The zone ID for your AppHub instance.

Deleting Themes From the Command Line

You can delete themes from your AppHub instance from the command line.

About This Task

To delete themes from your AppHub instance, you use cURL with the DELETE command to send application details to the ARCS URL for your instance.

Procedure

Use the following cURL command:
curl -X DELETE \
  <arcsurl>/themes \
  -H 'authorization: <uaa-token>' \
  -H 'cache-control: cache | no-cache' \
  -H 'content-type: application/json' \
  -H 'predix-zone-id: <apphub-service-zone-id>'
 
Table 5. Themes Configuration Options
KeyValueDescription
arcsurl<arcsurl>The URL for your ARCS server or other configuration service.
authorization<uaa-token>The token for the UAA client for your AppHub instance.
cache-controlcache or no-cacheSet cache to enable caching or no-cache to disable caching for this microapp.
predix-zone-id<apphub-service-zone-id>The zone ID for your AppHub instance.

About Configuring Privileges From the Command Line

You can add, configure, and maintain privileges for your AppHub instance from the command line.

Whether you use ARCS or another configuration service for your AppHub instance, you can perform the following privileges configuration and maintenance tasks from the command line:

If you are using ARCS, you can also perform many of these tasks by using the Settings microapp.

Configuring Privileges From the Command Line

You can configure privileges for your AppHub instance from the command line.

About This Task

To configure privileges from the command line, you use the POST command to send a JSON payload to the URL for your AppHub instance. If ARCS is your configuration service, you can also use the Settings microapp to configure privileges.

Procedure

Do one of the following:
  • Use the following JSON payload:
    {
       "uri": "<privilege-uri>",
       "privilegeUri": "<privilege-host>"
    }
    
  • Use the following cURL command:
    curl -X POST \
      <arcsurl>/privileges/ \
      -H 'authorization: <uaa-token>' \
      -H 'cache-control: cache | no-cache' \
      -H 'content-type: application/json' \
      -H 'predix-zone-id: <apphub-service-zone-id>' \
      -d '[
         {
           "uri": "<privilege-uri>",
           "privilegeUri": "<privilege-host>"
        }
    ]'
Table 6. Privileges Configuration Options
KeyValueDescription
uri<privilege-uri>The fully qualified URL to a privileges server to use for access control for your AppHub service instance.
privilegeUri<privilege-host>The host server and port to use to connect with the privileges server.
arcsurl<arcsurl>The URL for your ARCS server or other configuration service.
authorization<uaa-token>The token for the UAA client for your AppHub instance.
cache-controlcache or no-cacheSet cache to enable caching or no-cache to disable caching for this microapp.
predix-zone-id<apphub-service-zone-id>The zone ID for your AppHub instance.

Updating Privileges From the Command Line

You can update privileges for your AppHub instance from the command line.

About This Task

To update privileges from the command line, you use the PUT command to send a JSON payload to the URL for your AppHub instance. If ARCS is your configuration service, you can also use the Settings microapp to update privileges.

Procedure

Do one of the following:
  • Use the following JSON payload:
    {
        "uri": "<privilege-uri>",
        "privilegeUri": "<privilege-host>"
        "uaaMetadata":
        {
            "uri":"<uaa-uri>",
            "clientId":"<uaa-admin-id>",
            "clientSecret":"<uaa-admin-secret>"
        }
    }
    
  • Use the following cURL command:
    curl -X PUT \
      <arcsurl>/privileges/ \
      -H 'authorization: <uaa-token>' \
      -H 'cache-control: cache | no-cache' \
      -H 'content-type: application/json' \
      -H 'predix-zone-id: <apphub-service-zone-id>' \
      -d '[
        {
            "uri": "<privilege-uri>",
            "privilegeUri": "<privilege-host>"      
            "uaaMetadata":
                {
                "uri":"<uaa-uri>",
                "clientId":"<uaa-admin-id>",
                "clientSecret":"<uaa-admin-secret>"
                }
            }
    ]'
Table 7. Privileges Update Options
KeyValueDescription
uri<privilege-uri>The fully qualified URL to a privileges server to use for access control for your AppHub service instance.
privilegeUri<privilege-host>The host server and port to use to connect with the privileges server.
uaaMetadataArray of uri, clientID, and clientSecret.These options can be set only by updating privileges after you make initial settings by using POST.
uri<uaa-uri>The URI for the Predix UAA service instance associated with your AppHub instance.
clientID<uaa-admin-id>The admin client ID for the UAA service instance.
clientSecret<uaa-admin-secret>The admin client secret for the UAA service instance.
arcsurl<arcsurl>The URL for your ARCS server or other configuration service.
authorization<uaa-token>The token for the UAA client for your AppHub instance.
cache-controlcache or no-cacheSet cache to enable caching or no-cache to disable caching for this microapp.
predix-zone-id<apphub-service-zone-id>The zone ID for your AppHub instance.

Retrieving Privileges Configuration Settings

You can delete privilege settings for your AppHub instance from the command line.

About This Task

To retrieve privilege configuration settings for your AppHub instance, you use cURL with the GET command to send a JSON payload to the ARCS URL for your instance.

Procedure

Use the following cURL command:
curl -X GET \
  <arcsurl>/privileges/ \
  -H 'authorization: <uaa-token>' \
  -H 'cache-control: cache | no-cache' \
  -H 'content-type: application/json' \
  -H 'predix-zone-id: <apphub-service-zone-id>' \
  -d '[
    {
        "uri": "<privilege-uri>",
        "privilegeUri": "<privilege-host>"      
        "uaaMetadata":
            {
            "uri":"<uaa-uri>",
            "clientId":"<uaa-admin-id>",
            "clientSecret":"<uaa-admin-secret>"
            }
        }
]'
Table 8. Privileges Retrieval Options
KeyValueDescription
arcsurl<arcsurl>The URL for your ARCS server or other configuration service.
authorization<uaa-token>The token for the UAA client for your AppHub instance.
cache-controlcache or no-cacheSet cache to enable caching or no-cache to disable caching for this microapp.
predix-zone-id<apphub-service-zone-id>The zone ID for your AppHub instance.
uri<privilege-uri>The fully qualified URL to a privileges server to use for access control for your AppHub service instance.
privilegeUri<privilege-host>The host server and port to use to connect with the privileges server.
uaaMetadataArray of uri, clientID, and clientSecret.These options can be set only by updating privileges after you make initial settings by using POST.
uri<uaa-uri>The URI for the Predix UAA service instance associated with your AppHub instance.
clientID<uaa-admin-id>The admin client ID for the UAA service instance.
clientSecret<uaa-admin-secret>The admin client secret for the UAA service instance.

Deleting Privilege Settings From the Command Line

You can delete privilege configuration settings from your AppHub instance from the command line.

About This Task

To delete privilege settings from your AppHub instance, you use cURL with the DELETE command to send application details to the ARCS URL for your instance.

Procedure

Use the following cURL command:
curl -X DELETE \
  <arcsurl>/privileges/ \
  -H 'authorization: <uaa-token>' \
  -H 'cache-control: cache | no-cache' \
  -H 'content-type: application/json' \
  -H 'predix-zone-id: <apphub-service-zone-id>'

About Configuring Preferences From the Command Line

You can add, configure, and maintain preferences for your AppHub instance from the command line.

Whether you use ARCS or another configuration service for your AppHub instance, you can perform the following preferences configuration and maintenance tasks from the command line:

If you are using ARCS, you can also perform many of these tasks by using the Settings microapp.

Configuring Preferences From the Command Line

You can configure preferences for your AppHub instance from the command line.

About This Task

To configure preferences from the command line, you use the POST command to send a JSON payload to the URL for your AppHub instance. If ARCS is your configuration service, you can also use the Settings microapp to configure preferences.

Procedure

Do one of the following:
  • Use the following JSON payload:
    {
       "uri": "<preference-uri>",
       "preferredLocale": "<preferred-locale>",
       "preferenceUri": "<preference-host>"
    }
    
  • Use the following cURL command:
    curl -X POST \
      <arcsurl>/preferences \
      -H 'authorization: <uaa-token>' \
      -H 'cache-control: cache | no-cache' \
      -H 'content-type: application/json' \
      -H 'predix-zone-id: <apphub-service-zone-id>' \
      -d '[
         {
           "uri": "<preference-uri>",
           "preferredLocale": "<preferred-locale>",
           "preferenceUri": "<preference-host>"
        }
    ]'
Table 9. Preferences Configuration Options
KeyValueDescription
uri<preference-uri>The fully qualified path to a preferences server for the specified default language.
preferredLocale<preferred-locale>The default language to use for your AppHub service instance.
preferenceUri<preference-host>The host server and port to use to connect with the preferences server.
authorization<uaa-token>The token for the UAA client for your AppHub instance.
cache-controlcache or no-cacheSet cache to enable caching or no-cache to disable caching for this microapp.
predix-zone-id<apphub-service-zone-id>The zone ID for your AppHub instance.

Updating Preferences From the Command Line

You can update preferences for your AppHub instance from the command line.

About This Task

To update preferences from the command line, you use the PUT command to send a JSON payload to the URL for your AppHub instance. If ARCS is your configuration service, you can also use the Settings microapp to update preferences.

Procedure

Do one of the following:
  • Use the following JSON payload:
    {
       "uri": "<preference-uri>",
       "preferredLocale": "<preferred-locale>",
       "preferenceUri": "<preference-host>"
    }
    
  • Use the following cURL command:
    curl -X PUT \
      <arcsurl>/preferences \
      -H 'authorization: <uaa-token>' \
      -H 'cache-control: cache | no-cache' \
      -H 'content-type: application/json' \
      -H 'predix-zone-id: <apphub-service-zone-id>' \
      -d '[
        {
           "uri": "<preference-uri>",
           "preferredLocale": "<preferred-locale>",
           "preferenceUri": "<preference-host>"
        }
    ]'
Table 10. Preferences Configuration Options
KeyValueDescription
uri<preference-uri>The fully qualified path to a preferences server for the specified default language.
preferredLocale<preferred-locale>The default language to use for your AppHub service instance.
preferenceUri<preference-host>The host server and port to use to connect with the preferences server.
arcsurl<arcsurl>The URL for your ARCS server or other configuration service.
authorization<uaa-token>The token for the UAA client for your AppHub instance.
cache-controlcache or no-cacheSet cache to enable caching or no-cache to disable caching for this microapp.
predix-zone-id<apphub-service-zone-id>The zone ID for your AppHub instance.

Retrieving Preferences Configuration Settings

You can delete preference settings for your AppHub instance from the command line.

About This Task

To retrieve preference configuration settings for your AppHub instance, you use cURL with the GET command to send a JSON payload to the ARCS URL for your instance.

Procedure

Use the following cURL command:
curl -X GET \
  <arcsurl>/preferences \
  -H 'authorization: <uaa-token>' \
  -H 'cache-control: cache | no-cache' \
  -H 'content-type: application/json' \
  -H 'predix-zone-id: <apphub-service-zone-id>' \
  -d '[
    {
       "uri": "<preference-uri>",
       "preferredLocale": "<preferred-locale>",
       "preferenceUri": "<preference-host>"
    }
]'
Table 11. Preferences Retrieval Options
KeyValueDescription
arcsurl<arcsurl>The URL for your ARCS server or other configuration service.
authorization<uaa-token>The token for the UAA client for your AppHub instance.
cache-controlcache or no-cacheSet cache to enable caching or no-cache to disable caching for this microapp.
predix-zone-id<apphub-service-zone-id>The zone ID for your AppHub instance.
preferredLocale<preferred-locale>The default language to use for your AppHub service instance.
preferenceUri<preference-host>The host server and port to use to connect with the preferences server.