{ "info": { "author": "oznu", "author_email": "dev@oz.nu", "bugtrack_url": null, "classifiers": [], "description": "paAPI\r\n========\r\n\r\n.. image:: https://pypip.in/v/paAPI/badge.png\r\n :target: https://crate.io/packages/paAPI\r\n\r\n.. image:: https://pypip.in/d/paAPI/badge.png\r\n :target: https://crate.io/packages/paAPI\r\n\r\n\r\nA python client for the Parallels Operations Automation (POA) and Parallels Business Automation Enterprise (PBA) APIs.\r\n\r\n.. contents::\r\n :local:\r\n \r\n\r\n============\r\nInstallation\r\n============\r\n\r\nUsing pip::\r\n\r\n $ pip install paAPI\r\n \r\n\r\n=============================\r\nConnecting and Authenticating\r\n=============================\r\n\r\n.. code:: python\r\n\r\n POA(host,user=None,password=None,ssl=False,verbose=False,port=8440)\r\n \r\n PBA(host,user=None,password=None,ssl=False,verbose=False,port=5224)\r\n\r\n\r\nDefault Connection\r\n------------------\r\n\r\n.. code:: python\r\n\r\n from paAPI import POA, PBA\r\n\r\n # connect to POA\r\n pem = POA('mn.hostname.com')\r\n \r\n # connect to PBA\r\n api = PBA('pba.hostname.com')\r\n\r\nBasic HTTP Authentication\r\n-------------------------\r\n\r\n.. code:: python\r\n\r\n from paAPI import POA, PBA\r\n \r\n # connect to POA \r\n pem = POA('mn.hostname.com', user='admin', password='setup')\r\n \r\n\r\nSSL\r\n---\r\n\r\n.. code:: python\r\n\r\n from paAPI import POA, PBA\r\n \r\n # connect to POA \r\n pem = POA('mn.hostname.com', ssl=True)\r\n \r\nCustom Port\r\n-----------\r\n\r\n.. code:: python\r\n\r\n from paAPI import POA, PBA\r\n \r\n # connect to POA \r\n pem = POA('mn.hostname.com', port=8888)\r\n\r\n=========================================\r\nParallels Operations Automation (POA) API\r\n=========================================\r\n\r\nAll but three of the POA API calls start with 'pem', for this reason it is recommended you name your POA connection object 'pem' so you can call functions exactly how they are documented in the POA API as has been done in the examples in this Readme.\r\n\r\nThe full POA Public API Reference can be found here:\r\n\r\nhttp://download.pa.parallels.com/poa/5.5/doc/index.htm?fileName=56781.htm\r\n\r\nBasic API Call\r\n--------------\r\n\r\nThis example will show the pem.getAccountInfo_ method being called.\r\n\r\n.. _pem.getAccountInfo: http://download.pa.parallels.com/poa/5.5/doc/7915.htm\r\n\r\n.. code:: python\r\n\r\n from paAPI import POA\r\n\r\n pem = POA('mn.hostname.com')\r\n \r\n d = {\r\n 'account_id' : 1002242\r\n }\r\n \r\n print pem.getAccountInfo(**d)\r\n \r\n # {'status': 0, 'result': {'fax': {'phone_num': '', 'ext_num': '', 'area_code': '', 'country_code': ''}, 'account_type': 'C', 'phone': {'phone_num': '00000000', 'ext_num': '', 'area_code': '04', 'country_code': '61'}, 'brand': {'brand_id': 191, 'domain_name': 'brandingdomain.com', 'name': 'brandname'}, 'email': 'noreply@example.com', 'person': {'first_name': 'John', 'last_name': 'Smith', 'middle_name': '', 'company_name': 'Test Account', 'title': ''}, 'address': {'city': 'Canberra', 'country': 'au', 'street_name': '1 Test Street', 'zipcode': '2621', 'state': 'ACT', 'house_num': '', 'address2': ''}, 'parent_account_id': 1002241}}\r\n\r\nAPI Call with 'array of struct'\r\n-------------------------------\r\n\r\nThe POA API often calls for values and settings to be sent as an 'array of struct'. This example shows how to send these values using the paAPI client.\r\n\r\nThis example is based on the pem.activateSubscription_ method with resources types called 'DiskSpace' and 'Bandwidth' and a domain name.\r\n\r\n.. _pem.activateSubscription: http://download.pa.parallels.com/poa/5.5/doc/39160.htm\r\n\r\n.. code:: python\r\n\r\n from paAPI import POA\r\n\r\n pem = POA('mn.hostname.com')\r\n \r\n # define the resource limits:\r\n DiskSpace = {\r\n \"resource_id\" : 1002486,\r\n \"resource_limit\" : 1024\r\n }\r\n Bandwidth = {\r\n \"resource_id\" : 1002487,\r\n \"resource_limit\" : -1\r\n }\r\n \r\n # define the paramaters:\r\n DomainName = {\r\n \"var_name\" : \"DomainID\",\r\n \"var_value\" : \"example.com.au\"\r\n }\r\n \r\n # setup the call:\r\n d = {\r\n \"account_id\" : 1002242,\r\n \"subscription_name\" : \"Hosting (example.com.au)\",\r\n \"subscription_id\" : 1006754,\r\n \"service_template_id\" : 204,\r\n \"resource_limits\" : [DiskSpace, Bandwidth],\r\n \"paramaters\" : [DomainName],\r\n }\r\n \r\n # execute the call:\r\n result = pem.activateSubscription(**d)\r\n\r\n\r\nTransactions\r\n------------\r\n\r\nThere are three POA API calls that do not start with pem in the official documentation. When using paAPI you can use these API calls as documented but you will still need to prefix them with your POA connection object (the examples on this page use 'pem' as the connection object name).\r\n \r\n.. code:: python\r\n\r\n from paAPI import POA\r\n\r\n pem = POA('mn.hostname.com')\r\n \r\n # being transaction\r\n pem.txn.Begin()\r\n \r\n # commit transaction\r\n pem.txn.Commit()\r\n \r\n # rollback transaction\r\n pem.txn.Rollback()\r\n \r\n \r\nError Handling\r\n--------------\r\n\r\nThe POA API has quite good responces when an error occurs during an API call. The below example shows the responce format for POA API errors:\r\n\r\n\r\n.. code:: python\r\n\r\n {\r\n 'status' : -1, \r\n 'extype_id' : 21, \r\n 'module_id' : 'OpenAPI', \r\n 'error_message' : 'Invalid set of arguments. There should be specified EITHER external_info OR person, address, phone, [fax], [locale], email.', \r\n 'properties' : { \r\n 'reason': 'Invalid set of arguments. There should be specified EITHER external_info OR person, address, phone, [fax], [locale], email.'\r\n }\r\n }\r\n\r\n \r\n==================================================\r\nParallels Business Automation (PBA) API\r\n==================================================\r\n\r\nThe PBA API is quite different from the POA API, and not quite as user friendly. The paAPI client makes using the PBA a little easier by standardizing the returned responces, providing status codes, and decoding any error messages.\r\n\r\nThe major difference between the POA and PBA api is how values are sent and received. In PBA params are sent and responces are received as a list in a specific order to know what each value represents.\r\n\r\nThe full PBA Public API Reference can be found here:\r\n\r\nhttp://download.pa.parallels.com/pba/5.5/doc/pdf/SDK_API/pba_5.5_public_api_reference.pdf\r\n\r\nBasic API Call\r\n--------------\r\n\r\nThis example will show the **AccountDetailsGet_API** method being called.\r\n\r\n.. code:: python\r\n\r\n from paAPI import PBA\r\n \r\n api = PBA('pba.hostname.com')\r\n \r\n print api.Execute('AccountDetailsGet_API', params=['1002242'])\r\n \r\n # {'status': 0, 'result': [1002242, 1002241, 'Test Account 5543', '1 Test Street', '', 'Canberra', '', '2621', 'au', '', 'John', 'D', 'Smith', 'noreply@example.com', '61', '04', '000000000', '', '', '', '', '', 1351787114, 2, 0]}\r\n \r\nAlternate Server\r\n----------------\r\n\r\nMost PBA API method calls use the \"BM\" server. Some methods use alternate servers such as \"PEMGATE\" or \"DOMAINGATE\". This example shows how to specify an alternate server:\r\n\r\n.. code:: python\r\n\r\n from paAPI import PBA\r\n \r\n api = PBA('pba.hostname.com')\r\n \r\n api.Execute('DomainExpirationDateGet_API', params=params, server='DOMAINGATE')\r\n \r\nError Handling\r\n--------------\r\n\r\npaAPI takes the way POA returns errors natively and applies it to the PBA API. The status on each responce will either be **0** for a succesfull call, or **-1** if PBA returned an error.\r\n\r\nThis is an example of what is returned in the case of an error:\r\n\r\n.. code:: python\r\n\r\n {\r\n 'status' : -1, \r\n 'error_message' : 'Table Account does not contain row with ID 99999999.', \r\n 'server' : 'BM', \r\n 'host' : 'pba.hostname.com', \r\n 'params' : ['99999999'], \r\n 'result' : None, \r\n 'method' : 'AccountDetailsGet_API'\r\n }", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/oznu/paAPI", "keywords": "", "license": "Apache License", "maintainer": "", "maintainer_email": "", "name": "paAPI", "package_url": "https://pypi.org/project/paAPI/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/paAPI/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/oznu/paAPI" }, "release_url": "https://pypi.org/project/paAPI/0.0.1/", "requires_dist": null, "requires_python": null, "summary": "Notice: This module is depreciated in favour of ingrammicro's osaAPI", "version": "0.0.1" }, "last_serial": 2656523, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "2fdb508b53fc0521d5e4bb1af18f33e6", "sha256": "2e2d70c679d78ca78c949977ed370421c6265fe88366823f7c9560781957e609" }, "downloads": -1, "filename": "paAPI-0.0.1.tar.gz", "has_sig": false, "md5_digest": "2fdb508b53fc0521d5e4bb1af18f33e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16553, "upload_time": "2014-01-12T13:01:42", "url": "https://files.pythonhosted.org/packages/c2/28/13d20010a933190ba4546cc21f07a663675c1663ea72a80b08a95fd3ac0a/paAPI-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2fdb508b53fc0521d5e4bb1af18f33e6", "sha256": "2e2d70c679d78ca78c949977ed370421c6265fe88366823f7c9560781957e609" }, "downloads": -1, "filename": "paAPI-0.0.1.tar.gz", "has_sig": false, "md5_digest": "2fdb508b53fc0521d5e4bb1af18f33e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16553, "upload_time": "2014-01-12T13:01:42", "url": "https://files.pythonhosted.org/packages/c2/28/13d20010a933190ba4546cc21f07a663675c1663ea72a80b08a95fd3ac0a/paAPI-0.0.1.tar.gz" } ] }