go54-domain-reseller-api
v1.0.2
Published
A JavaScript SDK for GO54 Domain Reseller API
Maintainers
Readme
GO54 Domain Reseller API SDK
A JavaScript SDK for interacting with the GO54 Domain Reseller API.
Provides easy methods to register, transfer, renew domains, and manage domain details programmatically.
Features
- Generate API tokens automatically
- Register, transfer, and renew domains
- Get domain EPP codes and contact details
- Update domain contacts, nameservers, and registrar locks
- Fetch domain nameservers and synchronize domain details
- Built-in configuration validation and standardized error handling
Installation
npm install go54-domain-reseller-apiRequirements
- Node.js v18+
- GO54 Domain Reseller API credentials
Configuration
Create a .env file in your project root:
BASE_URL=https://whogohost.com/host/modules/addons/DomainsReseller/api/index.php
[email protected]
API_SECRET=your-reseller-api-keyUsage
Below is an example of how to register a domain using the SDK.
Register a Domain
import { registerDomain } from "go54-domain-reseller-api";
const config = {
endpoint: process.env.BASE_URL,
username: process.env.EMAIL,
apiSecret: process.env.API_SECRET,
};
const whoisData = {
domain: "example.com",
regperiod: 1,
nameservers: {
ns1: "nsa.whogohost.com",
ns2: "nsb.whogohost.com",
},
contacts: {
registrant: {
firstname: "example",
lastname: "testing",
fullname: "example testing",
companyname: "textmachine",
email: "[email protected]",
address1: "4 office",
city: "Lag",
state: "Lagos",
zipcode: "110001",
country: "NG",
phonenumber: "+234.812345678",
},
admin: {
firstname: "example",
lastname: "testing",
fullname: "example testing",
companyname: "textmachine",
email: "[email protected]",
address1: "4 office",
city: "Lag",
state: "Lagos",
zipcode: "110001",
country: "NG",
phonenumber: "+234.812345678",
},
billing: {
firstname: "example",
lastname: "testing",
fullname: "example testing",
companyname: "textmachine",
email: "[email protected]",
address1: "4 office",
city: "Lag",
state: "Lagos",
zipcode: "110001",
country: "NG",
phonenumber: "+234.812345678",
},
tech: {
firstname: "example",
lastname: "testing",
fullname: "example testing",
companyname: "textmachine",
email: "[email protected]",
address1: "4 office",
city: "Lag",
state: "Lagos",
zipcode: "110001",
country: "NG",
phonenumber: "+234.87546898",
},
},
};
(async () => {
try {
const response = await registerDomain(config, whoisData);
console.log(response);
} catch (error) {
console.error(error);
}
})();API/Actions Reference
registerDomain(config, data)– Register a new domain.transferDomain(config, data)– Initiate a domain transfer.renewDomain(config, data)– Renew a domain.getEppCode(config, data, domain)– Retrieve EPP code for a domain.getContactDetails(config, data, domain)– Get domain contact information.getDomainNameservers(config, data, domain)– Get nameservers for a domain.getRegistrarLock(config, data, domain)– Check registrar lock status.updateDomainContactDetails(config, data, domain)– Update domain contacts.updateDomainNameservers(config, data, domain)– Update domain nameservers.updateDomainRegistrarLock(config, data, domain)– Toggle registrar lock.syncDomainDetails(config, data, domain)– Sync domain details with the provider.transferSyncDomain(config, data, domain)– Synchronize domain transfer.
Error Handling
All errors follow a standard format:
Success Response
{
"success": true,
"action": "registerDomain",
"status": 200,
"data": {
...
}
}Error Response
{
"success": false,
"action": "registerDomain",
"status": 500,
"message": "Reseller does not have enough credits on his account",
"provider": {
"error": "Reseller does not have enough credits on his account"
}
}Response Fields
| Field | Type | Description | |----------|--------|-------------| | success | boolean | Indicates if the request succeeded | | action | string | SDK action that was executed | | status | number | HTTP status code from the API | | message | string | Human-readable error message | | provider | object | Raw response from the GO54 API |
License
This project is licensed under the MIT License.
See the LICENSE file for details.
Contributing
Contributions are welcome!
- Fork the repository
- Create a feature branch
- Write tests if applicable
- Submit a pull request
