Skip to content

aerogear/unifiedpush-cli

Repository files navigation

UnifiedPush Client CLI

Build Coverage Status

The UnifiedPush Client CLI makes it easy to interact with the UnifiedPush Server from the command line.

Prerequisites

To run the UnifiedPush Client you will need to have node installed.

Installing

Run

npm install -g @aerogear/unifiedpush-cli

That will install the latest version of the UnifiedPush Client CLI in your machine. When the installation will end, you will be able to access the client by running:

ups

Two namespaces are provided:

  • applications: contains all the commands administering applications
  • variants: contains all the commands administering variants

Applications

Creating applications

$ ups applications create --help

create a new application

Create application:
  -U, --url     URL of the UPS server                        [string] [required]
  --name        Name of the application to create            [string] [required]
  --output, -o  The output to be generated
                          [string] [choices: "table", "json"] [default: "table"]


[8X--- CUT]

Example

$ ups applications create -U http://localhost:9999 --name TEST-APPLICATION
Application created successfully

╔══════════════════╀══════════════════════════════════════╗
β•‘ NAME             β”‚ PUSH-APPLICATION-ID                  β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ TEST-APPLICATION β”‚ 5a045786-2be9-410f-9f78-9951fe1441dc β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

If we want a json output:

$ ups applications create -U http://localhost:9999 --name TEST-APPLICATION-JSON -o json
[{"id":"499e05eb-0829-4eef-a6f6-d20fa4a03e8e","name":"TEST-APPLICATION-JSON","description":null,"pushApplicationID":"e3026570-022f-4e31-a977-ef3df8bce00d","masterSecret":"43024cb7-e8b8-472d-862f-eb97e0f15217","developer":"admin","variants":[]}]

Deleting applications

$ ups applications delete --help
delete applications

Delete Applications:
  -U, --url      URL of the UPS server                       [string] [required]
  --name         Deletes all the applications with a given name         [string]
  --app-id       Deletes the application identified by the given id      [string]
  --description  Deletes all the applications matching the given description
                                                                        [string]
  --developer    Deletes all the applications matching the given developer
                                                                        [string]
[8X--- CUT]

The --name, --app-id, --description, --developer options should be used to filter the list of applications to be deleted. More than one option can be specified at once.

Example

$ ups applications delete -U http://localhost:9999 --name TEST-APPLICATION-JSON
1 application(s) deleted

Listing applications

$ ups applications list --help
lists the applications

Applications list:
  -U, --url      URL of the UPS server                       [string] [required]
  --app-id       Returns the application identified by the given id      [string]
  --name         Returns all the applications with a given name         [string]
  --description  Returns all the applications matching the given description
                                                                        [string]
  --developer    Returns all the applications matching the given developer
                                                                        [string]
  --output, -o   The output to be generated
                          [string] [choices: "table", "json"] [default: "table"]

[8X--- CUT]

Example

$ ups applications list -U http://localhost:9999
╔══════════════════╀══════════════════════════════════════╀══════════╀═══════════════╀═══════════════╗
β•‘ NAME             β”‚ PUSH-APPLICATION-ID                  β”‚ VARIANTS β”‚ INSTALLATIONS β”‚ SENT-MESSAGES β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ TEST-APPLICATION β”‚ 5a045786-2be9-410f-9f78-9951fe1441dc β”‚ 0        β”‚ 0             β”‚ 0             β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

The --name, --app-id, --description, --developer options should be used to filter the list of applications. More than one option can be specified at once.

The --output can be used to get the result as json:

$ ups applications list -U http://localhost:9999 --output json
[{"id":"c0c2d3d8-6622-4fe6-8447-80b2c4c627b5","name":"TEST-APPLICATION","description":null,"pushApplicationID":"5a045786-2be9-410f-9f78-9951fe1441dc","masterSecret":"9f0277cf-a0ce-45fb-94bc-d71aa0f08149","developer":"admin","variants":[],"metadata":{"activity":0,"deviceCount":0}}]

Renaming applications

$ ups applications rename --help

rename one application

Rename Application:
  -U, --url     URL of the UPS server                        [string] [required]
  --app-id      The push application ID of the app to be renamed
                                                             [string] [required]
  --name        The new name                                 [string] [required]
  --output, -o  The output to be generated
                          [string] [choices: "table", "json"] [default: "table"]

[8X--- CUT]

Example

$ ups applications rename -U http://localhost:9999 --app-id 5a045786-2be9-410f-9f78-9951fe1441dc --name TEST-RENAMED
Application renamed successfully

Importing applications

$ ups applications import --help
ups applications import

