gellu/godaddy-api-client

Api client for GoDaddy Domains

1.1.1 2017-10-26 12:19 UTC

This package is not auto-updated.

Last update: 2024-11-15 22:50:14 UTC


README

API client for GoDaddy Domains

Requirements

PHP 5.4.0 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "require" : {
    "gellu/godaddy-api-client" : "1.*"
  }
}

Then run composer install

Example - Domain purchase

<?php

const API_KEY 		= ''; // key obtained from https://developer.godaddy.com
const API_SECRET 	= ''; // secret obtained from https://developer.godaddy.com

$domain 			= 'test-domain.com';
$domainPeriod 		= 1;
$domainAutoRenew	= false;
$domainTLD 			= 'pl';
$contact 			= [
	'name'			=> 'John',
	'surname'		=> 'Doe',
	'email'			=> 'john.doe@test-domain.com',
	'phone'			=> '+48.111111111',
	'organization'	=> 'Corporation Inc.',
	'street'		=> 'Street Ave. 666',
	'city'			=> 'New City',
	'country'		=> 'PL',
	'postal-code'	=> '11-111',
	'state'			=> 'state of art'
];

$configuration = new \GoDaddyDomainsClient\Configuration();
$configuration->addDefaultHeader("Authorization", "sso-key ". API_KEY .":". API_SECRET);
$configuration->setDebug(true);

$apiClient = new \GoDaddyDomainsClient\ApiClient($configuration);
$apiInstance = new \GoDaddyDomainsClient\Api\VdomainsApi($apiClient);

$agreement = $apiInstance->getAgreement($domainTLD, false);
$agreementKeys = [$agreement[0]->getAgreementKey()];

$domainPurchase = new \GoDaddyDomainsClient\Model\DomainPurchase();
$domainPurchase->setDomain($domain);

$domainPurchaseConsent = new \GoDaddyDomainsClient\Model\Consent();
$domainPurchaseConsent->setAgreementKeys($agreementKeys);
$domainPurchaseConsent->setAgreedBy($contact['name'] . ' ' . $contact['surname']);
$domainPurchaseConsent->setAgreedAt(date("Y-m-d\TH:i:s\Z"));
$domainPurchase->setConsent($domainPurchaseConsent);

$domainContactAdmin = new \GoDaddyDomainsClient\Model\Contact();
$domainContactAdmin->setNameFirst($contact['name']);
$domainContactAdmin->setNameLast($contact['surname']);
$domainContactAdmin->setEmail($contact['email']);
$domainContactAdmin->setPhone($contact['phone']);
$domainContactAdmin->setOrganization($contact['organization']);

$domainContactAdminAddressMailing = new \GoDaddyDomainsClient\Model\Address();
$domainContactAdminAddressMailing->setAddress1($contact['street']);
$domainContactAdminAddressMailing->setCity($contact['city']);
$domainContactAdminAddressMailing->setCountry($contact['country']);
$domainContactAdminAddressMailing->setPostalCode($contact['postal-code']);
$domainContactAdminAddressMailing->setState($contact['state']);

$domainContactAdmin->setAddressMailing($domainContactAdminAddressMailing);

$domainPurchase->setContactAdmin($domainContactAdmin);
$domainPurchase->setContactBilling($domainContactAdmin);
$domainPurchase->setContactRegistrant($domainContactAdmin);
$domainPurchase->setContactTech($domainContactAdmin);
$domainPurchase->setPeriod($domainPeriod);
$domainPurchase->setRenewAuto($domainAutoRenew);

$purchase = $apiInstance->purchase($domainPurchase);

Documentation For Models

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: 2.4.8
  • Build date: 2016-09-01T15:18:33.475Z
  • Build package: class io.swagger.codegen.languages.PhpClientCodegen