{"id":22452870,"url":"https://github.com/fasteiner/xurrent-python","last_synced_at":"2025-10-16T07:30:56.187Z","repository":{"id":266676898,"uuid":"899014336","full_name":"fasteiner/xurrent-python","owner":"fasteiner","description":"A Python Module for interacting with Xurrent","archived":false,"fork":false,"pushed_at":"2025-01-08T20:22:53.000Z","size":105,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-08T20:38:53.250Z","etag":null,"topics":["4me","python-module","python3","xurrent"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fasteiner.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":"Contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-05T13:14:05.000Z","updated_at":"2025-01-08T20:22:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"15308663-2cb8-4c51-b404-934f4b87579e","html_url":"https://github.com/fasteiner/xurrent-python","commit_stats":null,"previous_names":["fasteiner/xurrent-python"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fasteiner%2Fxurrent-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fasteiner%2Fxurrent-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fasteiner%2Fxurrent-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fasteiner%2Fxurrent-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fasteiner","download_url":"https://codeload.github.com/fasteiner/xurrent-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236692743,"owners_count":19189765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["4me","python-module","python3","xurrent"],"created_at":"2024-12-06T06:13:39.767Z","updated_at":"2025-10-16T07:30:56.181Z","avatar_url":"https://github.com/fasteiner.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Xurrent Module\n\n[![PyPI version](https://img.shields.io/pypi/v/xurrent)](https://pypi.org/project/xurrent/)\n[![Downloads](https://img.shields.io/pypi/dm/xurrent)](https://pypistats.org/packages/xurrent)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\n\nThis module is used to interact with the Xurrent API. It provides a set of classes to interact with the API.\n\n## Change Log\n\n[ChangeLog.md](https://github.com/fasteiner/xurrent-python/blob/main/CHANGELOG.md)\n\n## Contributing\n\n[Contributing.md](Contributing.md)\n\n## Usage\n\n### Basic Usage\n\n```python\n    from xurrent.core import XurrentApiHelper\n\n    apitoken = \"********\"\n\n    baseUrl = \"https://api.xurrent.qa/v1\"\n    account = \"account-name\"\n\n    x_api_helper = XurrentApiHelper(baseUrl, apitoken, account)\n\n    # change log level (default: INFO)\n    x_api_helper.set_log_level(\"DEBUG\")\n\n    # Plain API Call\n    uri = \"/requests?subject=Example Subject\"\n    x_api_helper.api_call(uri, 'GET')\n\n    # Convert node ID\n    x_api_helper.decode_api_id('ZmFiaWFuc3RlaW5lci4yNDEyMTAxMDE0MTJANG1lLWRlbW8uY29tL1JlcS83MDU3NTU') # fabiansteiner.241210101412@4me-demo.com/Req/705755\n    # this can be used to derive the ID from the nodeID\n```\n\n#### Configuration Items\n\n```python\n    # Example usage of ConfigurationItem class\n    from xurrent.configuration_items import ConfigurationItem\n    \n    # Get a Configuration Item by ID\n    ci = ConfigurationItem.get_by_id(x_api_helper, \u003cid\u003e)\n    print(ci)\n\n    # List all Configuration Items\n    all_cis = ConfigurationItem.get_configuration_items(x_api_helper)\n    print(all_cis)\n\n    # List active Configuration Items\n    active_cis = ConfigurationItem.get_configuration_items(x_api_helper, predefinedFilter=\"active\")\n    print(active_cis)\n\n    # Update a Configuration Item\n    updated_ci = ci.update({\"name\": \"Updated Name\", \"status\": \"being_repaired\"})\n    print(updated_ci)\n\n    # Create a new Configuration Item\n    # creating without specifying the label, takes the last ci of the product and increments the label\n    # example: \"wdc-02\" -\u003e \"wdc-03\"\n    data = {\"name\": \"New CI\", \"type\": \"software\", \"status\": \"in_production\", \"product_id\": \"\u003cproduct_id\u003e\"}\n    new_ci = ConfigurationItem.create(x_api_helper, data)\n    print(new_ci)\n\n    # Archive a Configuration Item (must be in an allowed state)\n    try:\n        archived_ci = ci.archive()\n        print(archived_ci)\n    except ValueError as e:\n        print(f\"Error: {e}\")\n\n    # Trash a Configuration Item (must be in an allowed state)\n    try:\n        trashed_ci = ci.trash()\n        print(trashed_ci)\n    except ValueError as e:\n        print(f\"Error: {e}\")\n\n    # Restore a Configuration Item\n    restored_ci = ci.restore()\n    print(restored_ci)\n```\n\n#### People\n\n```python\n    from xurrent.people import Person\n\n    people = Person.get_by_id(x_api_helper, \u003cid\u003e)\n\n    api_user = Person.get_me(x_api_helper)\n\n    # get all people with a specific subject\n    people = Person.get_people(x_api_helper,queryfilter={\n    \"name\": \"Werner\"\n    })\n\n    # enable\n    people.enable()\n\n    #disable\n    people.disable()\n    #archive\n    people.archive()\n    #trash\n    people.trash()\n    #restore\n    people.restore()\n```\n\n#### Requests\n\n```python\n    from xurrent.requests import Request\n\n    request = Request.get_by_id(x_api_helper, \u003cid\u003e)\n\n    # get all requests with a specific subject\n    requests = Request.get_request(x_api_helper,queryfilter={\n    \"subject\": \"Example Subject\"\n    })\n\n    # close\n    request.close(\"closed\")\n\n    # archive\n    request.archive()\n\n    #trash\n    request.trash()\n\n    #restore\n\n    request.restore()\n\n```\n\n##### Request Configuration Items\n\n```python\n    from src.xurrent.requests import Request\n\n    # Get Configuration Items for a Request\n    request_id = \u003crequest_id\u003e\n\n\n    # Add a Configuration Item to a Request\n    ci_id = \u003cci_id\u003e\n    try:\n        response = Request.add_ci_to_request_by_id(x_api_helper, request_id, ci_id)\n        print(\"CI added:\", response)\n    except ValueError as e:\n        print(f\"Error: {e}\")\n\n    cis = Request.get_cis_by_request_id(x_api_helper, request_id)\n    print(cis)\n\n    # Remove a Configuration Item from a Request\n    try:\n        response = Request.remove_ci_from_request_by_id(x_api_helper, request_id, ci_id)\n        print(\"CI removed:\", response)\n    except ValueError as e:\n        print(f\"Error: {e}\")\n\n    # Instance-based example\n    req = Request.get_by_id(x_api_helper, request_id)\n\n    # Add a CI to this request\n    try:\n        response = req.add_ci(ci_id)\n        print(\"CI added:\", response)\n    except ValueError as e:\n        print(f\"Error: {e}\")\n\n    # Get CIs for this request\n    cis_instance = req.get_cis()\n    print(cis_instance)\n\n    # Remove a CI from this request\n    try:\n        response = req.remove_ci(ci_id)\n        print(\"CI removed:\", response)\n    except ValueError as e:\n        print(f\"Error: {e}\")\n```\t\n\n##### Request Notes\n\n```python\n    from xurrent.requests import Request\n    \n    request = Request.get_by_id(x_api_helper, \u003cid\u003e)\n\n    request_note = request.get_by_id(x_api_helper, \u003cid\u003e)\n\n    # get all request notes with a specific subject\n    request_notes = request.get_notes(x_api_helper, predefinedFilter=\"public\")\n\n    request.add_note(\"This is a test note\")\n    request.add_note({\n        \"text\": \"This is a test note\",\n        \"internal\": True\n    })\n```\n\n#### Tasks\n\n```python\n    from xurrent.tasks import Task\n\n    task = Task.get_by_id(x_api_helper, \u003cid\u003e)\n\n    # get all tasks with a specific subject\n    tasks = Task.get_task(x_api_helper,queryfilter={\n    \"subject\": \"Example Subject\"\n    })\n\n    # get workflow of task (use expand: True to get the full workflow object)\n    workflow = task.get_workflow(expand=True)\n    # or statically\n    workflow = Task.get_workflow_by_template_id(x_api_helper, \u003cid\u003e, expand=True)\n\n    # close\n    task.close()\n    #cancel\n    task.cancel() # only possible before the task is started\n    #reject\n    task.reject()\n    #approve\n    task.approve()\n```\n\n#### Teams\n\n```python\n    from xurrent.teams import Team\n\n    team = Team.get_by_id(x_api_helper, \u003cid\u003e)\n\n    # get all teams with a specific subject\n    teams = Team.get_team(x_api_helper,predifinedFilter=\"enabled\")\n\n    # enable\n    team.enable()\n\n    #disable\n    team.disable()\n    #archive\n    team.archive()\n    #trash\n    team.trash()\n    #restore\n    team.restore()\n\n```\n\n#### Workflows\n\n```python\n    from xurrent.workflows import Workflow\n\n    workflow = Workflow.get_by_id(x_api_helper, \u003cid\u003e)\n\n    #close\n    workflow.close() # completion reason: completed, note: closed\n    # close with completion reason\n    workflow.close(completion_reason=\"withdrawn\")\n    #close with completion reason and note\n    workflow.close(completion_reason=\"withdrawn\", note=\"This is a test note\")\n\n```\n\n### Bulk Export\n```python\n    import csv\n    import io\n\n    #Request a bulk export of \"people\"\n    csvdata = x_api_helper.bulk_export(\"people\")\n\n    #Iterate fetched export rows with the csv library, where row 1 defines the column names\n    for row in csv.DictReader(io.StringIO(csvdata)):\n        print(row[\"Employee Number\"])\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffasteiner%2Fxurrent-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffasteiner%2Fxurrent-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffasteiner%2Fxurrent-python/lists"}