Skip to content

springimport/magento2-api-v1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Rest client for Magento 2

This is wrapper over Guzzle for Magento 2 REST API. Alternatively, you can use Swagger Client.

Installation

The preferred way to install this extension is through composer.

php composer.phar require --prefer-dist springimport/magento2-api-v1 "*"

or

"springimport/magento2-api-v1": "*"

Usage

Once the extension is installed, simply use it in your code by :

use springimport\magento2\apiv1\Configuration,
    springimport\magento2\apiv1\ApiFactory;

class ApiClient
{

    public static function get()
    {
        $configuration = new Configuration;
        $configuration->setBaseUri('baseUri');
        $configuration->setConsumerKey('consumerKey');
        $configuration->setConsumerSecret('consumerSecret');
        $configuration->setToken('accessToken');
        $configuration->setTokenSecret('tokenSecret');

        return new ApiFactory($configuration);
    }
}

About

Rest client for Magento 2 (API v1)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages