a.daniello Posted October 5, 2014 Report Share Posted October 5, 2014 Hi, i'ld like use API if an user X has purchased the service Y, but i don't understand what "class" and "method" i should use. I already know, via API, user, client and contact id for X and know also id for service Y. Can anyone help me? Thanks, Achille Quote Link to comment Share on other sites More sharing options...
0 Blesta Addons Posted October 6, 2014 Report Share Posted October 6, 2014 to be more clear , let say the package you want to search for it has id "5" , you can get package id from the package page . call Services::getList() . $services = $api->Services->getList($client_id); $num_services = count($services) ; for ($i=0; $i<$num_services; $i++) { if ($services->getList->service[$i]->pricing_id == $package_id) echo "The Client ID ". $client_id ." has the service searched , with id ". $services->getList->service[$i]->id ."\n"; } Michael 1 Quote Link to comment Share on other sites More sharing options...
0 flangefrog Posted October 6, 2014 Report Share Posted October 6, 2014 Try Services::getList() Quote Link to comment Share on other sites More sharing options...
0 Blesta Addons Posted October 6, 2014 Report Share Posted October 6, 2014 Take in note that you need to check the package id related to the service and not the service id value . Quote Link to comment Share on other sites More sharing options...
0 a.daniello Posted October 6, 2014 Author Report Share Posted October 6, 2014 Mmmmhh... Nothing! I'm trying, but nothing. Now i go to sleep, maybe tomorrow "is another day"... Many thanks, flangefrog & naja7host Quote Link to comment Share on other sites More sharing options...
0 a.daniello Posted October 7, 2014 Author Report Share Posted October 7, 2014 naja7host, thank you! Now everything is clearer. Achille Quote Link to comment Share on other sites More sharing options...
0 a.daniello Posted October 7, 2014 Author Report Share Posted October 7, 2014 naja7host, it works!!! Many many thanks!! Only a little question/curiosity: you use this sintax to call api $services = $api->Services->getList($client_id); but i use (and only in this matter works) $api = new BlestaApi($url_api, $user, $key); ... $services = $api->post("services", "getList", array('client_id' => $client_id )); Why if i use your sintax it not works? Thanks, Achille Quote Link to comment Share on other sites More sharing options...
0 Blesta Addons Posted October 7, 2014 Report Share Posted October 7, 2014 my code is not 100% API, is just a typo to how the code work in normal plugin , then you need to convert it to API . as before i test anything in API , i test it internally to se if i get what i need, then i convert ot api call . so you code is correct for API call , and my code is correct for internal call . Quote Link to comment Share on other sites More sharing options...
0 a.daniello Posted October 7, 2014 Author Report Share Posted October 7, 2014 Ok, perfect. Thanks, Achille Quote Link to comment Share on other sites More sharing options...
Question
a.daniello
Hi,
i'ld like use API if an user X has purchased the service Y, but i don't understand what "class" and "method" i should use.
I already know, via API, user, client and contact id for X and know also id for service Y.
Can anyone help me?
Thanks,
Achille
Link to comment
Share on other sites
8 answers to this question
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.