Jump to content
  • 0

Get If A Client Has Purchased A Service, Via Api


Question

Posted

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

  • 0
Posted

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";
}
  • 0
Posted

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

  • 0
Posted

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 .

Join the conversation

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

Guest
Answer this question...

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

Loading...
×
×
  • Create New...