Updates the name or configuration settings of an existing OneSignal app

This method can be used to update the name or configuration settings of one of your existing apps.

📘

Same as POST /apps

The supported parameters are the same as the parameters for creating an application.

📘

Updating Some Platforms Requires All Attributes To Be Set

Updating some platforms like Safari web push requires all parameters to be set (even if they are unchanged) in order for the update to be processed.

  • To update only your app name, you can pass in only a new app name parameter.
  • To update Android, be sure to pass in gcm_key.
  • To update Chrome Apps & Extensions, be sure to pass in chrome_key.
  • To update Chrome web push, be sure to pass in chrome_web_origin.
  • To update Safari web push, you must pass in all of these parameters: safari_apns_p12, safari_apns_p12_password, site_name, and safari_site_origin. Most users use our auto-generated Safari web ID. If you use our auto-generated Safari web ID, please set safari_apns_p12 to "" and safari_apns_p12_password to "".
  • To update iOS, you must pass in apns_env and apns_p12.

🚧

Requires User Authentication Key

Requires your OneSignal User Auth Key, available in Account & API Keys.

Example Code - Update an app

curl --include \
     --request PUT \
     --header "Content-Type: application/json" \
     --header "Authorization: Basic YOUR_USER_AUTH_KEY" \
     --data-binary "{\"name\" : \"Your app 1\",
\"apns_env\": \"production\",
\"apns_p12\": \"asdsadcvawe223cwef...\",
\"apns_p12_password\": \"FooBar\",
\"organization_id\": \"your_organization_id\",
\"gcm_key\": \"a gcm push key\"}" \
     https://onesignal.com/api/v1/apps/YOUR_APP_ID
<?PHP
    function createApp(){
        
        $fields = array(
            'name' => "NEW_APP_NAME"
        );
        
        $fields = json_encode($fields);
        print("\nJSON sent:\n");
        print($fields);
        
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/apps/YOUR_APP_ID");
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8',
                                                   'Authorization: Basic YOUR_USER_AUTH_KEY'));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch, CURLOPT_HEADER, FALSE);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
        curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

        $response = curl_exec($ch);
        curl_close($ch);
        
        return $response;
    }
    
    $response = createApp();
    $return["allresponses"] = $response;
    $return = json_encode( $return);
    
    print("\n\nJSON received:\n");
    print($return);
    print("\n");
?>

Result Format - Update an app

{
  id: "e4e87830-b954-11e3-811d-f3b376925f15",
  name: "Your app 1",
  players: 0,
  messageable_players: 0,
  updated_at: "2014-04-01T04:20:02.003Z",
  created_at: "2014-04-01T04:20:02.003Z",
  gcm_key: "a gcm push key",
  chrome_key: "A Chrome Web Push GCM key",
  chrome_web_origin: "Chrome Web Push Site URL",
  chrome_web_default_notification_icon: "http://yoursite.com/chrome_notification_icon",
  chrome_web_sub_domain:"your_site_name",
  apns_env: "production",
  apns_certificates: "Your apns certificate",
  safari_apns_certificate: "Your Safari APNS certificate",
  safari_site_origin: "The homename for your website for Safari Push, including http or https",
  safari_push_id: "The certificate bundle ID for Safari Web Push",
  safari_icon_16_16: "http://onesignal.com/safari_packages/e4e87830-b954-11e3-811d-f3b376925f15/16x16.png",
  safari_icon_32_32: "http://onesignal.com/safari_packages/e4e87830-b954-11e3-811d-f3b376925f15/[email protected]",
  safari_icon_64_64: "http://onesignal.com/safari_packages/e4e87830-b954-11e3-811d-f3b376925f15/[email protected]",
  safari_icon_128_128: "http://onesignal.com/safari_packages/e4e87830-b954-11e3-811d-f3b376925f15/128x128.png",
  safari_icon_256_256: "http://onesignal.com/safari_packages/e4e87830-b954-11e3-811d-f3b376925f15/[email protected]",
  site_name: "The URL to your website for Web Push",  
  basic_auth_key: "NGEwMGZmMjItY2NkNy0xMWUzLTk5ZDUtMDAwYzI5NDBlNjJj"
}
Language
Authentication
Basic
base64
: