marketo-api / marketo-rest-client
Marketo.com REST API的PHP客户端
v0.0.5
2015-12-02 10:13 UTC
Requires
- php: >=5.3.3
- commerceguys/guzzle-oauth2-plugin: ~1.0
- guzzle/guzzle: ~3.8
This package is not auto-updated.
Last update: 2024-09-28 20:03:40 UTC
README
Marketo REST API客户端
Marketo.com REST API的非官方PHP客户端:http://developers.marketo.com/documentation/rest/。需要PHP 5.3.3及以上版本。
安装
建议通过Composer安装客户端。只需运行以下命令即可将库添加到您的composer.json文件中。
composer require marketo-api/marketo-rest-client
设置
客户端基于Guzzle 3构建,并使用工厂方法创建实例。您必须指定Munchkin ID或完整的URL。
#### 对于REST API访问
use CSD\Marketo\Client; $client = Client::factory(array( 'client_id' => 'Marketo client ID', // required 'client_secret' => 'Marketo client secret', // required 'munchkin_id' => '100-AEK-913' // alternatively, you can supply the full URL, e.g. 'url' => 'https://100-AEK-913.mktorest.com' ));
#### 对于批量API访问
use CSD\Marketo\Client; $client = Client::factory(array( 'client_id' => 'Marketo client ID', // required 'client_secret' => 'Marketo client secret', // required 'munchkin_id' => '100-AEK-913' // alternatively, you can supply the full URL, e.g. 'url' => 'https://100-AEK-913.mktorest.com' 'bulk' => true // if uploading leads via file upload (e.g. csv) ));
用法
查看src/Client.php
的源代码以了解所有可用方法。
贡献
请创建pull请求。希望pull请求能在几天内得到审查。一般来说,不要合并自己的pull请求。只要在service.json
文件中添加了操作,就可以使用操作,只要您使用的是$client->getFoo()->getResult()
,但大多数操作都有它们自己的访问方法,具有简化的参数处理。除非它执行特殊操作,否则操作不需要有自己响应类。请尊重此项目的语义版本控制。这意味着除非计划进行主要版本更改,否则不会破坏向后兼容性。
添加新操作的简单示例
{ "operations": { "getFoo": { "httpMethod": "GET", "uri": "foo.json", "parameters": {}, "responseModel": "baseResponse", "responseClass": "CSD\\Marketo\\Response" }, }
许可证
本源代码受MIT许可证的许可,有关完整详细信息,请参阅LICENSE文件。如果您使用此代码,我们很高兴听到您的反馈。