- Notifications
You must be signed in to change notification settings - Fork0
KikyTokamuro/Amoapi
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Tiny lib foramoCRM API
This is DEV version of library so Author is not responsible of any damage, both direct and indirect,that may cause using of this library.
For installing add this to yourcomposer.json
:
"minimum-stability":"dev","repositories": [ {"type":"vcs","url":"git@github.com:KikyTokamuro/Amoapi" }],"require": {"kikytokamuro/amoapi":"dev-origin/dev"}
And run command:
composer require kikytokamuro/amoapi
When receiving tokens, they are written to "tokens.json".
Which can be set via:
$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url","tokens.json"// <---);
tokens.json:
{"access_token":"access_token","refresh_token":"refresh_token","expires_in":86400,"receipt_date":1626683782,"expires_date":1626770182}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$tokens =$client->getTokensByCode("code");// arrayprint_r($tokens);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$tokens =$client->getTokensByRefreshToken("refreshToken");// arrayprint_r($tokens);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$filter = ["page" =>0,"limit" =>5];try {$leads =$client->leads()->getAll($filter);// arrayprint_r($leads);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}try {$lead =$client->leads()->getById(28091207);// array}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}try {$lead =$client->leads()->getById(28091207);// array}catch (AmoapiException$e) {echo$e;}$lead["name"] ="new name";$lead["price"] =1111;try {print_r($client->leads()->update([$lead]));// array}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$lead = [["name" =>"new lead","price" =>1111]];try {print_r($client->leads()->createNew($lead));// array}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$note = ["note_type" =>"common","text" =>"test note"];try {print_r($client->leads()->addNoteById(28091207,$note));}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$filter = ["page" =>0,"limit" =>50 ];try {$tasks =$client->tasks()->getAll($filter);// arrayprint_r($tasks);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$task = ["task_type_id" =>1,"text" =>"Test task for 28144531","complete_till" =>1588885140,"entity_id" =>28144531,"entity_type" =>"leads","request_id" =>"example"];try {print_r($client->tasks()->createNew($task));}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$filter = ["page" =>0,"limit" =>50];try {$contacts =$client->contacts()->getAll($filter);// arrayprint_r($contacts);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}try {$contact =$client->contacts()->getById(45552657);// arrayprint_r($contact);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}try {$contact =$client->contact()->getById(28091207);// array}catch (AmoapiException$e) {echo$e;}$contact["name"] ="new name";$contact["price"] =1111;try {print_r($client->contacts()->update([$contact]));// array}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$contact = [["name" =>"new contact"]];try {print_r($client->contacts()->createNew($contact));// array}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$note = ["note_type" =>"common","text" =>"test note"];try {print_r($client->contacts()->addNoteById(28091207,$note))}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$filter = ["page" =>0,"limit" =>50];try {$companies =$client->companies()->getAll($filter);// array;print_r($companies);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}try {$company =$client->companies()->getById(45607457);// arrayprint_r($company);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}try {$company =$client->companies()->getById(45607457);// array}catch (AmoapiException$e) {echo$e;}$company["name"] ="update company";try {print_r($client->companies()->update([$contact]));// array}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$company = [["name" =>"new company"]];try {print_r($client->companies()->createNew($company));// array}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$note = ["note_type" =>"common","text" =>"test note"];try {print_r($client->companies()->addNoteById(45607457,$note));}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$filter = ["page" =>0,"limit" =>50];try {$customers =$client->customers()->getAll($filter);// arrayprint_r($customers);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}try {$customer =$client->customers()->getById(183435);// arrayprint_r($customer);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}try {$customer =$client->customers()->getById(183435);// array}catch (AmoapiException$e) {echo$e;}$customer["name"] ="update customer";try {print_r($client->customers()->update([$customer]));// array}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$customer = [["name" =>"new company"]];try {print_r($client->customers()->createNew($customer));// array}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$note = ["note_type" =>"common","text" =>"test note"];try {print_r($client->customers()->addNoteById(183435,$note));}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$filter = ["page" =>0,"limit" =>50];try {$users =$client->users()->getAll($filter);// arrayprint_r($users);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}try {$user =$client->users()->getById(6928032);// arrayprint_r($user);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$filter = ["page" =>0,"limit" =>50];try {$roles =$client->roles()->getAllRoles($filter);// arrayprint_r($roles);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}try {$role =$client->roles()->getRoleById(56320);// arrayprint_r($role);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}try {$info =$client->account()->getInfo();// arrayprint_r($info);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$filter = ["page" =>0,"limit" =>50];try {$catalogs =$client->catalogs()->getAll($filter);// arrayprint_r($catalogs);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}try {$catalog =$client->catalogs()->getById(2419);// arrayprint_r($catalog);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$catalog = [["name" =>"new catalog"]];try {print_r($client->catalogs()->createNew($catalog));// array}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}try {$catalog =$client->catalogs()->getById(2419);// array}catch (AmoapiException$e) {echo$e;}$catalog["name"] ="update catalog";try {print_r($client->catalogs()->update([$catalog]));// array}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$filter = ["page" =>0,"limit" =>50];try {$elements =$client->catalogs()->getAllElements(1989,$filter);// arrayprint_r($elements);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}try {$element =$client->catalogs()->getElementById(1989,953789);// arrayprint_r($element);}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}$element = [["name" =>"new element"]];try {print_r($client->catalogs()->createNewElement(1989,$catalog));}catch (AmoapiException$e) {echo$e;}
useAmoapi\Client\AmoapiClient;useAmoapi\Exception\AmoapiException;$client =newAmoapiClient("subdomain","client_id","client_secret","redirect_url",);try {$client->getTokensByCode("code");}catch (AmoapiException$e) {echo$e;}try {$element =$this->client->catalogs()->getElementById(1989,953789);}catch (AmoapiException$e) {echo$e;}$element["name"] ="new name";// Delete not expected fieldsunset($element["created_by"]);unset($element["updated_by"]);unset($element["custom_fields_values"][2]["values"][0]["enum_code"]);try {print_r($this->client->catalogs()->updateElement(1989, [$element]));}catch (AmoapiException$e) {echo$e;}