Skip to main content

WHMCS 7.x Client Library

Project description

pyWHMCS v.7

This projects aims to provide an easy to use, consistent and simple client library and CLI program to interact with HTTP API of WHMCS software.

For now only interface is via command line.

Installation

Very simple process:

$ git clone git://github.com/riesal/pywhmcs7.git
$ cd pywhmcs7
$ python setup.py install

Usage

CLI program includes usage information. The standart help output is:

$ pywhmcs7 --help
usage: pywhmcs7 [-h] [--verbose] --url URL --username API_IDENTIFIER --password API_SECRET --accesskey ACCESSKEY --action ACTION [--params ...]

pyWHMCS Client Comman Line Interface

optional arguments:
-h, --help                  show this help message and exit
--verbose                   Activate verbose output
--url URL                   WHMCS API endpoint URL
--username API_IDENTIFIER   API Identifier
--password API_SECRET       API Secret
--accesskey ACCESSKEY       API AccessKey
--action ACTION             Action name to invoke
--params ...                Parameters passed with action. (--params param1=value1 param2=value2 etc.)

If you want to take the list of clients you have to make a POST request to the WHMCS API endpoint with POST body includes action=”getclients” and necessary credidentials. For example:

$ pywhmcs7 --url http://yourdomain.com/includes/api.php --username API_IDENTIFIER --password API_SECRET --accesskey ACCESSKEY --action getclients

The output will be like:

{
    "startnumber": 0,
    "clients": {
        "client": [
            {
                "status": "Active",
                "firstname": "John",
                "companyname": "Does Company",
                "lastname": "Doe",
                "datecreated": "2012-11-22",
                "groupid": "0",
                "id": "1",
                "email": "john@doe.com"
            }
        ]
    },
    "totalresults": "1",
    "result": "success",
    "numreturned": 1
}

For actions that requires extra arguments like clientid, userid etc. you must use optional –params parameter. After –params you must give your params in a format of paramN=valueN. These parameters and values will be appended to the POST body as key value pairs and send with the request. For example:

$ pywhmcs7 --url http://yourdomain.com/includes/api.php --username API_IDENTIFIER --password API_SECRET --accesskey ACCESSKEY --action addclientnote --params userid=1 notes="this is a note"
{
  "result": "success",
  "noteid": 4
}

With this approach you can call ALL of the acitons that provided by WHMCS system. You can find the developer API documentation here: https://docs.whmcs.com/API

Also you can install this library on python path and import the invoke function from whmcs module. It can be used for internal interaction to WHMCS system. Actually i am planning to build a nice client on top of it and than implement a reusable django application for easy communication between any django app and WHMCS system.

Troubleshoot

  • USERNAME is deprecated for WHMCS v.7.2 and above, please use API Identifier

  • PASSWORD is deprecated for WHMCS v.7.2 and above, please use API Secret

  • The user you give as –username parameter must have “API Permission”. You or the administrator of the WHMCS system must grant this permission to your user.

  • WHMCS system allows only specified set of IP addresses to make API requests for security reasons. So, your IP address must be added to permitted IP addresses list in WHMCS system.

  • –params parameter must be the last parameter specified. Because it is a “rest of” type argument.

News

1.0.1

Release date: 17.12.2018

  • fix typo

1.0.0

Release date: 17.12.2018

  • add access key

  • add identifier and secret instead of username and password

  • support python 2.7 and 3.6

0.0.3

Release date: 26.11.2016

  • pypi classifiers added to setup.py

  • CLI parameter added for request response type

  • simplejson dependency removed. returning raw text.

0.0.2

Release date: 17.01.2012

  • TODO section of README updated

0.0.1

Release date: 17.01.2013

  • CLI interface prepared.

  • CLI parameter format and model implemented.

  • invoke function implemented. now tool can make any kind of API call to WHMCS

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywhmcs7-1.0.1.tar.gz (4.7 kB view details)

Uploaded Source

File details

Details for the file pywhmcs7-1.0.1.tar.gz.

File metadata

  • Download URL: pywhmcs7-1.0.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for pywhmcs7-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a5395e4a3d3a14eded42e5e66ddff39b271879e2550691a5434a4caec72ba43f
MD5 7605903a35f6531d850c1034c6f9862d
BLAKE2b-256 267beacd40f7fbc4b28cb54e06f12a3c5212e68e4fd1b16e0d11a48d6910f9c7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page