Download the PHP package creads/partners-api without Composer
On this page you can find all versions of the php package creads/partners-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download creads/partners-api
More information about creads/partners-api
Files in creads/partners-api
Package partners-api
Short Description A simple PHP client and CLI for Creads Partners API
License MIT
Homepage http://www.creads-partners.com
Informations about the package partners-api
creads/partners-api
A simple PHP client and CLI for Creads Partners API.
We recommend to read the Full API Documentation first.
Build Status | Code Climate | Downloads | Release |
---|---|---|---|
Use the library in your project
Installation
The recommended way to install the library is through Composer.
Install Composer:
Run the Composer command to install the latest stable version:
Usage
After installing, you need to require Composer's autoloader:
First you need to instantiate the Client with an OAuthAuthentication
Or if you have an access token from somewhere else:
Get information about the API:
Get information about me:
Update my firstname:
Delete a comment of mine:
Create a project:
Upload a file:
The response will expose a
Location
header containing the file url. This url is what you need to reference in a resource to which you want to link this file
Download a file:
Errors and exceptions handling
When HTTP errors occurs (4xx and 5xx responses) , the library throws a GuzzleHttp\Exception\ClientException
object:
If you prefer to disable throwing exceptions on an HTTP protocol error:
Webhooks
You can check the validity of a webhook signature easily:
Use the CLI application
Installation
If you don't need to use the library as a dependency but want to interract with Cread Partners API from your CLI. You can install the binary globally with composer:
composer global require creads/partners-api:@dev
Then add the bin directory of composer to your PATH in your ~/.bash_profile (or ~/.bashrc) like this:
export PATH=~/.composer/vendor/bin:$PATH
You can update the application later with:
composer global update creads/partners-api
Usage
Get some help:
bin/partners --help
Log onto the API (needed the first time):
bin/partners login
Avoid to type your password each time token expires, using "client_credentials" grant type:
bin/partners login --grant-type=client_credentials
Or if you are not allowed to authenticated with "client_credentials", save your password locally:
bin/partners login --save-password
Get a resource:
bin/partners get /
Including HTTP-headers in the output with -i
:
bin/partners get -i /
Filtering result thanks to JSON Path (see http://goessner.net/articles/JsonPath). For instance, get only the version number of the API:
bin/partners get / -f '$.version'
Or get the organization I am member of:
bin/partners get /me -f '$.member_of.*.organization'
Create a resource:
...
Update a resource:
...
Update a resource using an editor:
bin/partners get /me | vim - | bin/partners post /me
Update a resource using Sublime Text:
bin/partners get /me | subl - | bin/partners post /me
All versions of partners-api with dependencies
guzzlehttp/guzzle Version ^6.0
symfony/console Version >=2.7
flow/jsonpath Version ^0.3.0