Import a list of applications from a json file together with their variants.
Such file can be the json output of the list command

Import applications:
  --in          Path to the json file containing the applications to be
                imported.                                    [string] [required]
  --output, -o  The output to be generated
                          [string] [choices: "table", "json"] [default: "table"]
[8X--- CUT]

Example

$ ups applications import -U http://localhost:9999 --in /tmp/apps.json
12 application(s) imported
$ ups applications list -U http://localhost:9999
╔════════════════╀══════════════════════════════════════╀══════════╀═══════════════╀═══════════════╗
β•‘ NAME           β”‚ PUSH-APPLICATION-ID                  β”‚ VARIANTS β”‚ INSTALLATIONS β”‚ SENT-MESSAGES β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ IMPORTED-APP1  β”‚ 8e96fa60-8833-4c1c-973a-b138a09b936b β”‚ 0        β”‚ 0             β”‚ 0             β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ IMPORTED-APP10 β”‚ 98632235-3f88-4ed4-91ac-e829153e58f4 β”‚ 0        β”‚ 0             β”‚ 0             β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ IMPORTED-APP11 β”‚ d0238581-8d43-4512-acda-c8caa35f6854 β”‚ 4        β”‚ 0             β”‚ 0             β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ IMPORTED-APP12 β”‚ 6b9d31cc-b375-4d62-b61f-5f51a9ea72bb β”‚ 0        β”‚ 0             β”‚ 0             β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ IMPORTED-APP2  β”‚ f1d0dabe-acb9-4e4c-89c2-7505df23d0c0 β”‚ 0        β”‚ 0             β”‚ 0             β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ IMPORTED-APP3  β”‚ 502e1881-4abe-489e-973a-b7503b636ee8 β”‚ 0        β”‚ 0             β”‚ 0             β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ IMPORTED-APP4  β”‚ 2eedc08c-51df-4fae-a6be-966f7cd23f29 β”‚ 0        β”‚ 0             β”‚ 0             β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ IMPORTED-APP5  β”‚ f2b80384-a452-4abc-950f-8a12ca3ac300 β”‚ 0        β”‚ 0             β”‚ 0             β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ IMPORTED-APP6  β”‚ 6f8f8957-5953-4a32-972f-40e8bd51e32f β”‚ 0        β”‚ 0             β”‚ 0             β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ IMPORTED-APP7  β”‚ 714867dc-6391-4d3c-8512-4187032539a1 β”‚ 0        β”‚ 0             β”‚ 0             β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ IMPORTED-APP8  β”‚ 4fdc0fd9-e4cb-40d9-b012-588e06525281 β”‚ 0        β”‚ 0             β”‚ 0             β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ IMPORTED-APP9  β”‚ 17013f9f-fc7f-4395-ba2f-ae0486d3aec2 β”‚ 0        β”‚ 0             β”‚ 0             β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ TEST-RENAMED   β”‚ 5a045786-2be9-410f-9f78-9951fe1441dc β”‚ 0        β”‚ 0             β”‚ 0             β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Variants

Creating variants

The create command, provides 3 different subcommands to be used to create android, ios, ios_token and web_push variants.

$ ups variants create --help
create a new variant

Commands:
  ups variants create android    Create a new android variant
  ups variants create ios-cert   Create a new iOS variant (certificate)
  ups variants create ios-token  Create a new ios token variant. For details
                                 see:
                                 https://aerogear.github.io/aerogear-unifiedpush
                                 -server/docs/variants/ios#apns-token-authentica
                                 tion
  ups variants create web-push   Create a new WebPush variant
[8X--- CUT]

Creating Android variants

$ ups variants create android --help
Create a new android variant

Create Variant:
  -U, --url         URL of the UPS server                    [string] [required]
  --app-id          Id of the application owning the variant [string] [required]
  --name            The name of the variant to be created    [string] [required]
  --server-key      The google server-key. See https://aerogear.github.io/aeroge
                    ar-unifiedpush-server/docs/variants/android for details
                                                             [string] [required]
  --sender-id       The google sender-id. See https://aerogear.github.io/aerogea
                    r-unifiedpush-server/docs/variants/android for details
                                                             [string] [required]
  --secret          The variant secret. This is useful if you are migrating a
                    variant from one server to another. If not specified, it
                    will be autogenerated                               [string]
  --description     The variant description                             [string]
  --output, -o, -o  The output to be generated
         [string] [choices: "table", "json", "table", "json"] [default: "table"]
[8X--- CUT]

Example

$ ups variants create android -U http://localhost:9999 \
    --app-id 5a045786-2be9-410f-9f78-9951fe1441dc \
    --name ANDROID-VARIANT \
    --server-key 'GOOGLE-KEY' \
    --sender-id 'G-SENDER-ID'

Variant created

╔═════════════════╀══════════════════════════════════════╀═════════╗
β•‘ NAME            β”‚ VARIANT-ID                           β”‚ TYPE    β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ ANDROID-VARIANT β”‚ 5f18d710-c032-4512-9e69-18c761f6bee6 β”‚ android β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•

Again, the output parameter can be specified to have a json output:

$ ups variants create android -U http://localhost:9999 \
    --app-id 5a045786-2be9-410f-9f78-9951fe1441dc \
    --name ANDROID-VARIANT-JSON \
    --server-key 'GOOGLE-KEY' \
    --sender-id 'G-SENDER-ID' \
    -o json
[{"id":"d19694e8-4f7a-4d3f-8dfa-c04d3f29fc59","name":"ANDROID-VARIANT-JSON","description":null,"variantID":"2ea0aa61-5ee4-4571-bc98-cd2354e8cdfb","secret":"d08a51c1-1cff-4eaf-9d83-840f1a2a6d78","developer":"admin","googleKey":"GOOGLE-KEY","projectNumber":"G-SENDER-ID","type":"android"}]

Creating ios-cert variants

$ ups variants create ios-cert --help
Create a new iOS variant (certificate)

Create Variant:
  -U, --url         URL of the UPS server                    [string] [required]
  --app-id          Id of the application owning the variant [string] [required]
  --name            The name of the variant to be created    [string] [required]
  --certificate     The path to the ".p12" file containing the Apple certificate
                                                             [string] [required]
  --passphrase      The passphrase to be used to access the certificate
                                                             [string] [required]
  --production      Must be specified to create a production variant   [boolean]
  --secret          The variant secret. This is useful if you are migrating a
                    variant from one server to another. If not specified, it
                    will be autogenerated                               [string]
  --description     The variant description                             [string]
  --output, -o, -o  The output to be generated
         [string] [choices: "table", "json", "table", "json"] [default: "table"]
[8X--- CUT]

Example

$ ups variants create ios-cert \
    -U http://localhost:9999 \
    --app-id 5a045786-2be9-410f-9f78-9951fe1441dc \
    --name IOS-CERT-VARIANT \
    --certificate /tmp/devel.pem \
    --passphrase certpwd
Variant created

╔══════════════════╀══════════════════════════════════════╀══════╗
β•‘ NAME             β”‚ VARIANT-ID                           β”‚ TYPE β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β•’
β•‘ IOS-CERT-VARIANT β”‚ 2cd11dbe-c8fb-483f-bcee-4122a240ab8a β”‚ ios  β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•

Creating ios-token variants

$ ups variants create ios-token --help
Create a new ios token variant. For details see:
https://aerogear.github.io/aerogear-unifiedpush-server/docs/variants/ios#apns-to
ken-authentication

Create Variant:
  -U, --url         URL of the UPS server                    [string] [required]
  --app-id          Id of the application owning the variant [string] [required]
  --name            The name of the variant to be created    [string] [required]
  --bundle-id       The variant bundle-id (for example
                    org.aerogear.PushHelloWorld)             [string] [required]
  --team-id         The variant team-id                      [string] [required]
  --key-id          The variant key-id                       [string] [required]
  --private-key     The variant private key as downloaded from the apple website
                                                             [string] [required]
  --secret          The variant secret. This is useful if you are migrating a
                    variant from one server to another. If not specified, it
                    will be autogenerated                               [string]
  --description     The variant description                             [string]
  --output, -o, -o  The output to be generated
         [string] [choices: "table", "json", "table", "json"] [default: "table"]
[8X--- CUT]

Example

$ ups variants create ios-token \
    -U http://localhost:9999 \
    --app-id 5a045786-2be9-410f-9f78-9951fe1441dc \
    --name IOS-TOKEN-VARIANT \
    --bundle-id 'org.aerogear.test' \
    --team-id '0123456789' \
    --key-id 0123456789 \
    --private-key /tmp/privateKey.pem
Variant created

╔═══════════════════╀══════════════════════════════════════╀═══════════╗
β•‘ NAME              β”‚ VARIANT-ID                           β”‚ TYPE      β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ IOS-TOKEN-VARIANT β”‚ 77bb4e93-33ab-49b0-b700-e4d43cc16e9a β”‚ ios_token β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•

Creating web-push variants

$ ups variants create web-push --help
Create a new WebPush variant

Create Variant:
  -U, --url         URL of the UPS server                    [string] [required]
  --app-id          Id of the application owning the variant [string] [required]
  --name            The name of the variant to be created    [string] [required]
  --alias           The application server contact information (this must be a
                    mailto or an https url)                  [string] [required]
  --output, -o, -o  The output to be generated
         [string] [choices: "table", "json", "table", "json"] [default: "table"]
[8X--- CUT]

Example

$ ups variants create web-push \
    -U http://localhost:9999 \
    --app-id 5a045786-2be9-410f-9f78-9951fe1441dc \
    --name WEBPUSH-VARIANT \
    --alias 'mailto:[email protected]'
Variant created

╔═════════════════╀══════════════════════════════════════╀══════════╗
β•‘ NAME            β”‚ VARIANT-ID                           β”‚ TYPE     β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ WEBPUSH-VARIANT β”‚ 9e5125aa-bdde-4dfb-ac48-0c68379eab74 β”‚ web_push β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•

Deleting variants

$ ups variants delete --help
Delete Variants:
  --app-id      The application id                           [string] [required]
  --variant-id  Deletes the variant identified by the specified id      [string]
  --name        Deletes all the variants matching the specified name    [string]
  --developer   Deletes all the variants matching the specified developer
                                                                        [string]
  --type        Deletes all the variants of the specified type          [string]
[8X--- CUT]

⚠️ If you don't specify any filter, the command will delete all the application variants!

Example

$ ups variants delete \
    -U http://localhost:9999 \
    --app-id 5a045786-2be9-410f-9f78-9951fe1441dc \ 
    --variant-id 9e5125aa-bdde-4dfb-ac48-0c68379eab74
1 variant(s) deleted

Listing variants

lists the variants for the application identified by <app-id>

List variants:
  -U, --url         URL of the UPS server                    [string] [required]
  --app-id          The application id                       [string] [required]
  --variant-id      The variant id                                      [string]
  --type            Returns all the variants of the specified type      [string]
  --name            Returns all the variants matching the specified name[string]
  --developer       Returns all the variants matching the specified developer
                                                                        [string]
  --output, -o, -o  The output to be generated
         [string] [choices: "table", "json", "table", "json"] [default: "table"]

[8X--- CUT]

Example

$ ups variants list -U http://localhost:9999 --app-id 5a045786-2be9-410f-9f78-9951fe1441dc
╔══════════════════════╀══════════════════════════════════════╀═══════════╗
β•‘ NAME                 β”‚ VARIANT-ID                           β”‚ TYPE      β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ ANDROID-VARIANT      β”‚ 5f18d710-c032-4512-9e69-18c761f6bee6 β”‚ android   β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ ANDROID-VARIANT-JSON β”‚ 2ea0aa61-5ee4-4571-bc98-cd2354e8cdfb β”‚ android   β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ IOS-CERT-VARIANT     β”‚ 2cd11dbe-c8fb-483f-bcee-4122a240ab8a β”‚ ios       β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ IOS-TOKEN-VARIANT    β”‚ 77bb4e93-33ab-49b0-b700-e4d43cc16e9a β”‚ ios_token β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•

Authentication

We currently support two kind of authentications:

  • Basic
  • Keycloak
$ ups --help
ups --url <url> [auth] <command>

Commands:
  ups applications  manage the applications
  ups variants      manage the variants

Basic Auth:
  -u, --username  username                                              [string]
  -p, --password  password                                              [string]
  --auth-type     The type of authentication
                      [string] [choices: "basic", "keycloak"] [default: "basic"]

Keycloak Auth:
  -u, --username  username                                              [string]
  -p, --password  password                                              [string]
  -k, --kc-url    URL of the keycloak server                            [string]
  --realm         The authentication realm used for keycloak authentication
                                                  [string] [default: "aerogear"]
  --client-id     Client id to be used to authenticate with keycloak
                                    [string] [default: "unified-push-server-js"]
  --auth-type     The type of authentication
                      [string] [choices: "basic", "keycloak"] [default: "basic"]

[8X--- CUT]

Basic authentication

To perform basic authentication, just pass username, password and auth-type to any command. For example to list all the applications, instead of

ups -U http://localhost:9999 applications list

you will write

ups -u username -p password -U http://localhost:9999 applications list

Keycloak authentication

Similarly to what we have seen about basic authentication, to authenticate with keycloak we just have to add the credentials to the command and the url of the keycloak server.

For example to list all the applications, instead of

ups -U http://localhost:9999 applications list

you will have to write

ups -u username -p password --kc-url http://yourkeycloak --auth-type keycloak -U http://localhost:9999 applications list

If you used a different realm and/or client-id, you will have to specify that also (--realm and --client-id options).