Skip to content

Commit

Permalink
Updated readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Pliakas committed Feb 20, 2014
1 parent 8fc464c commit 54d88b8
Showing 1 changed file with 50 additions and 1 deletion.
51 changes: 50 additions & 1 deletion README.md
Expand Up @@ -20,9 +20,58 @@ by adding it as a dependency to your project's composer.json file.
}
```

After running `php composer.phar update` on the command line, include the
autoloader in your PHP scripts so that the SDK classes are made available.

```php
require_once 'vendor/autoload.php';
```

Please refer to [Composer's documentation](https://github.com/composer/composer/blob/master/doc/00-intro.md#introduction)
for more detailed installation and usage instructions.

## Usage

@todo
### XMLRPC

The following example returns a list of products with SKUs that start with "123":

```php

use Magento\Client\Xmlrpc\MagentoXmlrpcClient;

$client = MagentoXmlrpcClient::factory(array(
'base_url' => 'http://magentohost',
'api_user' => 'api.user',
'api_key' => 'some.private.key',
));

$filters = array(
'sku' => array('like' => '123%'),
);

$result = $client->call('catalog_product.list', array($filters));
```

### Rest

The following example returns a list of products:

```php

use Magento\Client\Rest\MagentoRestClient;

$client = MagentoRestClient::factory(array(
'base_url' => 'http://magentohost',
'consumer_key' => 'abc123...',
'consumer_secret' => 'def456...',
'token' => 'ghi789...',
'token_secret' => 'jkl012...',
));

$result = $client->get('/api/rest/products')->send()->json();

```

Refer to [Guzzle's documentation](https://guzzle.readthedocs.org/en/latest/http-client/request.html#creating-requests-with-a-client)
for more information on sending requests to the server.

0 comments on commit 54d88b8

Please sign in to comment.