Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
whmcs-api
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pedro Cavaleiro
whmcs-api
Commits
bbaa3d27
Commit
bbaa3d27
authored
Feb 06, 2017
by
Pedro Cavaleiro
Committed by
GitHub
Feb 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update README.md
parent
23e9598b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
2 deletions
+95
-2
README.md
README.md
+95
-2
No files found.
README.md
View file @
bbaa3d27
# whmcs-api
# WHMCS API C# Wrapper
An WHMCS API C# Wrapper
This is an library to comunicate with the WHMCS API
<br/>
Currently these functions are already implemented
<ul>
<li>
Add Client
</li>
<li>
Domain WhoIs
</li>
<li>
Get Client Details
</li>
<li>
Validate Login
</li>
</ul>
The implemented functions are designed to be very easy to use
The following code demonstrates to to implement the GetClientDetails on an ASP.net MVC app
```
using WHMCS-API;
namespace YOUR_APP
{
public class YOUR_CLASS
{
[HttpPost]
public ActionResult ClientDetails(int clientID)
{
string username = "WHMCS_USERNAME";
string password = "WHMCS_PASSWORD";
string accessKey = "WHNMCS_ACCESS_KEY";
string whmcsUrl = "WHMCS_USERFRONTEND_URL"; //ex: https://example.com/client
API api = new API(username, password, accessKey, whmcsUrl);
ViewBag.UserDetails = api.GetClientsDetails(clientID, Stats: true); //The model passed is of type GetClientsDetails
return View();
}
}
}
```
You can still use this library to call non implemented functions by using the following code
```
using WHMCS-API.Call;
using System.Collections.Specialized;
using Newtonsoft.Json; //Not necessary but recommended as the call returns a JSON String
namespace YOUR_APP
{
public class YOUR_CLASS
{
//The function can be private or public and does not need to return anything or can even return an string or any other type
public YourModel yourFunction()
{
Call _call = new Call(WHMCS_API_USERNAME, WHMCS_API_PASSWORD, WHMCS_API_ACCESSKEY, WHMCS_USER_FRONTEND_URL);
NameValueCollection data = new NameValueCollection()
{
{ "action", "ModuleChangePackage " },
{ "accountid", "1" }
};
return JsonConvert.DeserializeObject<YourModel>(_call.MakeCall(data));
}
}
}
```
You can also create custom functions of already implemented functions.
<br
/>
In this example i'm gonna show how to use the login function
```
using WHMCS-API;
using WHMCS-API.Call;
using System.Collections.Specialized;
using Newtonsoft.Json; //Not necessary but recommended as the call returns a JSON String
namespace YOUR_APP
{
public class YOUR_CLASS
{
//The function can be private or public and does not need to return anything or can even return an string or any other type
public void _Login()
{
Call _call = new Call(WHMCS_API_USERNAME, WHMCS_API_PASSWORD, WHMCS_API_ACCESSKEY, WHMCS_USER_FRONTEND_URL);
NameValueCollection data = new NameValueCollection()
{
{ "action", EnumUtil.GetString(APIEnums.Actions.ValidateLogin) },
{ EnumUtil.GetString(APIEnums.ValidateLoginParams.Email), Email },
{ EnumUtil.GetString(APIEnums.ValidateLoginParams.Password), Password }
};
ValidateLogin response = JsonConvert.DeserializeObject<ValidateLogin>(_call.MakeCall(data));
Session["uid"] = response.UserID;
Session["upw"] = response.PasswordHash;
}
}
}
```
[

](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A3JFH2WA6U9YU)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment