Service Provider API SetTemplate

Synopsis
public array SetTemplate( array $templateentries )
Description

Sets a template for a domain.

Tip: Use function GetParkingTemplateList to see a list of all available templates.
SOAP
This function can be called using SOAP.
Parameters
Type Parameter Mandatory Description
integer $partnerid yes Partner ID.
string $signkey yes Sign key.
string $username yes User name. (max. 25 characters)
string $password yes Password. (max. 16 characters)
array[] $templateentry yes

Array of template configuration arrays. (max. 50 per request)

Template configuration array elements:

Type Parameter Mandatory Description
string $domain yes Domain name in ACE format
integer $template yes

Template ID.

This can be either:

  • A valid template ID as returned by GetParkingTemplateList.
  • -2 - Enables auto-rotation.
  • -1 - Disables auto-rotation.
Returns
Type Description
array

The return value contains the following elements:

Type Key Description
string domain Domain name in ACE format
string template Template ID which has just been set
string status ok if everything is in order. Otherwise a fault code.
string message Clear if everything is ok. Otherwise a fault string.
Version
1.0
<?php
try {
    // Create a new client by providing the endpoint to the constructor.
    $client = new SoapClient(
        null,
        [
            'location'     => 'https://api.sedo.com/api/v1/',
            'soap_version' => SOAP_1_1,
            'encoding'     => 'UTF-8',
            'uri'          => 'urn:SedoInterface',
            'style'        => SOAP_RPC,
            'use'          => SOAP_ENCODED,
        ]
    );

    // Set the values for the array
    $params = [
        'partnerid'     => 1234,
        'signkey'       => 'abcdefghijklmnopqrstuvwxyz0123456789',
        'username'      => 'johndoe',
        'password'      => 'secret',
        'templateentry' => [
            [
                'domain'   => 'example.com',
                'template' => 3000,
            ],
            [
                'domain'   => 'example.net',
                'template' => 3004,
            ],
        ],
    ];

    // Call the SOAP method
    $result = $client->SetTemplate($params);

    // Display the result
    echo "<table>";
    echo "<tr>";
    echo "<td>Domain</td>";
    echo "<td>Template</td>";
    echo "<td>Status</td>";
    echo "<td>Message</td>";
    echo "</tr>";
    for ($i = 0; $i < count($result); $i++) {
        echo "<tr>";
        echo "<td>" . $result[$i]['domain'] . "</td>";
        echo "<td>" . $result[$i]['template'] . "</td>";
        echo "<td>" . $result[$i]['status'] . "</td>";
        echo "<td>" . $result[$i]['message'] . "</td>";
        echo "</tr>";
    }
    echo "</table>";
} catch (SoapFault $e) {
    echo 'Error: '.$e->getMessage();
}