public array DomainInsert( array $domainentries )
Inserts domains into Sedo's database for sale and parking.
Every inserted domain – whether for sale or not – will automatically be enabled for parking.
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[] | $domainentry | yes |
Array of domain data arrays. (max. 50 per request) Domain data array elements:
|
Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
array |
This function gives a return value for the same array which has been sent with the domains. The return value contains the following elements:
|
<?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',
'domainentry' => [
[
'domain' => 'example.com',
'category' => [1, 2, 3],
'forsale' => 1,
'price' => 99.99,
'minprice' => 0,
'fixedprice' => 1,
'currency' => 1,
'domainlanguage' => 'en',
],
[
'domain' => 'example.net',
'category' => [1, 2, 3],
'forsale' => 1,
'price' => 99.99,
'minprice' => 0,
'fixedprice' => 1,
'currency' => 1,
'domainlanguage' => 'en',
],
],
];
// Call the SOAP method
$result = $client->DomainInsert($params);
// Display the result
echo '<table>';
echo '<tr><td>Domain</td><td>Status</td><td>Message</td></tr>';
for ($i = 0; $i < count($result); ++$i) {
echo '<tr><td>'.$result[$i]['domain'].'</td><td>'.$result[$i]['status'].'</td><td>'.$result[$i]['message'].'</td></tr>';
}
echo '</table>';
} catch (SoapFault $e) {
echo 'Error: '.$e->getMessage();
}
<?php
/* URL to Sedo's API */
$baseUrl = 'https://api.sedo.com/api/v1/DomainInsert?';
/* API function parameters */
$params = [
'partnerid' => 1234,
'signkey' => 'abcdefghijklmnopqrstuvwxyz0123456789',
'username' => 'johndoe',
'password' => 'secret',
'output_method' => 'xml',
'domainentry' => [
[
'domain' => 'example.com',
'category' => [1, 2, 3],
'forsale' => 1,
'price' => 99.99,
'minprice' => 0,
'fixedprice' => 1,
'currency' => 1,
'domainlanguage' => 'en',
],
[
'domain' => 'example.net',
'category' => [1, 2, 3],
'forsale' => 1,
'price' => 99.99,
'minprice' => 0,
'fixedprice' => 1,
'currency' => 1,
'domainlanguage' => 'en',
],
],
];
/* 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="https://api.sedo.com/api/v1/?wsdl">
<item type="tns:DomainInsertResponse[]">
<domain type="xsd:string">example.com</domain>
<status type="xsd:string">ok</status>
<message type="xsd:string"/>
</item>
<item type="tns:DomainInsertResponse[]">
<domain type="xsd:string">example.net</domain>
<status type="xsd:string">ok</status>
<message type="xsd:string"/>
</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>
// Create package sedoapi:
// java org.apache.axis.wsdl.WSDL2Java -av -p sedoapi https://api.sedo.com/api/v1/?wsdl
import sedoapi.*;
import org.apache.axis.AxisFault;
public class SedoDomainInsert
{
public static void main(String[] args) throws Exception
{
sedoapi.SedoInterfaceServiceLocator locator = new sedoapi.SedoInterfaceServiceLocator();
sedoapi.SedoInterfacePortType port = locator.getSedoInterfacePort();
try {
// Set the categories
int[] category = {1, 2, 3};
// Set the domain data
DomainEntry domaindata = new DomainEntry();
domaindata.setDomain("example.com");
domaindata.setCategory(category);
domaindata.setForsale(1);
domaindata.setPrice((float) 99.99);
domaindata.setMinprice((float) 0);
domaindata.setFixedprice(1);
domaindata.setCurrency(1);
domaindata.setDomainlanguage("en");
// Set the array of the domaindata
DomainEntry[] domaindataar = {domaindata};
// Set the request
DomainInsertRequest request = new DomainInsertRequest();
request.setPartnerid(1234);
request.setSignkey("abcdefghijklmnopqrstuvwxyz0123456789");
request.setUsername("johndoe");
request.setPassword("secret");
request.setDomainentry(domaindataar);
DomainInsertResponse[] response = port.domainInsert(request);
for (int i = 0; i < response.length; i++) {
System.out.println("Domain: " + response[i].getDomain());
System.out.println("Status: " + response[i].getStatus());
System.out.println("Message: " + response[i].getMessage());
System.out.println("---------------");
}
} catch (AxisFault fault) {
System.err.println("Faultcode : " + fault.getFaultCode());
System.err.println("Faultstring : " + fault.getFaultString());
}
}
}