{ "info": { "author": "Streamline Partners PTY Ltd", "author_email": "david.graupner@streamlinepartners.com.au", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "CherwellAPI is a suite of Python modules that abstract the Cherwell REST API and simplify the process of connecting to, and interacting with Cherwell business objects. \n\nBase Functionality Included\n===========================\n\n1. AdHoc searching\n2. Creating new business objects\n3. Updating existing business objects\n4. Deleting existing business objects\n\nThe modules also cater for caching of commonly used items such as templates, summaries and business object id's as well as self-managing the expiry and refreshing of the Bearer token used for authorisation. Additionally Tokens can be cached and reused.\n\nInstantiating a connection object\n=================================\n\nAll interaction typically takes place through a **_Connection_** object which can be instantiated as follows:\n\n```python\nfrom CherwellAPI import CherwellClient\n \ncherwell_client = CherwellClient.Connection(,,,) \n```\n*Replace the parameters between '<>' with appropriate values from your own Cherwell instance.*\n\nCreating a new business object\n==============================\n\nA new Incident could be created as follows:\n\n```python\nfrom CherwellAPI import CherwellClient\n\n# Create a new CherwellClient Connection\ncherwell_client = CherwellClient.Connection(,,,)\n\n# Create a new instance of an Incident business object\nIncident = cherwell_client.get_new_business_object(\"Incident\")\n\n# Set the properties of the new Incident\nIncident.CustomerDisplayName = \"John Allard\"\nIncident.Description = \"This is a test Incident\"\nIncident.Priority = 5\nIncident.Service = \"IT Service Desk\"\nIncident.Category = \"Report Outage or Error\"\nIncident.Subcategory = \"Submit Incident\"\nIncident.Source = \"Event\"\n\n# Save the new Incident\nIncident.Save()\n\n# Show the new business object record id\nprint(\"RecId for new Incident: {}\".format(Incident.busObRecId))\nprint(\"PublicId for new Incident: {}\".format(Incident.busObPublicId))\n\n```\nOutput from executing the script above would likely looks as follows:\n\n*RecId for new Incident: 944cccbc07cde32400bea6482a8c3dd1f36dc57d6b*\n\n*PublicId for new Incident: 102401*\n\n**Note:** *Depending on how your Cherwell instance is configured, you might need to supply more or less property values, or even different values*\n\nUpdating a business object\n==========================\n\nThe following code snippet, show an example of how to get an instance of the Incident we created in the previous step and update it.\n\nFor this we need to import and use the **_SimpleFilter_** object, which we can populate with one or more filters to aid in searching.\n\n```python\n\nfrom CherwellAPI import CherwellClient\nfrom CherwellAPI import Filter\n\n# Create a new CherwellClient Connection\ncherwell_client = CherwellClient.Connection(,,,)\n\n# Create a new SimpleFilter object instance,\n# indicating the filter is applicable for the Cherwell 'Incident' business object\nsearch_filter = Filter.SimpleFilter(\"Incident\")\n\n# Add some search filters - we are looking for the Incident created previously\nsearch_filter.add_search_fields(\"IncidentID\", \"eq\", \"102401\")\nsearch_filter.add_search_fields(\"Status\", \"eq\", \"New\")\nsearch_filter.add_search_fields(\"Description\", \"contains\", \"test\")\n\n# Pass the Simple filter object to the CherwellClient - 'get_business_objects' method\n# This method returns the number of matching business objects as well as the list of matching business objects\nnum_records, business_objects = cherwell_client.get_business_objects(search_filter)\n\n# Print number of records returned\nprint(\"Number of records: {}\".format(num_records))\n\n# Loop through the records returned\nindex = 0\nfor business_object in business_objects:\n index = index + 1\n print(\"Record: {}\".format(index))\n print(\"Public Record Id: {}\".format(business_object.busObPublicId))\n print(\"Status: {}\".format(business_object.Status))\n\n # Change the Incident description\n business_object.Description = \"Updated the description\"\n\n # Save the updated business object\n business_object.Save()\n\n```\n\nDeleting the previously created Incident\n========================================\n\nDeleting an object is just as easy, see below for an example of deleting the Incident record we updated in the previous step.\n\n```python\n\nfrom CherwellAPI import CherwellClient\nfrom CherwellAPI import Filter\n\n# Create a new CherwellClient Connection\ncherwell_client = CherwellClient.Connection(,,,)\n\n# Create a new SimpleFilter object, indicating the filter is applicable for the Cherwell Incident business object\nsearch_filter = Filter.SimpleFilter(\"Incident\")\n\n# add a search filter where we are looking for the Incident created previously\nsearch_filter.add_search_fields(\"IncidentID\", \"eq\", \"102401\")\n\n# Pass the SimpleFilter object instance to the CherwellClient\n# This method returns the number of matching business objects as well as the list of matching business objects\nnum_records, business_objects = cherwell_client.get_business_objects(search_filter)\n\nif num_records == 1:\n\n # We should only have 1\n business_objects[0].Delete()\n\n```\n\nFor more examples, refer to our GitHub project [here](https://github.com/streamline-partners/CherwellAPI/tree/master/Examples).\n\nFull source code can be found [here](https://github.com/streamline-partners/CherwellAPI).\n\nTo find out more about Streamline Partners and how we could assist you with future projects, click [here](http://www.streamlinepartners.com.au/)", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "CherwellAPI", "package_url": "https://pypi.org/project/CherwellAPI/", "platform": "", "project_url": "https://pypi.org/project/CherwellAPI/", "project_urls": null, "release_url": "https://pypi.org/project/CherwellAPI/1.3.3/", "requires_dist": null, "requires_python": "", "summary": "A Python library wrapper, abstracting the Cherwell REST API", "version": "1.3.3" }, "last_serial": 5679658, "releases": { "1.3": [ { "comment_text": "", "digests": { "md5": "f7d50ff52ff36fc9f4c64ecdabb04f5d", "sha256": "78a059bd3b3e6409469b7b426918bce105717a6eb9e5d618229e09f60bb0fcca" }, "downloads": -1, "filename": "CherwellAPI-1.3.tar.gz", "has_sig": false, "md5_digest": "f7d50ff52ff36fc9f4c64ecdabb04f5d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19115, "upload_time": "2019-05-26T02:39:51", "url": "https://files.pythonhosted.org/packages/ec/22/311ebdc6134eb2295b7e4eda43e552eaae66ac5f1b115d226209f4b8d218/CherwellAPI-1.3.tar.gz" } ], "1.3.1": [ { "comment_text": "", "digests": { "md5": "30ce688ed22e42360fb51c1163515b6e", "sha256": "e4cbc6511226394c816ec555a964740c5f2a142562aa04498b2436df2b6b9934" }, "downloads": -1, "filename": "CherwellAPI-1.3.1.tar.gz", "has_sig": false, "md5_digest": "30ce688ed22e42360fb51c1163515b6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19278, "upload_time": "2019-06-16T19:35:39", "url": "https://files.pythonhosted.org/packages/15/2f/e1ffc72b9a3d4f763aefb3ede29f7d94f654c43f8fa9faeadd6d9a043889/CherwellAPI-1.3.1.tar.gz" } ], "1.3.2": [ { "comment_text": "", "digests": { "md5": "2f2fa144c2d4263ece4bb40486f90a4b", "sha256": "06d676dfe7f2786a99f3229b7ebf31e32df528f01c2c089d655a9a6ac138f578" }, "downloads": -1, "filename": "CherwellAPI-1.3.2.tar.gz", "has_sig": false, "md5_digest": "2f2fa144c2d4263ece4bb40486f90a4b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19524, "upload_time": "2019-06-23T22:06:53", "url": "https://files.pythonhosted.org/packages/4b/1e/e1fc9ea1f2be5161e18a437c944582584600b16057faf3129f493c710741/CherwellAPI-1.3.2.tar.gz" } ], "1.3.3": [ { "comment_text": "", "digests": { "md5": "6912ebef14c6300ff39cba85dcf594e3", "sha256": "368143e5dac6ecff481bb738cc9ab553e777c13b6d50a5f8f564e347e4ffaa20" }, "downloads": -1, "filename": "CherwellAPI-1.3.3.tar.gz", "has_sig": false, "md5_digest": "6912ebef14c6300ff39cba85dcf594e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20318, "upload_time": "2019-08-14T22:41:50", "url": "https://files.pythonhosted.org/packages/ca/4c/3782dc3b8aebad8581bcc83f8146eff22974efbb22b9fdeb8903600fbba9/CherwellAPI-1.3.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6912ebef14c6300ff39cba85dcf594e3", "sha256": "368143e5dac6ecff481bb738cc9ab553e777c13b6d50a5f8f564e347e4ffaa20" }, "downloads": -1, "filename": "CherwellAPI-1.3.3.tar.gz", "has_sig": false, "md5_digest": "6912ebef14c6300ff39cba85dcf594e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20318, "upload_time": "2019-08-14T22:41:50", "url": "https://files.pythonhosted.org/packages/ca/4c/3782dc3b8aebad8581bcc83f8146eff22974efbb22b9fdeb8903600fbba9/CherwellAPI-1.3.3.tar.gz" } ] }