This repository has been archived by the owner on Jun 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Getting Started
hitmanpt edited this page Feb 8, 2017
·
6 revisions
NuGet Packet Manager Console on VisualStudio Install-Package WHMCS_API
All dependencies will be installed
- Just download the WHMCS API.dll
Check the releases on the project page to get the latest version - Add it as a reference to your project
- Install the Json.NET from Newtonsoft
Option 1
Using the NuGet Packet Manager Console on VisualStudioInstall-Package Newtonsoft.Json -Version 9.0.1
Option 2
Downloading from our releases page
If you do not have an WHMCS ACCESSKEY this is what you need to do
- Go to your whmcs root folder
- Find and open the file configuration.php
- Add the line
$api_access_key = "abc123";
The AccessKey must be a strong string so I recommend using an Password Generator
The basic usage is pretty straight foward here is an example of an asp.net app
using System.Web.Mvc;
using WHMCS_API;
namespace MVCDemo.Controllers
{
public class HomeController : Controller
{
private readonly string username = "WHMCS_API_USERNAME";
private readonly string password = "WHMCS_API_PASSWORD";
private readonly string accessKey = "WHMCS_API_ACCESSKEY";
private readonly string whmcsUrl = "WHMCS_USERFRONTEND_URL"; //Example: http://example.com/whmcs
public ActionResult Index()
{
API whmcs = new API(username, password, accessKey, whmcsUrl);
int ClientID = whmcs.ValidateLogin("SomeUserEmail", "PlainTextPassword").ClientID;
ViewBag.ClientDetails = whmcs.GetClientsDetails(ClientID);
ViewBag.Transactions = whmcs.GetTransactions(ClientID: ClientID);
return View();
}
}
You depending on the function you might have optional and/or required parameters
When the parameters are optional you can skip to the by using ParamName: ParamValue
PCDev Open Source Development Team 2017