Associate a Package with a Config

Associating one or more packages with a configuration allows those OTAs to be delivered to the devices associated with that config. Note that the packages must all use the same target build fingerprint.

The simplest way to associate packages with a config is to issue the following API requests.

  1. Get a list of all packages in the deployment.
          GET /v1/deployments/$deploymentName/packages HTTP/1.1
          Host: androidovertheair.googleapis.com
          ...
          {
            "packages": [
              {
                "name": "bb3f51c1271.zip",
                "title": "test zip"
              },
              {
                "name": "6152c380bd6.zip",
                "title": "package_2.zip"
              }
            ]
          }
        
  2. Get a package list for the config you want to update. This list contains the all the packages currently associated with the configuration. Note that you must know the config key in order to make this call. If you don't know the config key, you must first list the configs to get it.
          GET /v1/deployments/$deploymentName/configs/$configName/packages HTTP/1.1
          Host: androidovertheair.googleapis.com
          ...
          {
          "configs": [
            {
              "packageName": "0908bf7b1b70b3245bb3f51c1271.zip",
              "downloadOptions": {
                "downloadType": "NORMAL"
              }
            }
          ]
         }
        
  3. Create a PackageConfig and add it to the list you obtained in step 2 and call updatePackages with that new list.
          PUT /v1/deployments/$deploymentName/configs/$configName/packages HTTP/1.1
          Host: androidovertheair.googleapis.com
          ...
          {
            "configs": [
              {
                "packageName": "0908bf7b1b70b3245bb3f51c1271.zip",
                "downloadOptions": {
                  "downloadType": "NORMAL"
                }
              },
              {
                "packageName": "bb3f51c1271.zip",
                "downloadOptions": {
                  "downloadType": "NORMAL"
                }
              }
            ]
          }
        

To remove a package from a config, you can follow the above steps but you remove the package from the updatePackages call rather than adding one.