Menu

Develop your web server code

After generating an OAuth 2.0 token, you can now develop your web server code to communicate with Samsung’s E-FOTA Server to:

  • Register enterprises for the E-FOTA service.
  • Get Android firmware information for various Samsung device models.
  • Schedule firmware updates for specified groups of devices.

This section uses sample PHP code and XML to demonstrate how to manage firmware updates.

Register for the E-FOTA service

To register for the E-FOTA service, make a REST API call to the B2B E-FOTA server, sending an HTTP POST request to this URL:

https://eu-api.samsungknox.com/b2bfota/v2/serviceregister

In the body of the HTTP request, provide the following information:

  • mdmId
  • customerId
  • groupId
  • license

Here is an XML sample request to register for the E-FOTA service.

<B2bServiceRegisterVO>
    <mdmId>d1e2f3g4h5</mdmId>
    <customerId>EEEE4444-FF55-AA66-BB77-CCCCCC888888</customerId>
    <groupId>Test Device Group</groupId>
    <license>EFOTA1-fff555-ggg666-hh77</license>
</B2bServiceRegisterVO>			

For details about each of these XML elements, see the API reference for serviceregister.

Get E-FOTA license information

Now that you have registered for the E-FOTA service, you should check your development E-FOTA license to see how many devices you can test with and when your development license expires.

To check your license info, send an HTTP POST request to this URL:

https://eu-api.samsungknox.com/b2bfota/v2/licenseInfo

Here is an XML sample request to retrieve license information:

<B2bLicenseInfoVO>
   <mdmId>d1e2f3g4h5</mdmId>
    <customerId>EEEE4444-FF55-AA66-BB77-CCCCCC888888</customerId>
    <groupId>Test Device Group</groupId>
    <license>EFOTA1-fff555-ggg666-hh77</license>
</B2bLicenseInfoVO>

The following is an XML sample response to a request for license information:

<B2bLicenseInfoVO>
    <maxDeviceCount>700</maxDeviceCount>
    <expirationDate>2018-03-08</expirationDate>
</B2bLicenseInfoVO>

For details about each of these XML elements, see the API reference for licenseInfo.

List the available firmware

You can now review the available firmware for a particular device model name (for example, SM-G123A).

Send an HTTP POST request to this URL:

https://eu-api.samsungknox.com/b2bfota/v2/firmware

Here is an XML sample request to get the firmware available for the device SM-G930A:

<B2bFirmwareInfoListVO>
    <mdmId>d1e2f3g4h5</mdmId>
    <customerId>EEEE4444-FF55-AA66-BB77-CCCCCC888888</customerId>
    <groupId>Test Device Group</groupId>
    <license>EFOTA1-fff555-ggg666-hh77</license>
    <deviceModelName>SM-G123A</deviceModelName>
    <carrierCode>OXM</carrierCode>
    <currentFirmwareVersion>ZNNN01A1/ZNNN01B1/ZNNN01C1</currentFirmwareVersion>
    <languageCode>ENG</languageCode>
</B2bFirmwareInfoListVO>

Here is an example of how to use PHP to request the available firmware for a device:

public function getFirmwareList($mdmId,$customerId,$groupId,$deviceModel,$customerCode){
    $token = getToken();
    $curl = curl_init();
    curl_setopt_array($curl, array(
        CURLOPT_URL => "https://eu-api.samsungknox.com/b2bfota/v2/firmware",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_POSTFIELDS => "<B2bFirmwareInfoListVO><mdmId>$mdmId</mdmId><customerId>$customerId</customer Id><groupId>$groupId</groupId><license>$eFotaKey/license><deviceModelName>$deviceModel</deviceModelName><customerCode>$customerCode</customerCode><currentFirmwareVersion></currentFirmwareVersion><languageCode>ENG</languageCode></B2bFirmwareInfoListVO>",
        CURLOPT_HTTPHEADER => array(
            'authorization: Bearer '.$token,
            'cache-control: no-cache',
            'content-type: application/xml'),
    ));
    $result = curl_exec($curl);
    curl_close($curl);
    return $result;
}

