Jump to content

State of API


Jogex

Recommended Posts

Hi, there.

I'm curious how much, or little rather, effort is being put into the WHMCS API.
I've been fiddling with it for a good while now, and it almost always ends with me pulling my hair out. It seems very incomplete and missing, in my opinion, very basic functionality.

Here are a few examples:

GetClients: Why can't a client be searched by its ID? That is literally the first and best identifier for looking up a specific user someone using an API would need.

GetCancelledPackages: Why is there no search way to search for a rel_id here? The hook for cancellation orders contains the rel ID, and for that to have any real purpose, an API lookup to obtain further information about the cancellation is required.
Of course, I can loop through all the records and look for the specific ID, but as we both know, that's a horrible way of doing it. Furthermore, the actual object contains very little useful data. Where's "expires_at"?? Literally the single most important piece of information...

I often find myself having to connect to the database and lookup data there. It's great that you offer an API, but it does feel like a rushed afterthought.

The hooks that you offer are great tho! And actually a very simple solution to this mess is to return more useful data from those hooks. What about giving us a small, but useful object?
I think a great example is the CancelOrder hook that returns a relId that's pretty much useless with a solid API to digest that data.

Hoping to see some improvements in the future for us developers doing integration-work!

Link to comment
Share on other sites

  • 2 months later...

Forget the API and just tap directly into your MySQL database to get data. Some API's are bugged and don't work properly just like hooks that won't trigger when they should. Using API's it means you now rely on WHMCS to fix or implement them. You can wait 5 years and maybe they will or will never bother to look at your feedback. And I'm sure you cannot wait that long 😁. If you really need to heavily work with API's create your own API that talks to the database or just use code that gets data with SQL queries instead.

The reason I state this is that API's are poor and not properly documented and hard to work. I found out I can just create standard PHP code and get something from the database faster than using an official WHMCS API which defeats the whole purpose of having an API in the first place.

They improved some documentation lately but its still lacking decent examples and missing some API's as you probably discovered already. I'm glad you like the hooks, last time I really required them, I found out the only one I tried to use was not triggering when it should and another one was triggering after user registration action instead of before. Both confirmed by WHMCS support as bugs, I waited a month, two, ..., and since they didn't fix them fast enough I moved to use something else

The problem with hooks is that they are great when they work until you then upgrade WHMCS to a new release and one stops working and now your whole system or custom implementation collapses because you relied on that hook. In my experience, the API and hooks are so unstable that if something works right now you should be afraid of upgrading in the future without properly testing first that everything still works. As opposed to something you created, which will always work and not rely on WHMCS software upgrades.

Edited by yggdrasil
Spelling
Link to comment
Share on other sites

  • WHMCS Support Manager

Hi @Jogex,

Thanks for taking the time to provide your feedback. The API is typically a slimmed down representation of the Admin UI functionality. We provide a fully featured client and admin UI so it is not our goal to duplicate every function in the API as well.

The API is certainly not fixed and we're always open to suggestions and do make change over time. Each feature release typically includes some API refinements or new commands, eg. most recently:

The GetClients API is searchable via strings rather than ID because that is typically the criteria staff would be using to locate client accounts. The client ID is not normally exposed to clients so would not be aware of it.

The ability to search by the service ID for the GetCancelledPackages makes a lot of sense, but it seems no-one has needed to do that before. We welcome feature requests online at http://requests.whmcs.com
Feel free to suggest this as a new idea for comment and voting upon by other WHMCS users.

The more votes an idea receives, the more likely it is to be considered by our development team for potential inclusion in a future feature update.

 

Link to comment
Share on other sites

11 hours ago, WHMCS John said:

Hi @Jogex,

Thanks for taking the time to provide your feedback. The API is typically a slimmed down representation of the Admin UI functionality. We provide a fully featured client and admin UI so it is not our goal to duplicate every function in the API as well.

The API is certainly not fixed and we're always open to suggestions and do make change over time. Each feature release typically includes some API refinements or new commands, eg. most recently:

The GetClients API is searchable via strings rather than ID because that is typically the criteria staff would be using to locate client accounts. The client ID is not normally exposed to clients so would not be aware of it.

The ability to search by the service ID for the GetCancelledPackages makes a lot of sense, but it seems no-one has needed to do that before. We welcome feature requests online at http://requests.whmcs.com
Feel free to suggest this as a new idea for comment and voting upon by other WHMCS users.

The more votes an idea receives, the more likely it is to be considered by our development team for potential inclusion in a future feature update.

I agree with Jogex when it comes to ID's. It seems some API can be called with an ID and others not. This should be more consistent. The ID is unique and never changes as opposed to searching something by name. This gets messy very complicated when you have products that are similar or customers with similar names. Numerical ID's on the other hand are consistent as they are unique and never repeated. Most people that are using the API probably already got the ID for the package, customer or service with some other method or just by looking at the links.

Link to comment
Share on other sites

It's very obvious that the WHMCS backend is more or less backwards. If you are going to be offering an API, the entire system should be based on that API. 
If not, you're just making a super redundant system that is harder to maintain. I feel like the API here is just an afterthought, sadly.
 

Link to comment
Share on other sites

6 hours ago, Jogex said:

It's very obvious that the WHMCS backend is more or less backwards. If you are going to be offering an API, the entire system should be based on that API. 
If not, you're just making a super redundant system that is harder to maintain. I feel like the API here is just an afterthought, sadly.
 

You are not entirely incorrect. WHMCS comes from an Internet era on which API's did not exist. It was added afterwards. I'm still glad it exists, it's better than nothing.

Edited by yggdrasil
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated