UnifiedPush Server provides endpoint to create an Application, Android and iOS variant. While creating a variant you can provide the variand Id and the secret which is really helpful for testing since you already know the credentials you need to use to register the device.
For example to create an Android variant in the application B868CC08-BCC8-4A0A-B21E-1AC56AF0C734 you can do:
{code} curl --silent --output /dev/null \ -X POST $UPS_URL:$UPS_PORT/rest/applications/B868CC08-BCC8-4A0A-B21E-1AC56AF0C734/android \ -H "Accept: application/json" \ -H 'Content-Type: application/json' \ -d @- << EOF { "name": "Android Variant Name", "variantID": "E85A9650-1FC1-4240-A6D6-D8E1052598D8", "secret": "F37A1C22-046A-4DC4-AFBD-B4A745F466D1", "type": "android", "googleKey": "your-google-key-provided-by-firebase", "projectNumber": "your-project-id-provided-by-firebase" } EOF {code}
So you already know the credentials to use in your app
{code} { "version": 1, "namespace": "playground", "clientId": "aerogear-playground", "services": [{ "id": "push", "name": "push", "url": "$UPS_URL:$UPS_PORT", "type": "push", "config": { "android": { "variantId": "E85A9650-1FC1-4240-A6D6-D8E1052598D8", "variantSecret": "F37A1C22-046A-4DC4-AFBD-B4A745F466D1", "senderId": "your-project-id-provided-by-firebase" } } }] } {code}
It works on Android because the [AndroidVariant receives|https://github.com/aerogear/aerogear-unifiedpush-server/blob/master/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/registry/applications/AndroidVariantEndpoint.java#L61] an [AndroidVariant|https://github.com/aerogear/aerogear-unifiedpush-server/blob/master/model/api/src/main/java/org/jboss/aerogear/unifiedpush/api/AndroidVariant.java] which has the variant and the secret. The [AndroidVariant uses it|https://github.com/aerogear/aerogear-unifiedpush-server/blob/master/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/registry/applications/AndroidVariantEndpoint.java#L86] to create the variant.
The problem is: the [iOSVariantEndpoint|https://github.com/aerogear/aerogear-unifiedpush-server/blob/master/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/registry/applications/iOSVariantEndpoint.java#L70] receives an [iOSApplicationUploadForm|https://github.com/aerogear/aerogear-unifiedpush-server/blob/master/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/util/iOSApplicationUploadForm.java] (which does not contains a variant/secret), instead of an [iOSVariant|https://github.com/aerogear/aerogear-unifiedpush-server/blob/master/model/api/src/main/java/org/jboss/aerogear/unifiedpush/api/iOSVariant.java] which does not allow creating a new iOS variant via REST with a specific variant/secret credentials.
|
|