If the API call is successful, the E-FOTA server returns "HTTP/1.1 200 OK" with a body such as the following (abbreviated to two firmware versions):

<?xml version="1.0" encoding="utf8" standalone="yes"?>
<B2bFirmwareInfoListVO>
    <firmwareVersionList>
        <firmwareVersionItem>
            <firmwareId>FW-20170130-77702</firmwareId>
            <currentFirmwareVersion>G930FXXU1BPLB/G930FOXA1BPLB/G930FXXU1BPJJ
            </currentFirmwareVersion>
            <targetFirmwareVersion>G930FXXU1DQB3/G930FOXA1DQB1/G930FXXU1DQB1
            </targetFirmwareVersion>
            <description>A software update can include, but is not limited to:
            - Device stability improvements, bug fixes.
            - New and / or enhanced features.
            - Further improvements to performance.
            To get the best from your device, please keep your device up to date and
            regularly check for software updates. The temperature of the device may
            temporarily increase during the software update or update because of the
            data download and associated behaviours.</description>
            <osOldVersion>Marshmallow(Android 6.0.1)</osOldVersion>
            <osVersion>Nougat(Android 7.0)</osVersion>
            <firmwareType>OS Upgrade</firmwareType>
            <openedDate>2017-02-07 01:41:53.0</openedDate>
        </firmwareVersionItem>
        <firmwareVersionItem>
            <firmwareId>FW-20170130-77566</firmwareId>
            <currentFirmwareVersion>G930FXXU1DPLT/G930FOXA1DPLT/G930FXXU1DPLT
            </currentFirmwareVersion>
            <targetFirmwareVersion>G930FXXU1DQB3/G930FOXA1DQB1/G930FXXU1DQB1
            </targetFirmwareVersion>
            <description>A software update can include, but is not limited to:
            - Device stability improvements, bug fixes.
            - New and / or enhanced features.
            - Further improvements to performance.
            To get the best from your device, please keep your device up to date
            and regularly check for software updates. The temperature of the device may
            temporarily increase during the software update or update because of the data
            download and associated behaviours.</description>
            <osOldVersion>Nougat(Android 7.0)</osOldVersion>
            <osVersion>Nougat(Android 7.0)</osVersion>
            <firmwareType>Bug Fix</firmwareType>
            <openedDate>2017-02-07 01:41:52.0</openedDate>
        </firmwareVersionItem>
    </firmwareVersionList>
</B2bFirmwareInfoListVO>

For details about each of these XML elements, see the API reference for firmware.

In the next sections, we will set the target firmware version to the first version shown above:

  • ap_version: (PDA version) G930FXXU1DQB3
  • csc_version: (Phone/Modem version) G930FOXA1DQB1
  • cp_version: (CP version) G930FXXU1DQB1

Force a firmware update

After registering for the E-FOTA service and seeing what firmware versions are available, you are ready to update device firmware. You can either:

  • Force a firmware update within a specific time period, as described here.
  • Let devices update their firmware during their regular firmware update checks, as described in Set the allowed firmware version.

To force a firmware update, send an HTTP POST request to this URL:

https://eu-api.samsungknox.com/b2bfota/v2/serverInit

Here is an XML sample request to force a firmware update between July 13 and July 15, from 1 to 4 am:

<B2bServerInitVO>
    <mdmId>d1e2f3g4h5</mdmId>
    <customerId>EEEE4444-FF55-AA66-BB77-CCCCCC888888</customerId>
    <groupId>Test Device Group</groupId>
    <license>EFOTA1-fff555-ggg666-hh77</license>
    <deviceModelName>GT-S8500A</deviceModelName>
    <carrierCode>OXM</carrierCode>
    <targetFirmwareVersion>G930FXXU1DQB3/G930FOXA1DQB1/G930FXXU1DQB1</targetFirmwareVersion>
    <deliveryStartDate>20170713</deliveryStartDate>
    <deliveryEndDate>20170715</deliveryEndDate>
    <dailyStartHour>01</dailyStartHour>
    <dailyEndHour>04</dailyEndHour>

For details about each of these XML elements, see the API reference for call serverInit.