{"id":21222069,"url":"https://github.com/mrthearman/dynamics-client","last_synced_at":"2025-09-05T16:14:22.657Z","repository":{"id":57424792,"uuid":"365815198","full_name":"MrThearMan/dynamics-client","owner":"MrThearMan","description":"Client for making Web API request from a Microsoft Dynamics 365 Database","archived":false,"fork":false,"pushed_at":"2025-07-07T23:44:55.000Z","size":3925,"stargazers_count":11,"open_issues_count":1,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-08T01:49:57.139Z","etag":null,"topics":["dynamics","dynamics-365","dynamics-crm","odata","python","webapi"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/dynamics-client/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MrThearMan.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"zenodo":null}},"created_at":"2021-05-09T17:53:52.000Z","updated_at":"2025-07-07T23:44:58.000Z","dependencies_parsed_at":"2023-01-30T00:30:26.358Z","dependency_job_id":"aec03a0d-42fe-4b82-b097-019a26642e73","html_url":"https://github.com/MrThearMan/dynamics-client","commit_stats":{"total_commits":88,"total_committers":3,"mean_commits":"29.333333333333332","dds":0.3522727272727273,"last_synced_commit":"150baac9a21774516355f94fcbf9c3931c1ec9b6"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/MrThearMan/dynamics-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrThearMan%2Fdynamics-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrThearMan%2Fdynamics-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrThearMan%2Fdynamics-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrThearMan%2Fdynamics-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrThearMan","download_url":"https://codeload.github.com/MrThearMan/dynamics-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrThearMan%2Fdynamics-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264585372,"owners_count":23632647,"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":["dynamics","dynamics-365","dynamics-crm","odata","python","webapi"],"created_at":"2024-11-20T22:39:25.516Z","updated_at":"2025-07-10T13:33:07.087Z","avatar_url":"https://github.com/MrThearMan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dynamics Web API Client\n\n[![Coverage Status][coverage-badge]][coverage]\n[![GitHub Workflow Status][status-badge]][status]\n[![PyPI][pypi-badge]][pypi]\n[![GitHub][licence-badge]][licence]\n[![GitHub Last Commit][repo-badge]][repo]\n[![GitHub Issues][issues-badge]][issues]\n[![Downloads][downloads-badge]][pypi]\n[![Python Version][version-badge]][pypi]\n\n```shell\npip install dynamics-client\n```\n\n---\n\n**Documentation**: [https://mrthearman.github.io/dynamics-client/](https://mrthearman.github.io/dynamics-client/)\n\n**Source Code**: [https://github.com/MrThearMan/dynamics-client/](https://github.com/MrThearMan/dynamics-client/)\n\n**Contributing**: [https://github.com/MrThearMan/dynamics-client/blob/main/CONTRIBUTING.md](https://github.com/MrThearMan/dynamics-client/blob/main/CONTRIBUTING.md)\n\n---\n\nClient for making Web API request from a Microsoft Dynamics 365 Database.\n\nYou should also read the [Dynamics Web API Reference Docs][ref-docs]:\n\n\n## Basic usage:\n\n```python\nfrom dynamics import DynamicsClient, ftr\n\n# Init the client:\nclient = DynamicsClient(...)\n\n### Example GET request:\n\nclient.table = \"accounts\"\n\n# Get only these columns for the account.\nclient.select = [\"accountid\", \"name\"]\n\n# Filter to only the accounts that have been created on or after the\n# given ISO date string, AND that have 200 or more employees.\nclient.filter = [\n    ftr.on_or_after(\"createdon\", \"2020-01-01T00:00:00Z\"),\n    ftr.ge(\"numberofemployees\", 200),\n]\n\n# Expand to the contacts (collection-values navigation property)\n# on the account that have 'gmail.com' in their email address 1 OR 2.\n# Get only the 'firstname', 'lastname' and 'mobilephone' columns for these contacts.\n# Also expand the primary contact (single-valued navigation property).\n# Get only the 'emailaddress1' column for the primary contact.\nclient.expand = {\n    \"contact_customer_accounts\": {\n        \"select\": [\"firstname\", \"lastname\", \"mobilephone\"],\n        \"filter\": {\n            ftr.contains(\"emailaddress1\", \"gmail.com\"),\n            ftr.contains(\"emailaddress2\", \"gmail.com\"),\n        }\n    },\n    \"primarycontactid\": {\n        \"select\": [\"emailaddress1\"],\n    },\n}\n\nresult = client.get()\n\nprint(result.data)\n# [\n#     {\n#         \"accountid\": ...,\n#         \"name\": ...,\n#         \"contact_customer_accounts\": [\n#             {\n#                 \"contactid\": ...,  # id field is always given\n#                 \"firstname\": ...,\n#                 \"lastname\": ...,\n#                 \"mobilephone\": ...\n#             },\n#             ...\n#         ],\n#         \"primarycontactid\": {\n#             \"contactid\": ...,\n#             \"emailaddress1\": ...\n#         }\n#     },\n#     ...\n# ]\n\n### Example POST request\n\n# IMPORTANT!!!\nclient.reset_query()\n\nclient.table = \"contacts\"\n\n# Get only these columns from the created contact\nclient.select = [\"firstname\", \"lastname\", \"emailaddress1\"]\n\n# The data to create the contact with. '@odata.bind' is used to link\n# the contact to the given navigation property.\naccountid = ...\ndata = {\n    \"firstname\": ...,\n    \"lastname\": ...,\n    \"emailaddress1\": ...,\n    \"parentcustomerid_account@odata.bind\": f\"/accounts({accountid})\"\n}\n\nresult = client.post(data=data)\n\nprint(result.data)\n# {\n#     \"contactid\": ...,\n#     \"firstname\": ...,\n#     \"lastname\": ...,\n#     \"emailaddress1\": ...\n# }\n\n\n### Example PATCH request\n\nclient.reset_query()\n\nclient.table = \"contacts\"\nclient.row_id = result[\"contactid\"]\n\ndata = {\n    \"firstname\": ...,\n    \"lastname\": ...,\n}\n\nresult = client.patch(data=data)\n\nprint(result.data)\n# Return all rows on the updated contact,\n# since no select statement was given\n#\n# {\n#     ...\n#     \"contactid\": ...,\n#     \"firstname\": ...,\n#     \"lastname\": ...,\n#     ...\n# }\n\n\n### Example DELETE request\n\nclient.reset_query()\n\nclient.table = \"contacts\"\nclient.row_id = result[\"contactid\"]\n\nclient.delete()\n```\n\n\n[ref-docs]: https://docs.microsoft.com/en-us/powerapps/developer/data-platform/webapi/query-data-web-api\n\n[coverage-badge]: https://coveralls.io/repos/github/MrThearMan/dynamics-client/badge.svg?branch=main\n[status-badge]: https://img.shields.io/github/actions/workflow/status/MrThearMan/dynamics-client/test.yml?branch=main\n[pypi-badge]: https://img.shields.io/pypi/v/dynamics-client\n[licence-badge]: https://img.shields.io/github/license/MrThearMan/dynamics-client\n[repo-badge]: https://img.shields.io/github/last-commit/MrThearMan/dynamics-client\n[issues-badge]: https://img.shields.io/github/issues-raw/MrThearMan/dynamics-client\n[version-badge]: https://img.shields.io/pypi/pyversions/dynamics-client\n[downloads-badge]: https://img.shields.io/pypi/dm/dynamics-client\n\n[coverage]: https://coveralls.io/github/MrThearMan/dynamics-client?branch=main\n[status]: https://github.com/MrThearMan/dynamics-client/actions/workflows/test.yml\n[pypi]: https://pypi.org/project/dynamics-client\n[licence]: https://github.com/MrThearMan/dynamics-client/blob/main/LICENSE\n[repo]: https://github.com/MrThearMan/dynamics-client/commits/main\n[issues]: https://github.com/MrThearMan/dynamics-client/issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrthearman%2Fdynamics-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrthearman%2Fdynamics-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrthearman%2Fdynamics-client/lists"}