The Akeneo API brought to you!
You must have Python 2 >=2.7.9 or Python 3 >=3.4 installed on your system to install and run this SDK. This SDK package depends on other Python packages like nose, jsonpickle etc.
These dependencies are defined in the requirements.txt file that comes with the SDK.
To resolve these dependencies, you can use the PIP Dependency manager. Install it by following steps at https://pip.pypa.io/en/stable/installing/.
Python and PIP executables should be defined in your PATH. Open command prompt and type pip --version.
This should display the version of the PIP Dependency Manager installed if your installation was successful and the paths are properly defined.
- Using command line, navigate to the directory containing the generated files (including
requirements.txt) for the SDK. - Run the command
pip install -r requirements.txt. This should install all the required dependencies.
The following section explains how to use the Akkblfpim23 SDK package in a new project.
Open up a Python IDE like PyCharm. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.
Click on Open in PyCharm to browse to your generated SDK directory and then click OK.
The project files will be displayed in the side bar as follows:
Create a new directory by right clicking on the solution name as shown below:
Name the directory as "test"
Add a python file to this project with the name "testsdk"
Name it "testsdk"
In your python file you will be required to import the generated python library using the following code lines
from akkblfpim23.akkblfpim_23_client import Akkblfpim23ClientAfter this you can write code to instantiate an API client object, get a controller object and make API calls. Sample code is given in the subsequent sections.
To run the file within your test project, right click on your Python file inside your Test project and click on Run
You can test the generated SDK and the server with automatically generated test cases. unittest is used as the testing framework and nose is used as the test runner. You can run the tests as follows:
- From terminal/cmd navigate to the root directory of the SDK.
- Invoke
pip install -r test-requirements.txt - Invoke
nosetests
In order to setup authentication and initialization of the API client, you need the following information.
| Parameter | Description |
|---|---|
| o_auth_access_token | OAuth 2.0 Access Token |
API client can be initialized as following.
# Configuration parameters and credentials
o_auth_access_token = 'o_auth_access_token' # OAuth 2.0 Access Token
client = Akkblfpim23Client(o_auth_access_token)- ProductController
- AttributeController
- AttributeOptionController
- AttributeGroupsController
- CategoryController
- ChannelController
- CurrencyController
- FamilyController
- FamilyVariant2XOnlyController
- MeasureFamily2XOnlyController
- MiscController
An instance of the ProductController class can be accessed from the API Client.
product_controller = client.productAssuming that the given identifier is the identifier of an existing product
def get_product(self)product_controller.get_product()TODO: Add a method description
def get_products(self,
content_type,
cookie)| Parameter | Tags | Description |
|---|---|---|
| contentType | Required |
TODO: Add a parameter description |
| cookie | Required |
TODO: Add a parameter description |
content_type = 'application/json'
cookie = 'Cookie'
product_controller.get_products(content_type, cookie)An instance of the AttributeController class can be accessed from the API Client.
attribute_controller = client.attributeAssuming that the given code is the code of an existing attribute
def get_attribute(self)attribute_controller.get_attribute()TODO: Add Description
def get_attributes(self)attribute_controller.get_attributes()An instance of the AttributeOptionController class can be accessed from the API Client.
attribute_option_controller = client.attribute_optionAssuming that the given codes are respectively the code of an existing attribute and an existing option of this attribute
def get_attribute_option(self)attribute_option_controller.get_attribute_option()TODO: Add Description
def get_attribute_options(self)attribute_option_controller.get_attribute_options()An instance of the AttributeGroupsController class can be accessed from the API Client.
attribute_groups_controller = client.attribute_groupsAssuming that the given code is the code of an existing attribute group
def get_attribute_group_2_x_only(self)attribute_groups_controller.get_attribute_group_2_x_only()TODO: Add Description
def get_attribute_groups_2_x_only(self)attribute_groups_controller.get_attribute_groups_2_x_only()An instance of the CategoryController class can be accessed from the API Client.
category_controller = client.categoryAssuming that the given code is the code of an existing category
def get_category(self)category_controller.get_category()TODO: Add Description
def get_categories(self)category_controller.get_categories()An instance of the ChannelController class can be accessed from the API Client.
channel_controller = client.channelAssuming that the given code is the code of an existing channel
def get_channel(self)channel_controller.get_channel()TODO: Add Description
def get_channels(self)channel_controller.get_channels()An instance of the CurrencyController class can be accessed from the API Client.
currency_controller = client.currencyAssuming that the given code is the code of an existing currency
def get_currency_2_x_only(self)currency_controller.get_currency_2_x_only()TODO: Add Description
def get_currencies_2_x_only(self)currency_controller.get_currencies_2_x_only()An instance of the FamilyController class can be accessed from the API Client.
family_controller = client.familyAssuming that the given code is the code of an existing family
def get_family(self)family_controller.get_family()TODO: Add Description
def get_families(self)family_controller.get_families()An instance of the FamilyVariant2XOnlyController class can be accessed from the API Client.
family_variant_2_x_only_controller = client.family_variant_2_x_onlyAssuming that the given codes are respectively the code of an existing family and an existing family variant
def get_family_variant_2_x_only(self)family_variant_2_x_only_controller.get_family_variant_2_x_only()TODO: Add Description
def get_family_variants_2_x_only(self)family_variant_2_x_only_controller.get_family_variants_2_x_only()An instance of the MeasureFamily2XOnlyController class can be accessed from the API Client.
measure_family_2_x_only_controller = client.measure_family_2_x_onlyAssuming that the given code is the code of an existing measure family
def get_measure_family_2_x_only(self)measure_family_2_x_only_controller.get_measure_family_2_x_only()TODO: Add Description
def get_measure_families_2_x_only(self)measure_family_2_x_only_controller.get_measure_families_2_x_only()An instance of the MiscController class can be accessed from the API Client.
misc_controller = client.miscTODO: Add Description
def create_authentification_by_password(self,
body,
content_type)| Parameter | Tags | Description |
|---|---|---|
| body | Required |
TODO: Add a parameter description |
| contentType | Required |
TODO: Add a parameter description |
body_value = "{\"username\":\"{{username}}\",\"password\":\"{{password}}\",\"grant_type\":\"password\"}"
body = json.loads(body_value)
content_type = 'application/json'
misc_controller.create_authentification_by_password(body, content_type)TODO: Add Description
def create_authentification_by_refresh_token(self,
body,
content_type)| Parameter | Tags | Description |
|---|---|---|
| body | Required |
TODO: Add a parameter description |
| contentType | Required |
TODO: Add a parameter description |
body_value = "{\"refresh_token\":\"{{refreshToken}}\",\"grant_type\":\"refresh_token\"}"
body = json.loads(body_value)
content_type = 'application/json'
misc_controller.create_authentification_by_refresh_token(body, content_type)
