====== EPP-DRS API ====== #intro_start# This document is a detailed guide to [[http://epp-drs.com|EPP-DRS]] REST API\\ #intro_end#\\ #toc# ===== Introduction ===== ===== Anatomy of API call ===== All input parameters to the API are transmitted as HTTP Query Parameters. Both GET and POST Requests are accepted. ==== API URL ==== http://%your-epp-drs-installation%/api.php ==== Transaction ID ==== In every response from EPP-DRS, you will find a string element called transactionId. This is simply a unique identifier EPP-DRS assigns to this request for tracking and troubleshooting purposes. ==== Common parameters ==== ^ Name ^ Description ^ | keyId | An API key, generated by EPP-DRS. Can be found in Control panel -> Settings -> API settings | | signature | Signature that signs each and every API request. Instructions on how to [[#generate signature|generate this signature]] can be found below. | | version | API version. 20111014 is the latest | | action | Action to trigger. See the [[#actions|list of actions]] | ==== Generate signature ==== To create the signature - Create the canonicalized query string that you need later in this procedure: - Sort the UTF-8 query string components by parameter name with natural byte ordering. The parameters can come from the GET URI or from the POST body (when Content-Type is application/x-www-form-urlencoded). - URL encode the parameter name and values - Concatinate name and values to a single string (eg. var1value1var2value2) - Calculate an RFC 2104-compliant HMAC with the string you just created, your API Access Key (You can get it on 'Control Panel -> Settings -> API settings' page) as the key, and SHA1 as the hash algorithm. For more information, go to http://www.ietf.org/rfc/rfc2104.txt. - Make the resulting value base64 encoded. - Use the Resulting value as the value of the Signature request parameter. ==== Sample request ==== https://epp-drs.com/api.php?action=listContacts &version=20090622 &keyId=kRFRw0vnj88%3D &query=C000 &limit=-1 &signature=v8x1nc%2FtND%2FHf3UgV9nd8Wi0lk4%3D ==== Sample response ==== C000000042262-KZ Marat Komarov marat@webta.net C000-443042426 Kazimir Malevich kazi@painter.com 35 456b7dc4-aa34-4f28-8e13-361eb1205a7a ==== Sample error response ==== 'locked' parameter is required d5c1bb92-4c55-4d1e-a92c-63ab3783f31d ===== Actions ===== ==== getTldInfo ==== Get TLD meta information: - registration period, - domain extra fields - transfer options - renewal options - etc... ** Changelog ** Added contacts section (v2010-05-24) ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | tld | string | 2009-06-22 | Domain extension | ** Sample request ** https://epp-drs.com/api.php?action=getTldInfo &version=20090622 &keyId=kRFRw0vnj88%3D &tld=asia &signature=QeT0rFZcHeZ9zHBdO6SweQykXfw%3D ** Sample response ** 1 10 Local presence for .ASIA domain registrations select x-asia-ced-accept-trustee-tac 1 Indicates which contact should be used as CED select x-asia-ced-contact 1 Location or domicile of the entity text x-asia-ced-cclocality 1 1 255 Province of establishment of the CED text x-asia-ced-localitysp 1 1 255 City of establishment of the CED text x-asia-ced-localitycity 1 1 255 Type of entity select x-asia-ced-legalentitytype 1 Form of identification select x-asia-ced-identform 1 Identification number / code of reference text x-asia-ced-identnumber 1 1 255 Description of the type of entity text x-asia-ced-otherletype 1 1 255 Description of the form of identification text x-asia-ced-otheridentform 1 1 255 1 1 10 contact Admin or Technical Full name text name 1 3 255 Organization text org 0 3 255 Country select .... cc 1 2 2 City textcity 1 2 255 Zip code text pc 1 2 16 Address 1 text street1 1 3 255 Address 2 text street2 0 3 255 Phone phone voice 0 Fax phone fax 0 Email text email 1 2 255 holder Registrant ... registrant holder 1 admin contact 1 tech contact 1 e3f30510-7c22-4497-9b2d-89aa9def4e7f ==== createContact ==== Creates domain contact. Server will reply with contact CLID, that can be used in creatDomain action. ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | tld | string | 2010-05-24 | Domain extension | | type | string | 2010-05-24 | Contact type. See [[#getTldInfo]] | | group | string | 2010-05-24 | Contact group. See [[#getTldInfo]] | | userId | int | 2010-05-24 | User ID to which assign registered domain. (Available for admin) | ** Sample request ** https://epp-drs.com/api.php?action=createContact &version=20100524 &keyId=xinmOym9vLE%3D &tld=lu &type=tech &name=Marat+Komarov &org=Webta &street1=str &pc=99022 &city=Sebastopol &cc=UA &email=marat%40localhost &voice=%2B38.111111111 &signature=NCIEUqvlV89CykVH9gbaBIezKm0%3D ** Sample response ** C77327613 b523f60a-895a-4152-996d-1ad1d6300331 ==== checkDomain ==== Checks whether domain names exist. The server will reply with registered / not registered ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | name | string | 2009-06-22 | Domain name | ** Sample request ** https://epp-drs.com/api.php?action=checkDomain &version=20090622 &keyId=kRFRw0vnj88%3D &name=f00t00morrow.gr &signature=fvatTFVwRNF1cyH%2Fj%2Flaig8QytY%3D ** Sample response ** f00t00morrow.gr 1 1e367fa6-fac7-46de-a117-e6abc51ac2b6 ==== createDomain ==== Register domain name ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | name | string | 2009-06-22 | Domain name | | period | int | 2009-06-22 | Registration period | | registrant | string | 2009-06-22 | Registrant contact CLID. See [[#listContacts]] | | admin | string | 2009-06-22 | Admin contact CLID. See [[#listContacts]] | | billing | string | 2009-06-22 | Billing contact CLID. See [[#listContacts]] | | tech | string | 2009-06-22 | Technical contact CLID. See [[#listContacts]] | | ns | array[string] | 2009-06-22 | Array of nameservers | | extraFields | array[key => value] | 2009-06-22 | Assoc array of domain registration extra parameters. See [[#getTldInfo]] | | userId | int | 2009-06-22 | User ID to which assign registered domain. (Available for admin) | | noBilling | bool | 2009-06-22 | Disable billing for domain opeartion (Available for admin) | ** Sample request ** https://epp-drs.com/api.php?action=createDomain &version=20090622 &keyId=kRFRw0vnj88%3D &name=miumau.no &period=1 ®istrant=GL1O &admin=MK10P &tech=MK10P &ns%5B0%5D=ns.google.com &ns%5B1%5D=ns2.google.com &userId=14 &signature=3Z63EsrPlWKaclU3mECsUfHt%2BN0%3D ** Sample response ** miumau.no ok 719a9232-5815-448c-8dc8-9ad6c2d4c0cd ==== renewDomain ==== Renew domain name ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | name | string | 2010-04-08 | Domain name | | period | int | 2010-04-08 | Renewal period | | userId | int | 2010-04-08 | User ID to which assign registered domain. (Available for admin) | | noBilling | bool | 2010-04-08 | Disable billing for domain opeartion (Available for admin) | ** Sample request ** https://epp-drs.com/api.php?action=renewDomain &version=20100408 &keyId=kRFRw0vnj88%3D &name=miumau.no &period=1 &userId=14 &signature=3Z63EsrPlWKaclU3mECsUfHt%2BN0%3D ** Sample response ** 719a9232-5815-448c-8dc8-9ad6c2d4c0cd ==== transferDomain ==== Request ingoing transfer ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | name | string | 2009-06-22 | Domain name | | authCode | string | 2009-06-22 | EPP auth code | | registrant | string | 2009-06-22 | Registrant contact CLID. See [[#listContacts]] | | admin | string | 2009-06-22 | Admin contact CLID. See [[#listContacts]] | | billing | string | 2009-06-22 | Billing contact CLID. See [[#listContacts]] | | tech | string | 2009-06-22 | Technical contact CLID. See [[#listContacts]] | | extraFields | array[key => value] | 2009-06-22 | Assoc array of domain registration extra parameters. See [[#getTldInfo]] | | userId | int | 2009-06-22 | User ID to which assign registered domain. (Available for admin) | | noBilling | bool | 2009-06-22 | Disable billing for domain opeartion (Available for admin) | ** Sample request ** https://epp-drs.com/api.php?action=transferDomain &version=20090622 &keyId=kRFRw0vnj88%3D &name=api-for-transfer-3.gr &authCode=200839921 &userId=15 &noBilling=1 &signature=VG4MwYFNkK%2BEWAqN2eMekML9DbM%3D ** Sample response ** 4c2b4f68-0b17-4f13-82d2-88160ada60eb ==== updateDomainContact ==== Updates one of the domain contacts (registrant, admin, billing, tech). For some registries change registrant contact may cause trade. User will be billed for it. ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | name | string | 2009-06-22 | Domain name | | contactType | string | 2009-06-22 | Contact type. 'registrant', 'admin', 'billing', 'tech' are available. | | clid | string | 2009-06-22 |Contact CLID | | noBilling | bool | 2009-06-22 | Disable billing for domain operation (Available for admin) | ** Sample request ** https://epp-drs.com/api.php?action=updateDomainContact &version=20090622 &keyId=PybmwXwMZnI%3D &name=epp-drs.be &contactType=registrant &clid=c49027 &signature=Uu20bIn8I8WeDUZXbsq75K2t%2Bwo%3D ** Sample response ** db3fe3fd-a83a-4809-ace6-cdf1f20a20e4 ==== updateDomainLock ==== Set domain transfer lock. ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | name | string | 2009-06-22 | Domain name | | locked | bool | 2009-06-22 | Locked flag | ** Sample request ** https://epp-drs.com/api.php?action=updateDomainLock &version=20090622 &keyId=kRFRw0vnj88%3D &name=epp-drs.no &locked=1 &signature=1RsjDlRfP5gdR%2BPetV0ydR8p%2Buc%3D ** Sample response ** d5c1bb92-4c55-4d1e-a92c-63ab3783f31d ==== updateDomainNameservers ==== Set domains nameservers. ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | name | string | 2009-06-22 | Domain name | | ns | array[string] | 2009-06-22 | Array of nameservers | ** Sample request ** https://epp-drs.com/api.php?action=updateDomainNameservers &version=20090622 &keyId=kRFRw0vnj88%3D &name=epp-drs.no &ns%5B0%5D=ns.nsmatrix.com &ns%5B1%5D=ns2.nsmatrix.com &signature=HdpAw2zaChG8IlM574jIJLrgBC4%3D ** Sample response ** 55794de3-2f8b-417c-8729-57734498a2bd ==== updateDomainFlags ==== Modify domain flags ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | name | string | 2011-02-17 | Domain name | | add | array[string] | 2011-02-17 | Flags to add | | remove | array[string] | 2011-02-17 | Flags to add | ** Sample request ** https://epp-drs.com/api.php?action=updateDomainFlags &version=20110217 &keyId=kRFRw0vnj88%3D &name=epp-drs.no &add%5B0%5D=clientRenewProhibited &remove%5B1%5D=clientTradeProhibited &signature=HdpAw2zaChG8IlM574jIJLrgBC4%3D ** Sample response ** 55794de3-2f8b-417c-8729-57734498a2bd ==== getDomainInfo ==== Get domain information from registry/local database ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | name | string | 2009-06-22 | Domain name | | mode | string | 2009-06-22 | Request mode. 'registry' - request registry server, 'local' - EPP-DRS database | ** Sample request ** https://epp-drs.com/api.php?action=getDomainInfo &version=20090622 &keyId=kRFRw0vnj88%3D &name=kolizey.it &mode=registry &signature=c0TKS6lSiWmwOzLtvXBmabTfID8%3D ** Sample response ** kolizey.it C55215128 C81338287 ns.epp-drs.com ns2.epp-drs.com 2008-09-01 16:09 2010-08-31 23:59 0 ok clientTransferProhibited clientHold s2EReWu%m 0 1 01ec0f2c-b6df-4c08-862c-7cafb6887aee ==== listDomains ==== List domains from database by several criteries ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | query | string | 2009-06-22 | Search over domain name | | createDate | date | 2009-06-22 | Exact create date | | createDateRange | array[date, date] | 2009-06-22 | Create date between | | expireDate | date | 2009-06-22 | Exact expire date | | expireDateRange | array[date, date] | 2009-06-22 | Expire date between | | contact | string | 2009-06-22 | Any contact clid assigned to domain | | userId | int | 2009-06-22 | User ID (Only in Admin mode) | | **Data slide** | | | | | start | int | 2009-06-22 | Data slice start. Default 0 | | limit | int | 2009-06-22 | Date slice size. Default 25. -1 Unlimited | ** Sample request ** https://epp-drs.com/api.php?action=listDomains &version=20090622 &keyId=kRFRw0vnj88%3D &query=.it &expireDateRange%5B0%5D=2009-07-07 &expireDateRange%5B1%5D=2010-12-31 &signature=FGonVT%2Bcf6pRAQ36QDriB7nDXzc%3D ** Sample response ** 1 kolizey.it C55215128 C81338287 ns.epp-drs.com ns2.epp-drs.com 2008-09-01 16:09 2010-08-31 23:59 0 Delegated 211163df-dae9-4833-b157-80840544008f ==== importDomains ==== Import domains into EPP-DRS database. Similar to AdminCP -> Tools -> Import existing domains ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | names | array[string] | 2009-06-22 | Domain names. If TLD is not provided default is used. | | defaultTld | string | 2009-06-22 | Default TLD | | userId | int | 2009-06-22 | User ID to whom apply these domains (Available for admin) | ** Sample request ** https://epp-drs.com/api.php?action=importDomains &version=20090622 &keyId=kRFRw0vnj88%3D &names%5B0%5D=b.info &names%5B1%5D=non-existed-domain.gr &names%5B2%5D=aaa.unknown &names%5B3%5D=groovy &defaultTld=gr &userId=1 &signature=JCDErHaBzdeVHAvCrF965JGcGsY%3D ** Sample response ** b.info 0 Cannot connect to registry server non-existed-domain.gr 0 Registry error: The object you are trying to use does not exist aaa.unknown 0 No modules configured to handle extension 'unknown' groovy.gr 1 30079767-ea29-46db-a4bf-971cb0e52c63 ==== listContacts ==== List contacts from database by several criteries ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | query | string | 2009-06-22 | Search over contact fields and clid | | userId | int | 2009-06-22 | User ID (Available for admin) | | **Data slice** | | | | | start | int | 2009-06-22 | Data slice start. Default 0 | | limit | int | 2009-06-22 | Date slice size. Default 25. -1 Unlimited | ** Sample request ** https://epp-drs.com/api.php?action=listContacts &version=20090622 &keyId=kRFRw0vnj88%3D &query=C000 &limit=-1 &signature=v8x1nc%2FtND%2FHf3UgV9nd8Wi0lk4%3D ** Sample response ** C000000042262-KZ Marat Komarov marat@webta.net C000-443042426 Kazimir Malevich kazi@painter.com 35 456b7dc4-aa34-4f28-8e13-361eb1205a7a ==== getContactInfo ==== Get contact information from registry/local database ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | clid | string | 2011-10-14 | Contact CLID | | mode | string | 2011-10-14 | Request mode. 'registry' - request registry server, 'local' - EPP-DRS database | ** Sample request ** https://epp-drs.com/api.php?action=getContactInfo &version=20111014 &keyId=kRFRw0vnj88%3D &clid=MT-22352477 &mode=registry &signature=c0TKS6lSiWmwOzLtvXBmabTfID8%3D ** Sample response ** MT-22352477 Egor Pistolet me@egor.pistolet.me Egor Pistolet Kristal smiles ul. Marshala Zhukova 11 KZ 55434 Almaty Almaty me@egor.pistolet.me +7634453434 01ec0f2c-b6df-4c08-862c-7cafb6887aee ==== updateContact ==== Update contact information in registry database ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | clid | string | 2011-10-14 | Contact CLID | | fields | array | 2011-10-14 | Assoc array of fields (name => value) | ** Sample request ** https://epp-drs.com/api.php?action=updateContact &version=20111014 &keyId=kRFRw0vnj88%3D &clid=MT-22352477 &fields%5Bname%5D=Egor%20Pistolet &fields%5Bemail%5D=me@egor.pistolet.me &fields%5Bstreet1%5D=ul.%20Krasnoarmeitsev%2065 &fields%5Borg%5D=Kristal%20smiles &fields%5Bcc%5D=KZ &fields%5Bpc%5D=55434 &fields%5Bsp%5D=Almaaty &fields%5Bcity%5D=Almaaty &signature=c0TKS6lSiWmwOzLtvXBmabTfID8%3D ** Sample response ** 01ec0f2c-b6df-4c08-862c-7cafb6887aee ==== getBalanceInfo ==== Get balance rest. This action allowed only for admin ** Changelog ** ** Request parameters ** ^ Name ^ Type ^ Version ^ Description ^ | userId | int | 2009-06-22 | User ID | ** Sample request ** https://epp-drs.com/api.php?action=getBalanceInfo &keyId=kRFRw0vnj88%3D &userId=1 &signature=QeT0rFZcHeZ9zHBdO6SweQykXfw%3D ** Sample response ** 968.84 EUR d436e97f-99a7-44c5-aa9a-d208ce4afbc6 ===== Sample API client ===== // Define constants define("API_KEY_ID", "xxxxxxxxxxxxxxxx"); define("API_SECRET_KEY", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); define("API_URL", "https://my-reseller-panel.com/api.php"); define("API_VERSION", "20100524"); // Build query arguments list $params = array( 'version' => API_VERSION, 'keyId' => API_KEY_ID, 'action' => 'getTldInfo', 'tld' => 'se' ); // Sorg arguments ksort($params); // Generate string for sign $string2sign = ""; foreach ($params as $k => $v) { $string2sign .= "{$k}{$v}"; } // Generate signature $params['signature'] = base64_encode(hash_hmac('sha1', $string2sign, API_SECRET_KEY, 1)); // Build query $query = http_build_query($params); // Execute query $c = file_get_contents(API_URL."?{$query}"); // Output result print "
";
print htmlspecialchars($c);
print "
";