a.daniello Posted October 5, 2014 Report 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
0 Blesta Addons Posted October 6, 2014 Report 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
0 Blesta Addons Posted October 6, 2014 Report 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
0 a.daniello Posted October 6, 2014 Author Report 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
0 a.daniello Posted October 7, 2014 Author Report Posted October 7, 2014 naja7host, thank you! Now everything is clearer. Achille Quote
0 a.daniello Posted October 7, 2014 Author Report 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
0 Blesta Addons Posted October 7, 2014 Report 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
0 a.daniello Posted October 7, 2014 Author Report Posted October 7, 2014 Ok, perfect. Thanks, Achille Quote
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
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.