Basic API DomainElements

Synopsis
public array DomainElements( array $domainelements )
Description

Used to manage elements of parked domain names.

SOAP
This function can be called using SOAP.
XML
This function can be called using GET / POST requests.
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[] $domainelements yes

Array of domain elements arrays. (max. 50 per request)

Domain element array elements:

Type Parameter Mandatory Description
string $domain yes Domain name in ACE format or [system:applyToAll].
string $action yes

Action to perform.

This can be either:

  • enable - Enables the element.
  • disable - Disables the element.
string $element yes

Element to manage.

This can be either:

  • ELEMENT_BUYBOX - Buy box (if the domain is listed for sale).
  • ELEMENT_SEARCHBOX - Search box.
Returns
Type Description
array

The return value contains the following elements:

Type Key Description
string domain Domain name in ACE format.
string action The given action.
string element The given element to manage.
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',
        'domainelements' => [
            [
                'domain'  => 'example.com',
                'action'  => 'enable',
                'element' => 'ELEMENT_BUYBOX',
            ],
            [
                'domain'  => 'example.com',
                'action'  => 'disable',
                'element' => 'ELEMENT_SEARCHBOX',
            ],
        ],
    ];

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

    // Display the result
    echo "<table>";
    echo "<tr>";
    echo "<td>Domain</td>";
    echo "<td>Action</td>";
    echo "<td>Element</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]['action']."</td>";
        echo "<td>".$result[$i]['element']."</td>";
        echo "<td>".$result[$i]['status']."</td>";
        echo "<td>".$result[$i]['message']."</td>";
        echo "</tr>";
    }
    echo "</table>";
} catch (SoapFault $e) {
    echo 'Error: '.$e->getMessage();
}
<?php
/* URL to Sedo's API */
$baseUrl = 'https://api.sedo.com/api/v1/DomainElements?';

/* API function parameters */
$params = [
    'partnerid'      => 1234,
    'signkey'        => 'abcdefghijklmnopqrstuvwxyz0123456789',
    'username'       => 'johndoe',
    'password'       => 'secret',
    'output_method'  => 'xml',
    'domainelements' => [
        [
            'domain'  => 'example.com',
            'action'  => 'enable',
            'element' => 'ELEMENT_BUYBOX',
        ],
        [
            'domain'  => 'example.com',
            'action'  => 'disable',
            'element' => 'ELEMENT_SEARCHBOX',
        ],
    ],
];

/* build request URL */
$request = $baseUrl . http_build_query($params);

/* fire API request */
$fp = @fopen($request, 'r');

/* read response line by line */
while (!@feof($fp)) {
    echo fread($fp, 4096);
}

/* close the connection */
fclose($fp);

For a successful request, you will receive an XML document as response in this format:

<?xml version="1.0" encoding="UTF-8"?>
<SEDOLIST xmlns="api.sedo.com/api/v1/?wsdl">
    <item type="tns:DomainElementsResponse[]">
        <domain type="xsd:string">example.com</domain>
        <action type="xsd:string">enable</action>
        <element type="xsd:string">ELEMENT_BUYBOX</element>
        <status type="xsd:string">ok</status>
        <message type="xsd:string"></message>
    </item>
    <item type="tns:DomainElementsResponse[]">
        <domain type="xsd:string">example.com</domain>
        <action type="xsd:string">disable</action>
        <element type="xsd:string">ELEMENT_SEARCHBOX</element>
        <status type="xsd:string">ok</status>
        <message type="xsd:string"></message>
    </item>
</SEDOLIST>

For an unsuccessful request, you will receive an XML document as response in this format:

<?xml version="1.0" encoding="UTF-8"?>
<SEDOFAULT ver="1.0">
    <faultcode type="xsd:string">Exxx</faultcode>
    <faultstring type="xsd:string">xxxxxx</faultstring>
</SEDOFAULT>