Jump to content

Some API functions don't work with NVP


Kian

Recommended Posts

Hi

 

I'm developing an API platform to give access to WHMCS API to Reseller so that for example i can let one of my client to register domains from his Wordpress using the credit balance he has on WHMCS. Of course he will be able to use only certain commands (not as "root-user") and that only have effects on his own services, domains and contacts.

 

Ok now back on topic it seems that some API functions like getclients don't work in NVP mode. NVP returns empty errors even if everything works fine in XML and JSON. I can show you the evidence:

 

Full details

Link: https://dev.revhosting.org/api/generator/

 

Set "whmcs" as Connector, tick the checkbox "Login credentials (use default)", "XML" as Response Type, leave Debug "Yes" then select "ClientManagement" as Category and "GetClients" as Command. Now click Submit. As you can see it works. Now try to change Response Type to "JSON" and Submit again. It works (even if the response is a bit buggy now :-P). Finally select "NVP" and you get The following error occured: :?:

 

Quick check

Link: https://dev.revhosting.org/api/alfa.php

 

I made this page to let you verify quickly XML, JSON and NVP responses. NVP doesn't want to work because of The following error occured: What error!? :cry:

Link to comment
Share on other sites

From what I can see my own test, the NVP data returning from server is not valid. Hence, the PHP is just executing codes from the 'else' statement:

 

if ($results["result"]=="success") 
{
  echo "Success!!";
} 
else 
{
  echo "The following error occured: ".$results["message"]; // Here $results["message"] is empty
}

Edited by Aniruddh
Link to comment
Share on other sites

  • WHMCS CEO

Some API functions - those which have multi-level returns, are only available in the XML and JSON response formats. Take the GetClients API command for example - as noted in the docs @ http://docs.whmcs.com/API:Get_Clients - that API function only supports the JSON and XML response formats so NVP is not supported for it and will be the cause of the error you're seeing. The docs should always state if this is the case for a given function.

 

matt

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.

×
×
  • 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