Skip to content

Reducing the pressure over the NameSRS API #14

Description

@tmcdos

WHMCS creates a lot of unnecesery api queries to the registrar module. how to handle it?
This is a common issue with WHMCS, especially when using registrar modules that don't aggressively cache data. WHMCS tends to prioritize showing live information, which can result in many unnecessary API calls.
Simply opening a domain in the admin area can trigger multiple API requests:

  • Get Domain Info
  • Get Nameservers
  • Get DNS
  • Get Contacts
  • Get Registrar Lock
  • Get Expiry
  • Get EPP Status

If your registrar module implements all these functions by making separate API calls, WHMCS may invoke each one independently.
The client area also performs many lookups.
Every page load may call:

  • GetNameservers
  • GetDNS
  • GetRegistrarLock
  • GetContactDetails

If these all make separate remote requests, API usage grows quickly.

Many registrar APIs return everything in one response.
Example:

GET /domains/example.com

returns

{
    expiry
    status
    nameservers
    contacts
    dnssec
    locked
}

Instead of:
GetNameservers() -> API

GetRegistrarLock() -> API

GetContactDetails() -> API

GetExpiryDate() -> API

Call the API once:
GetDomain()

cache

all module functions read from cache

This alone can reduce API traffic by 70–90%.

Best practice

The most effective architecture is:

WHMCS
   │
   ├─ GetNameservers()
   ├─ GetRegistrarLock()
   ├─ GetContactDetails()
   ├─ GetDNS()
   └─ GetDomainInformation()
          │
          ▼
   shared cache (5–10 min)
          │
          ▼
   one registrar API request

This approach is commonly used in well-optimized registrar modules because it minimizes API usage while keeping the displayed information reasonably current.

GetDomainInformation:

  • Available from: WHMCS 7.6.0
  • Purpose: Consolidates several registrar queries (nameservers, registrar lock, expiry, ID protection, contact verification status, etc.) into a single registrar module function for better performance.
  • Recommendation: Starting with 7.6, WHMCS recommends implementing GetDomainInformation() instead of only implementing the older GetNameservers() and GetRegistrarLock() functions when your registrar API can return all of the information in a single request.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions