Feature Requests
Share ideas, discuss and vote on requests from other users in community
 

Custom API Support

Matthew Eli shared this idea 1 year ago
Under Consideration

Using information such as the link below provides, one can create custom APIs for WHMCS without much trouble, but there is no documentation from WHMCS for doing so. Additionally, any custom APIs are not exposed via the new API Roles area so they are more troublesome to implement. The ability to support this feature is already present in WHMCS; it's just a matter of providing documentation and at least one more function being exposed to add strings to the API roles list. Luckily, other people have documented it well enough to get started:

https://whmcs.community/topic/263421-adding-custom-external-api-functions/

Feature request in short:

  • Support custom API directives by providing appropriate documentation
  • Provide patch notes for any changes made which might affect custom API implementations and standards
  • Allow custom API directives to be listed in the API Roles area in 7.4+

Currently it is possible to manipulate the API role in the database to add local support for custom APIs, but this is not desirable and may be patched in the future to remove support for non-standard API directives. Also, it would probably be preferred to hook this into plugins in some way so plugins can register functions with the API instead of the unsupported method using files in the api directory.

Comments (10)

photo
1

Hi Matthew,

Thanks for your suggestions. Just to clarify, that custom APIs commands are currently not supported or encouraged, which is why there is no developer documentation.

photo
1

I am 100% behind this.

Unfortunately there are certain circumstances that WHMCS simply doesn't provide support for(some very basic things infact).

However up until now there has been support from developers who have written custom API code to fill the missing functionality, and the suggestion of using a module is insufficient if the documentation is not completely comprehensive(which it is not).

Not sure why this feature was limited in 7.4 without a suitable alternative being provided.

Something as simple as providing a PDF copy of an invoice that was only available via a custom api script has now been broken.

I believe a resolution to this issue should be pushed through asap.

A better way to go about this would have been to phase in the API roles, with support for custom API's and then provided developer documentation on how to convert an API into a hook/module/etc.

photo
1

I support this 100%.

I've been working on an App that communicates with WHMCS via API. It turned out that some of the required fields/functionality is not currently present and I built a custom API (7.4, 7.5). Now it turned out that valid permissions are required. But, I'm not able to add that permission as it is not listed in API Roles and it is not documented anywhere. It is a shame.

photo
1

Hi,

We view the API functions we distribute and document as a commitment to maintain an element of backwards and forwards compatibility across versions, and are committed to maintaining and developing the API to help meet users needs.

I'd be interested to learn about the kind of custom API commands you have found it necessary to implement, so encourage you to submit feature requests for those.

photo
1

Hi John,

Just as a follow up comment to this, I actually found a bug in one of the developed API's that WHMCS let out into the wild with the GetTLDPricing about 12months ago; so as much as there's a commitment to good code, occassionally things slip through. Which prompts me to say, if WHMCS are able to distribute something with the risk that something won't work, let the developers on here use their own code and if something breaks it's on them to repair it.

One request that I've seen time and time again is the PDF Invoices via API, it's been an 'under consideration feature for 5+years'. I understand they are created on the fly however there's no reason that this can't be extended into an API;

Another ridiculous oversight is the inability to do a forgotten password request via the API, it should have been the second thing written after the validate login API call? Defies logic to think that a user has to access the WHMCS interface to request a password reset when I've tried to keep them on my main page?

Just my two cents.

photo
1

WHMCS John,

There are 2 flaws in your logic.

  1. Feature request for API commands do not receive many votes because a considerably smaller portion of your userbase actually uses the API. So, if features are selected by votes alone, your API gets neglected, which is what has happened.
  2. The current API implementation is so limited I cannot even put addon prices on my company website without having to manually put them in because there is a GetProducts but no GetAddons.

photo
photo
1

Hi

Thanks for your comment.

I found that there is no endpoint to get all admins, or get tickets assigned to an admin.

photo
1

I'd support this. I'm working with the API now, and it wants to throw a service id not found error, when in fact I'm passing the Service ID. I'm doing it for an upgrade product for license, and it needs to get the id dynamically, which it pulls from the license perfectly, it's just giving me a not found error when the id is in the system correctly.

photo
1

Hi Michael,

Thanks for the bump.

Unfortunately WHMCS support is under the belief that the only ones who should be breaking the system is their own developers and anyone else who tries to use the API will break things so they'd prefer not to let them touch it.

In terms of the basic requests they are normally built to a standard level, what function are you trying to pass a service ID too? Have you tried simply var_dump($variablename) to check that the ID is actually being passed to the new function correctly?

If I can help you with it myself I will, as you may be waiting a while before WHMCS assists.

Thanks.

photo
1

Actually Gianpaolo, I could use some help! I'm trying to write a custom license verification script where the user can verify what software the site is using, and I'd love to do some other things, especially like building the page like on http://www.whmcs.com/members/autoupgrade.php :) So many things I'd like to build. Please feel free to DM me! I can give you my email as well.

In regards to my original question, I was able to fix it by taking the quotations out of the script so where it was like srvid= "19" I went srvid= $hisid; (which was a variable I made) and it completely worked!

photo