Pradeep Sanjeewa Posted June 29, 2021 Share Posted June 29, 2021 Hi, I need to call WHMCS API "GetClients" from my cpanel server. To test my API request, I'm trying to come up with a curl request to try in postman. Can someone provide me with a sample curl request to WHMCS API which I can import and try in postman? Thanks. 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted June 30, 2021 Share Posted June 30, 2021 $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( 'action' => 'GetClients', // See https://developers.whmcs.com/api/authentication 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 'password' => 'SECRET_OR_HASHED_PASSWORD', 'search' => 'example.com', 'responsetype' => 'json', ) ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch); https://developers.whmcs.com/api-reference/getclients/#example-request-curl 1 Quote Link to comment Share on other sites More sharing options...
Pradeep Sanjeewa Posted July 2, 2021 Author Share Posted July 2, 2021 Isn't there any sample requests of the format "curl --request POST https://yourwebsite.com/" which I can directly hit in terminal? 0 Quote Link to comment Share on other sites More sharing options...
ramf Posted December 26, 2021 Share Posted December 26, 2021 Pradeep Sanjeewa - Did you managed to connect to WHMCS API with postman? 0 Quote Link to comment Share on other sites More sharing options...
Ilan Harel Posted October 19, 2022 Share Posted October 19, 2022 For me this worked curl --location --request POST 'https://WHMCS-SITE-ADDRESS/includes/api.php?username=Q0n..........&password=RS9ar..........&action=GetClients' 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.