{"kind":"AgentDefinition","metadata":{"namespace":"community","name":"dataverse-python-api-reference","version":"0.1.0"},"spec":{"agents_md":"---\napplyTo: '**'\n---\n# Dataverse SDK for Python — API Reference Guide\n\n## DataverseClient Class\nMain client for interacting with Dataverse. Initialize with base URL and Azure credentials.\n\n### Key Methods\n\n#### create(table_schema_name, records)\nCreate single or bulk records. Returns list of GUIDs.\n\n```python\n# Single record\nids = client.create(\"account\", {\"name\": \"Acme\"})\nprint(ids[0])  # First GUID\n\n# Bulk create\nids = client.create(\"account\", [{\"name\": \"Contoso\"}, {\"name\": \"Fabrikam\"}])\n```\n\n#### get(table_schema_name, record_id=None, select, filter, orderby, top, expand, page_size)\nFetch single record or query multiple with OData options.\n\n```python\n# Single record\nrecord = client.get(\"account\", record_id=\"guid-here\")\n\n# Query with filter and paging\nfor batch in client.get(\n    \"account\",\n    filter=\"statecode eq 0\",\n    select=[\"name\", \"telephone1\"],\n    orderby=[\"createdon desc\"],\n    top=100,\n    page_size=50\n):\n    for record in batch:\n        print(record[\"name\"])\n```\n\n#### update(table_schema_name, ids, changes)\nUpdate single or bulk records.\n\n```python\n# Single update\nclient.update(\"account\", \"guid-here\", {\"telephone1\": \"555-0100\"})\n\n# Broadcast: apply same changes to many IDs\nclient.update(\"account\", [id1, id2, id3], {\"statecode\": 1})\n\n# Paired: one-to-one mapping\nclient.update(\"account\", [id1, id2], [{\"name\": \"A\"}, {\"name\": \"B\"}])\n```\n\n#### delete(table_schema_name, ids, use_bulk_delete=True)\nDelete single or bulk records.\n\n```python\n# Single delete\nclient.delete(\"account\", \"guid-here\")\n\n# Bulk delete (async)\njob_id = client.delete(\"account\", [id1, id2, id3])\n```\n\n#### create_table(table_schema_name, columns, solution_unique_name=None, primary_column_schema_name=None)\nCreate custom table.\n\n```python\nfrom enum import IntEnum\n\nclass ItemStatus(IntEnum):\n    ACTIVE = 1\n    INACTIVE = 2\n    __labels__ = {\n        1033: {\"ACTIVE\": \"Active\", \"INACTIVE\": \"Inactive\"}\n    }\n\ninfo = client.create_table(\"new_MyTable\", {\n    \"new_Title\": \"string\",\n    \"new_Quantity\": \"int\",\n    \"new_Price\": \"decimal\",\n    \"new_Active\": \"bool\",\n    \"new_Status\": ItemStatus\n})\nprint(info[\"entity_logical_name\"])\n```\n\n#### create_columns(table_schema_name, columns)\nAdd columns to existing table.\n\n```python\ncreated = client.create_columns(\"new_MyTable\", {\n    \"new_Notes\": \"string\",\n    \"new_Count\": \"int\"\n})\n```\n\n#### delete_columns(table_schema_name, columns)\nRemove columns from table.\n\n```python\nremoved = client.delete_columns(\"new_MyTable\", [\"new_Notes\", \"new_Count\"])\n```\n\n#### delete_table(table_schema_name)\nDelete custom table (irreversible).\n\n```python\nclient.delete_table(\"new_MyTable\")\n```\n\n#### get_table_info(table_schema_name)\nRetrieve table metadata.\n\n```python\ninfo = client.get_table_info(\"new_MyTable\")\nif info:\n    print(info[\"table_logical_name\"])\n    print(info[\"entity_set_name\"])\n```\n\n#### list_tables()\nList all custom tables.\n\n```python\ntables = client.list_tables()\nfor table in tables:\n    print(table)\n```\n\n#### flush_cache(kind)\nClear SDK caches (e.g., picklist labels).\n\n```python\nremoved = client.flush_cache(\"picklist\")\n```\n\n## DataverseConfig Class\nConfigure client behavior (timeouts, retries, language).\n\n```python\nfrom PowerPlatform.Dataverse.core.config import DataverseConfig\n\ncfg = DataverseConfig()\ncfg.http_retries = 3\ncfg.http_backoff = 1.0\ncfg.http_timeout = 30\ncfg.language_code = 1033  # English\n\nclient = DataverseClient(base_url=url, credential=cred, config=cfg)\n```\n\n## Error Handling\nCatch `DataverseError` for SDK-specific exceptions. Check `is_transient` to decide retry.\n\n```python\nfrom PowerPlatform.Dataverse.core.errors import DataverseError\n\ntry:\n    client.create(\"account\", {\"name\": \"Test\"})\nexcept DataverseError as e:\n    print(f\"Code: {e.code}\")\n    print(f\"Message: {e.message}\")\n    print(f\"Transient: {e.is_transient}\")\n    print(f\"Details: {e.to_dict()}\")\n```\n\n## OData Filter Tips\n- Use exact logical names (lowercase) in filter expressions\n- Column names in `select` are auto-lowercased\n- Navigation property names in `expand` are case-sensitive\n\n## References\n- API docs: https://learn.microsoft.com/en-us/python/api/powerplatform-dataverse-client/powerplatform.dataverse.client.dataverseclient\n- Config docs: https://learn.microsoft.com/en-us/python/api/powerplatform-dataverse-client/powerplatform.dataverse.core.config.dataverseconfig\n- Errors: https://learn.microsoft.com/en-us/python/api/powerplatform-dataverse-client/powerplatform.dataverse.core.errors\n","description":"Main client for interacting with Dataverse. Initialize with base URL and Azure credentials.","import":{"commit_sha":"541b7819d8c3545c6df122491af4fa1eae415779","imported_at":"2026-05-18T20:05:35Z","license_text":"MIT License\n\nCopyright GitHub, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.","owner":"github","repo":"github/awesome-copilot","source_url":"https://github.com/github/awesome-copilot/blob/541b7819d8c3545c6df122491af4fa1eae415779/instructions/dataverse-python-api-reference.instructions.md"},"manifest":{}},"content_hash":[36,64,254,67,101,8,179,227,98,162,73,238,116,21,125,252,23,205,175,17,198,73,172,153,20,129,145,100,34,19,79,230],"trust_level":"unsigned","yanked":false}
