{ "info": { "author": "Aleksei Aikashev", "author_email": "a.aykashev@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Library to work with Archer REST and Content APIs\n===========================================\nMy original objective was to create Office365 mail to Archer Incidents application connector.Script captures the email, checks if there is an incident ID assigned and add the email to comments section (sub form) in archer record.\nThis package supports archer part of the connector, if someone interested I can share the whole thing.\n\n#### Release notes:\n> v0.1.9 (13 Dec 2019)\n> - Fixed method get_field_content in Record, fixed error when method crashed if the value in values list is None\n> - Now, if there are several values in values list. Function will return all values, including parent value if you're using leveled values list. \n> - Looks like this [\"Parent Value:Value\", \"Parent Value:Value\", \"Value\"]\n> - ATTENTION!!! now function returns LIST of values instead of string value.\n>\n> v0.1.8 (31 Oct 2019)\n> - added delete_record(self, record_id=None) to ArcherInstance and few small fixes\n>\n> v0.1.4 (05 Feb 2019)\n> - added user deactivation method and some user method error handling \n>\n> v0.1.3 (29 Jan 2019)\n> - added archer instance method get_value_id_by_field_name_and_value() to be able to set value in record create/update methods\n\n# Archer REST API \n## 0. Installation\n```bash\npip install rsa-archer\n```\n## 1. Creating Archer Instance\nCreate \"api\" user in Archer with proper permissions\nAt first, create Archer Instance object and continue to work with it\n```python\nimport rsa_archer\nfrom rsa_archer.archer_instance import ArcherInstance\narcher_instance = ArcherInstance(\"domain\",\"archer instance name\",\"api username\", \"password\")\n# e.g. \narcher_instance = ArcherInstance(\"archer.companyzxc.com\",\"risk_management\",\"api\", \"secure password\")\n```\n\n## 2. Working with content records\n### 2.1 Selecting application\nTo start working with content records you need to select Archer application (one application per Archer Instance object), without it it'll not work.\n```python\narcher_instance.from_application(\"application name\")\n# e.g.\narcher_instance.from_application(\"Incidents\") #same name as in archer application list\n```\n### 2.2 Creating new record\n**NOTE** - right now working natively with record's fields is limited to text fields, for values list, attachemts and other types of fields you need to operate with archer internal ids. Good example of this is working with attachments, it could be found below. \nPreparing json with field names and their values (text or ids):\n```python\nrecord_json = {\"field name1\": \"value1\", \"field name2\": \"value2\", \"values list field name\": [id1,id2,id3..] ...}\n# e.g.\nrecord_json = {\"Incident Summary\": \"desired text\", \"Reporter email\": \"email\",\"Incident Details\": \"HTML text\", \"Severity\": [34658]}\n```\nCreating the record and getting its id:\n```python\nrecord_id = archer_instance.create_content_record(record_json)\n```\n\n### 2.2 Working with existing records\n#### 2.2.1 Getting record content\nGetting record object by id:\n```python\nexisting_record = archer_instance.get_record(record_id)\n```\nGetting values of record fields (including ids):\n```python\nexisting_record.get_field_content(\"field_name\")\n\n# it returns, value of the text field\n# array of user internal ids for user field\n# proper value for values list\n# internal ids for other types of fields\n# TODO other types of fields\n```\n\n#### 2.2.2 Updating existing record\nPreparing updater json\n```python\nupdater_json = {\"field name1\": \"value1\", \"field name2\": \"value2\", ...}\n#e.g.\nupdater_json = {\"Incident Summary\": \"desired text\", \"Reporter email\": \"email\",\"Incident Details\": \"HTML text\"}\n ```\n\nUpdating the record values:\n```python\narcher_instance.update_content_record(updater_json, record_id)\n```\n#### 2.2.3 Posting attachments to archer instance\nUploading attachment to Archer and getting its id:\n```python\nattachment_id = archer_instance.post_attachment(\"file name\", fileinbase64_string)\n```\nAppending attachment ids into array, you might want to get existing record atttachments ids first and append additional attachment id to it or you will lose the existing ones:\n```python\nattachment_ids = []\nattachment_ids.append(attachment_id)\n```\nThen associate the ids with the existing record for example:\n```python\nupdater_json = {\"Attachments\": attachment_ids}\narcher_instance.update_content_record(updater_json, record_id)\n```\n\n## 3. Working with sub forms in content records\n### 3.1 Creating subrecords\nCreating sub_record and getting its id:\n```python\nsub_form_json = {\"subform field name1\": \"value1\", \"subform field name1\": \"value1\", ...}\nsub_record_id = archer_instance.create_sub_record(sub_form_json, \"subform field name in target application\")\n```\nThen associate subrecord with content record, in this case existing record:\n```python\nupdater_json = {\"subform field name in target application\": sub_record_id}\narcher_instance.update_content_record(updater_json, record_id)\n```\nBut it will replace the existing subrecords in application, so you should get the existing subrecords first:\n```python\ncurrent_sub_records_ids = record.get_field_content(\"subform field name in target application\") #get the array of existing attachments ids\nif current_sub_records:\n final_sub_records = current_sub_records_ids + sub_record_id\nelse:\n final_sub_records = sub_record_id\n```\nAnd then update the original application record: \n```python\nupdater_json = {\"subform field name in target application\": sub_record_id}\narcher_instance.update_content_record(updater_json, record_id)\n```\n### 3.2 Attachments to subrecords\nUploading attachment to Archer and getting its id:\n```python\nattachment_id = archer_instance.post_attachment(\"file name\", fileinbase64_string)\n```\nPut attachment ids into array:\n```python\nattachment_ids = []\nattachment_ids.append(attachment_id)\n```\n\nAssosiate it with the new sub_record\n```python\nsub_form_json = {\"sub form attachment field name\": attachment_ids}\narcher_instance.create_sub_record(sub_form_json, \"APPLICATION FIELD NAME\")\n```\n\n## 4. Working with users\n### 4.1 Getting user objects:\nGetting all user objects:\n```python\nusers = archer_instance.get_users()\n```\nGetting individual user object:\n```python\nuser = archer_instance.get_user_by_id(\"user id\")\n```\nGetting users using filters, find full list of filters in Archer REST API documentation:\n```python\nusers = archer_instance.get_users(\"?$select=Id,DisplayName&$orderby=LastName\")\n```\nGetting active users with no login:\n```python\nusers = archer_instance.get_active_users_with_no_login()\n```\n### 4.2 Getting users info\nGetting user object parameters (added for convenience), all information could be found in user.json:\n```python\nemail = user.get_user_email()\nid = user.get_user_id()\ndisplay_name = user.get_gisplay_name()\nuser_name = user.get_username()\nlast_login = user.get_last_login_date()\n```\n### 4.3 Working with user object\nAssigning user to role:\n```python\nuser.assign_role_to_user(\"role id\")\n```\nActivating user:\n```python\nuser.activate_user()\n```\nDeactivating user:\n```python\nuser.deactivate_user()\n```\nAdding user to group:\n```python\narcher_instance.get_all_groups() #loads all groups first\nuser.put_user_to_group(\"group name\")\n```\n# Archer GRC API (released from 6.4)\nTo start working in GRC api you need to set an endpoint, it's analog of application we used in REST.\nTo find the exact name of an endpoint you can use the following method:\n```python\narcher_instance.find_grc_endpoint_url(\"application name\")\n```\nWith endpoint name you can get content records of the application:\n* it'll give you only 1000 records at a time, use skip to get more\n* I used this api only to get key field to id mapping, since there is no normal search in REST API\n* Method returns array_of_jsons instead of record objects, since these jsons are different from REST jsons and I don't really use them\n```python\narray_of_jsons = archer_instance.get_grc_endpoint_records(\"endpoint name\", skip=None)\n```\nI'm building key record field value to record internal id mapping:\n* for Incidents application \"application key field\" was incident #INC-xxx, but key record field stores only integer, for some reason\n* so I added prefix, \"INC-\" in my example to the method\n```python\narcher_instance.build_unique_value_to_id_mapping(\"endpoint name\", \"application key field name\", \"prefix\"=None)\n```\nSo based on key record field value I can get record internal id:\n```python\nrecord_id = archer_instance.get_record_id_by_unique_value(\"key field value\")\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mwa21/rsa_archer", "keywords": "RSA Archer GRC Library", "license": "", "maintainer": "", "maintainer_email": "", "name": "rsa-archer", "package_url": "https://pypi.org/project/rsa-archer/", "platform": "", "project_url": "https://pypi.org/project/rsa-archer/", "project_urls": { "Homepage": "https://github.com/mwa21/rsa_archer" }, "release_url": "https://pypi.org/project/rsa-archer/0.1.9/", "requires_dist": null, "requires_python": "", "summary": "RSA Archer REST and GRC API library", "version": "0.1.9", "yanked": false, "yanked_reason": null }, "last_serial": 6290887, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "0b8efae3f74a52152f23f2081f08bf29", "sha256": "14d55342a040c6c2d61d2a741be026ddf57538e3b3e39c1b9e9878a6a9d3ed93" }, "downloads": -1, "filename": "rsa_archer-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "0b8efae3f74a52152f23f2081f08bf29", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13064, "upload_time": "2018-11-13T07:36:50", "upload_time_iso_8601": "2018-11-13T07:36:50.517467Z", "url": "https://files.pythonhosted.org/packages/e0/17/e137af69ea19ad168b49e12e1a000da55ca7b15600297d0e997003e82691/rsa_archer-0.1.2-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "3823596f678ead673f8b58a64d8deaf2", "sha256": "8da7ba707cdb85f881ba764c1913a0d3efa1c6b60e3711134d11ce96eed348ce" }, "downloads": -1, "filename": "rsa_archer-0.1.2.tar.gz", "has_sig": false, "md5_digest": "3823596f678ead673f8b58a64d8deaf2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12434, "upload_time": "2018-11-13T07:36:52", "upload_time_iso_8601": "2018-11-13T07:36:52.768184Z", "url": "https://files.pythonhosted.org/packages/fb/5e/2a41242bff3e53377e8bd4ffaa72a79431d441eafaa3b1ab2a0879b3ce00/rsa_archer-0.1.2.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "b09c75281705806e02e02a3371d68d65", "sha256": "988bf1dec5d75f34c6101f7f40976362c8451ed6ffa1d11daf32ad0a05b447e9" }, "downloads": -1, "filename": "rsa_archer-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "b09c75281705806e02e02a3371d68d65", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13379, "upload_time": "2019-01-29T06:58:42", "upload_time_iso_8601": "2019-01-29T06:58:42.726725Z", "url": "https://files.pythonhosted.org/packages/8c/3b/85b9fe19efbffad2fc3d21a592d1a9a06d9df84d355daae23b18d4522471/rsa_archer-0.1.3-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "73265b740e68f018ce7cab4be3014d68", "sha256": "4a3d13b6ac2b05fca169a18a6a484b55be9f008e0dd2ae854532aa7f25726c44" }, "downloads": -1, "filename": "rsa_archer-0.1.3.tar.gz", "has_sig": false, "md5_digest": "73265b740e68f018ce7cab4be3014d68", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13091, "upload_time": "2019-01-29T06:58:44", "upload_time_iso_8601": "2019-01-29T06:58:44.252784Z", "url": "https://files.pythonhosted.org/packages/f0/5e/25f728c30d595ecd210d3474c71f7f98aad565ce805a00e099eac49da95a/rsa_archer-0.1.3.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "bf97ed0752db370191802274ce565b51", "sha256": "ae126a237574e8b55c095743d177174707209a771cc9da944e77ca16d6bdd8b1" }, "downloads": -1, "filename": "rsa_archer-0.1.4.tar.gz", "has_sig": false, "md5_digest": "bf97ed0752db370191802274ce565b51", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13491, "upload_time": "2019-02-05T05:12:54", "upload_time_iso_8601": "2019-02-05T05:12:54.324417Z", "url": "https://files.pythonhosted.org/packages/e7/61/0a209c787fc70ca0bdc1a130722eb1363791a691ac55701f08873f166d2e/rsa_archer-0.1.4.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "aa9db4e37f0ba4f1844f11de657cf475", "sha256": "bd5fce25af9a7a3707333a2d695f25c5c6e0b9abeb5383b3f778342bcd6e0900" }, "downloads": -1, "filename": "rsa_archer-0.1.5.tar.gz", "has_sig": false, "md5_digest": "aa9db4e37f0ba4f1844f11de657cf475", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13542, "upload_time": "2019-06-10T06:54:47", "upload_time_iso_8601": "2019-06-10T06:54:47.534197Z", "url": "https://files.pythonhosted.org/packages/90/68/bc6d77a0216e49d03a8ae6f208a04e2c97ed5fa8550098e6f6b671c2261b/rsa_archer-0.1.5.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "2e7976c31593451b9dd60df94b54faf4", "sha256": "199b89c776cd0b8b87b918179c0fa66630e311ee9e9f0418c03f0e6f71c04773" }, "downloads": -1, "filename": "rsa_archer-0.1.6.tar.gz", "has_sig": false, "md5_digest": "2e7976c31593451b9dd60df94b54faf4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13629, "upload_time": "2019-08-30T04:33:24", "upload_time_iso_8601": "2019-08-30T04:33:24.268277Z", "url": "https://files.pythonhosted.org/packages/af/8f/cd5e04572a84cb7c57a32b5364dff43909a24e4ddd71e1c8241c27648d19/rsa_archer-0.1.6.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "36c2125805007768c5ba524b4df006a8", "sha256": "0c63b7e50ef76fa26d7c26d20b55859f8b7e458576e40727b20353fa337af512" }, "downloads": -1, "filename": "rsa_archer-0.1.7.tar.gz", "has_sig": false, "md5_digest": "36c2125805007768c5ba524b4df006a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13643, "upload_time": "2019-08-30T05:37:06", "upload_time_iso_8601": "2019-08-30T05:37:06.114585Z", "url": "https://files.pythonhosted.org/packages/2b/37/6a7160f06f340485935eeebb798e651ada1c4ddbc0fb09f1e670ac2b8786/rsa_archer-0.1.7.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "b15078ebd8bf15cf1f7b135b8a325696", "sha256": "06833ec4fa548c8079f0a26fd930b84ce37b4774418c4ea4c64264e4f38bcead" }, "downloads": -1, "filename": "rsa_archer-0.1.8.tar.gz", "has_sig": false, "md5_digest": "b15078ebd8bf15cf1f7b135b8a325696", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13771, "upload_time": "2019-10-31T00:38:54", "upload_time_iso_8601": "2019-10-31T00:38:54.509074Z", "url": "https://files.pythonhosted.org/packages/6f/4a/a050e110843d7bd2ca96f7813e37114036ae1f2605f0e56b3205bcc48655/rsa_archer-0.1.8.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.9": [ { "comment_text": "", "digests": { "md5": "ac03fddef53432d814407bae06cb996f", "sha256": "1baecf4ce104aaef22b6833c7db09bdb8a3ef24ba3c210a882109fec4080315e" }, "downloads": -1, "filename": "rsa_archer-0.1.9.tar.gz", "has_sig": false, "md5_digest": "ac03fddef53432d814407bae06cb996f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14255, "upload_time": "2019-12-13T04:12:38", "upload_time_iso_8601": "2019-12-13T04:12:38.147050Z", "url": "https://files.pythonhosted.org/packages/9a/b0/d2d38b92accb193a586e9d62390edec706cb9a7d88c53b32c11b118c36bd/rsa_archer-0.1.9.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ac03fddef53432d814407bae06cb996f", "sha256": "1baecf4ce104aaef22b6833c7db09bdb8a3ef24ba3c210a882109fec4080315e" }, "downloads": -1, "filename": "rsa_archer-0.1.9.tar.gz", "has_sig": false, "md5_digest": "ac03fddef53432d814407bae06cb996f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14255, "upload_time": "2019-12-13T04:12:38", "upload_time_iso_8601": "2019-12-13T04:12:38.147050Z", "url": "https://files.pythonhosted.org/packages/9a/b0/d2d38b92accb193a586e9d62390edec706cb9a7d88c53b32c11b118c36bd/rsa_archer-0.1.9.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }