{"id":22663424,"url":"https://github.com/stevanfreeborn/onspring-api-sdk-python","last_synced_at":"2026-01-31T20:39:00.750Z","repository":{"id":53855095,"uuid":"481809971","full_name":"StevanFreeborn/onspring-api-sdk-python","owner":"StevanFreeborn","description":"A python SDK for interacting with version 2 of the Onspring API.","archived":false,"fork":false,"pushed_at":"2024-12-19T16:48:26.000Z","size":93,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T15:14:20.540Z","etag":null,"topics":["api","onspring","python","sdk"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/OnspringApiSdk/","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/StevanFreeborn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2022-04-15T02:18:55.000Z","updated_at":"2024-12-19T16:48:30.000Z","dependencies_parsed_at":"2024-12-19T00:26:30.723Z","dependency_job_id":"b36bf674-ed73-4739-8787-f13cf31251ba","html_url":"https://github.com/StevanFreeborn/onspring-api-sdk-python","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/StevanFreeborn/onspring-api-sdk-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevanFreeborn%2Fonspring-api-sdk-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevanFreeborn%2Fonspring-api-sdk-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevanFreeborn%2Fonspring-api-sdk-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevanFreeborn%2Fonspring-api-sdk-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StevanFreeborn","download_url":"https://codeload.github.com/StevanFreeborn/onspring-api-sdk-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevanFreeborn%2Fonspring-api-sdk-python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260336343,"owners_count":22993740,"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":["api","onspring","python","sdk"],"created_at":"2024-12-09T12:19:10.357Z","updated_at":"2026-01-31T20:39:00.702Z","avatar_url":"https://github.com/StevanFreeborn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Onspring API Python SDK\n\nThe python SDK for **version 2** of the Onspring API is meant to simplify development in Python for Onspring customers who want to build integrations with their Onspring instance.\n\n**Note:**\nThis is an unofficial SDK for the Onspring API. It was not built in consultation with Onspring Technologies LLC or a member of their development team.\n\nThis SDK was developed independently using their existing C# SDK, their swagger page, and api documentation as the starting point with the intention of making development of integrations done in Python with an Onspring instance quicker and more convenient.\n\n## Dependencies\n\n### Python\n\nRequires use of Python 3.10.0 or later.\n\n### Requests\n\nAll methods for the `OnspringClient` make use of the [Requests](https://docs.python-requests.org/en/latest/) library to interact with the endpoints of version 2 of the Onspring API.\n\n## Installation\n\nInstall the SDK using pip:\n\n`pip install OnspringApiSdk`\n\n## API Key\n\nIn order to successfully interact with the Onspring Api you will need an API key. API keys are obtained by an Onspring user with permissions to at least **Read** API Keys for your instance via the following steps:\n\n1. Login to the Onspring instance.\n2. Navigate to **Administration** \u003e **Security** \u003e **API Keys**\n3. On the list page, add a new API Key - this will require **Create** permissions - or click an existing API key to view its details.\n4. Click on the **Developer Information** tab.\n5. Copy the **X-ApiKey Header** value from this tab.\n\n## Start Coding\n\n### `OnspringClient`\n\nThe most common way to use the SDK is to create an `OnspringClient` instance and call its methods. Its constructor requires two parameters:\n\n- `baseUrl` - currently this should always be: `https://api.onspring.com`\n- `apiKey` - the value obtained by following the steps in the **API Key** section\n\nIt is best practice to read these values in from a configuration file for both flexibility and security purposes.\n\nExample `config.ini` file:\n\n```ini\n[prod]\nkey = 000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000\nurl = https://api.onspring.com\n```\n\nExample constructing `OnspringClient`:\n\n```python\nfrom OnspringApiSdk.OnspringClient import OnspringClient\nfrom configparser import ConfigParser\n\ncfg = ConfigParser()\ncfg.read('config.ini')\n\nkey = cfg['prod']['key']\nurl = cfg['prod']['url']\n\nclient = OnspringClient(url, key)\n```\n\n### `ApiResponse`\n\nEach `OnspringClient` method - aside from `CanConnect` - returns an `ApiResponse` object which will have the following properties:\n\n- `statusCode` - The http status code of the response.\n- `data` - If the request was successful will contain the response data deserialized to custom python objects.\n- `message` - A message that may provide more detail about the requests success or failure.\n- `raw` - Exposes the raw response object of the request if you'd like to handle it directly.\n\nThe goal with this `ApiResponse` object is to provide the flexibility to do with the response what you'd like as well as already having the raw JSON response deserialized to python objects.\n\nIf you do want to handle and/or manipulate the response object yourself you will want to use the value of the `ApiResponse`'s `raw` property which will be a [`Response`](https://docs.python-requests.org/en/latest/user/advanced/#request-and-response-objects) object from the [Requests](https://docs.python-requests.org/en/latest/) library.\n\n## Full API Documentation\n\nYou may wish to refer to the full [Onspring API documentation](https://software.onspring.com/hubfs/Training/Admin%20Guide%20-%20v2%20API.pdf) when determining which values to pass as parameters to some of the `OnspringClient` methods. There is also a [swagger page](https://api.onspring.com/swagger/index.html) that you can use for making exploratory requests.\n\n## Example Code\n\nThe examples that follow assume you have created an `OnspringClient` as described in the **Start Coding** section.\n\n### Connectivity\n\n#### Verify connectivity\n\n```python\ncanConnect = client.CanConnect()\n\nif canConnect:\n    print('Connected successfully')\nelse:\n    print('Attempt to connect failed')\n```\n\n### Apps\n\n#### Get Apps\n\nReturns a paged collection of apps and/or surveys that can be paged through. By default the page size is 50 and page number is 1.\n\n```python\nresponse = client.GetApps()\n  \nprint(f'Status Code: {response.statusCode}')\nprint(f'Page Size: {response.data.pageSize}')\nprint(f'Page Number: {response.data.pageNumber}')\nprint(f'Total Pages: {response.data.totalPages}')\nprint(f'Total Records: {response.data.totalRecords}')\n\nfor app in response.data.apps:\n    print(f'Id: {app.id}')\n    print(f'Name: {app.name}')\n    print(f'href: {app.href}')\n```\n\nYou can set your own page size and page number (max is 1,000) as well.\n\n```python\nfrom OnspringApiSdk.Models import PagingRequest\n\npagingRequest = PagingRequest(1, 100)\nresponse = client.GetApps(pagingRequest)\n  \nprint(f'Status Code: {response.statusCode}')\nprint(f'Page Size: {response.data.pageSize}')\nprint(f'Page Number: {response.data.pageNumber}')\nprint(f'Total Pages: {response.data.totalPages}')\nprint(f'Total Records: {response.data.totalRecords}')\n\nfor app in response.data.apps:\n    print(f'Id: {app.id}')\n    print(f'Name: {app.name}')\n    print(f'href: {app.href}')\n```\n\n#### Get App By Id\n\nReturns an Onspring app or survey according to provided id.\n\n```python\nresponse = client.GetAppById(appId=195)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'id: {response.data.app.id}')\nprint(f'Name: {response.data.app.name}')\nprint(f'href: {response.data.app.href}')\n```\n\n#### Get Apps By Ids\n\nReturns a collection of Onspring apps and/or surveys according to provided ids.\n\n```python\nresponse = client.GetAppsByIds(appIds=[195, 240])\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Count: {response.data.count}')\n\nfor app in response.data.apps:\n    print(f'Id: {app.id}')\n    print(f'Name: {app.name}')\n    print(f'href: {app.href}')\n```\n\n### Fields\n\n#### Helpers\n\nExample `PrintField` method referenced in following examples.\n\n```python\ndef PrintField(field: Field):\n    \n    print('Field:')\n    print(f' Id: {field.id}')\n    print(f' App Id: {field.appId}')\n    print(f' Name: {field.name}')\n    print(f' Type: {field.type}')\n    print(f' Status: {field.status}')\n    print(f' IsRequired: {field.isRequired}')\n    print(f' IsUnique: {field.isUnique}')\n\n    if field.type == 'Formula':\n\n        print(f' Output Type: {field.outputType}')\n\n        if field.outputType == 'ListValue':\n\n            print(f' Multiplicity: {field.multiplicity}')\n            print(' Values:')\n\n            for value in field.values:\n\n                print(f'  {value.AsString()}')\n\n    if field.type == 'List':\n\n        print(f' Multiplicity: {field.multiplicity}')\n        print(' Values:')\n\n        for value in field.values:\n\n            print(f'  {value.AsString()}')\n```\n\n#### Get Field By Id\n\nReturns an Onspring field according to provided id.\n\n```python\nresponse = client.GetFieldById(fieldId=9686)\n\nprint(f'Status Code: {response.statusCode}')\nPrintField(response.data.field)\n```\n\n#### Get Fields By Ids\n\nReturns a collection of Onspring fields according to provided ids.\n\n```python\nresponse = client.GetFieldsByIds(fieldIds=[9686, 9687])\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Count: {response.data.count}')\n\nfor field in response.data.fields:\n    PrintField(field)\n```\n\n#### Get Fields By App Id\n\nReturns a paged collection of fields that can be paged through. By default the page size is 50 and page number is 1.\n\n```python\nresponse = client.GetFieldsByAppId(appId=195)\n    \n    print(f'Status Code: {response.statusCode}')\n    print(f'Page Size: {response.data.pageSize}')\n    print(f'Page Number: {response.data.pageNumber}')\n    print(f'Total Pages: {response.data.totalPages}')\n    print(f'Total Records: {response.data.totalRecords}')\n\n    for field in response.data.fields:\n        PrintField(field)\n```\n\nYou can set your own page size and page number (max is 1,000) as well.\n\n```python\nfrom OnspringApiSdk.Models import PagingRequest\n\npagingRequest = PagingRequest(1, 100)\n\nresponse = client.GetFieldsByAppId(appId=195, pagingRequest)\n    \n    print(f'Status Code: {response.statusCode}')\n    print(f'Page Size: {response.data.pageSize}')\n    print(f'Page Number: {response.data.pageNumber}')\n    print(f'Total Pages: {response.data.totalPages}')\n    print(f'Total Records: {response.data.totalRecords}')\n\n    for field in response.data.fields:\n        PrintField(field)\n```\n\n### Files\n\n#### Get File Info By Id\n\nReturns the Onspring file's metadata.\n\n```python\nresponse = client.GetFileInfoById(recordId=1, fieldId=6990, fileId=274)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Name: {response.data.fileInfo.name}')\nprint(f'Type: {response.data.fileInfo.type}')\nprint(f'Owner: {response.data.fileInfo.owner}')\nprint(f'Content Type: {response.data.fileInfo.contentType}')\nprint(f'Created Date: {response.data.fileInfo.createdDate}')\nprint(f'Modified Date: {response.data.fileInfo.modifiedDate}')\nprint(f'File Href: {response.data.fileInfo.fileHref}')\n```\n\n#### Get File By Id\n\nReturns the file itself.\n\n```python\nresponse = client.GetFileById(recordId=1, fieldId=6990, fileId=274)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Name: {response.data.file.name}')\nprint(f'Content Type: {response.data.file.contentType}')\nprint(f'Content Length: {response.data.file.contentLength}')\n\nfilePath = f'C:\\\\Users\\\\sfree\\\\Documents\\\\Temp\\\\{response.data.file.name}'\n\nwith open(filePath, \"wb\") as file:\n    \n    file.write(response.data.file.content)\n\nprint(f'File Location: {filePath}')\n```\n\n#### Save File\n\n```python\nfrom OnspringApiSdk.Models import SaveFileRequest\nimport os\nimport mimetypes\n\nfilePath = 'C:\\\\Users\\\\sfree\\\\Documents\\\\Temp\\\\Test Attachment.txt'\nfileName = os.path.basename(filePath)\ncontentType = mimetypes.guess_type(filePath)[0]\n\nrequest = SaveFileRequest(\n    recordId=60, \n    fieldId=6989, \n    fileName,\n    filePath, \n    contentType, \n    notes='Initial revision',\n    modifiedDate=datetime.now())\n\nresponse = client.SaveFile(request)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'File Id: {response.data.id}')\n```\n\n#### Delete File By Id\n\n```python\nresponse = client.DeleteFileById(recordId=60, fieldId=6989, fileId=231)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Message: {response.message}')\n```\n\n### Lists\n\n#### Add Or Update List Value\n\nTo add a list value don't provide an id value.\n\n```python\nfrom OnspringApiSdk.Models import ListItemRequest\n\nrequest = ListItemRequest(\n        listId=906, \n        name='Not Started', \n        id='', \n        numericValue=0, \n        color='#ffffff')\n\nresponse = client.AddOrUpdateListItem(request)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Id: {response.data.id}')\n```\n\nTo update a list value provide an id value.\n\n```python\nfrom OnspringApiSdk.Models import ListItemRequest\n\nrequest = ListItemRequest(\n        listId=906, \n        name='Pending', \n        id='4118d53a-9121-4345-8682-07f23d606daa', \n        numericValue=0, \n        color='#ffffff')\n\nresponse = client.AddOrUpdateListItem(request)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Id: {response.data.id}')\n```\n\n#### Delete List Value\n\n```python\nresponse = client.DeleteListItem(listId=906, itemId='36f94d8c-2b9d-465e-9ad1-ede04109efc9')\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Message: {response.message}')\n```\n\n### Records\n\n#### Get Records By App Id\n\nReturns a paged colletion of records that can be paged through. By default the page size is 50 and page number is 1.\n\n```python\nrequest = GetRecordsByAppRequest(appId=195)\n\nresponse = client.GetRecordsByAppId(request)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Page Size: {response.data.pageSize}')\nprint(f'Page Number: {response.data.pageNumber}')\nprint(f'Total Pages: {response.data.totalPages}')\nprint(f'Total Records: {response.data.totalRecords}')\n\nfor record in response.data.records:\n    print(f'AppId: {record.appId}')\n    print(f'RecordId: {record.recordId}')\n\n    for field in record.fields:\n        print(f'Type: {field.type}')\n        print(f'FieldId: {field.fieldId}')\n        print(f'Value: {field.GetResultValueString()}')\n```\n\nYou can set your own page size and page number (max is 1,000) as well. In addition to specifying what field values to return and in what format (Raw vs. Formatted) to return them.\n\n```python\nfrom OnspringApiSdk.Models import PagingRequest, GetRecordsByAppRequest\nfrom OnspringApiSdk.Enums import DataFormat \n\npagingRequest = PagingRequest(1,10)\n\nrequest = GetRecordsByAppRequest(\n    appId=195,\n    fieldIds=[9686],\n    dataFormat=DataFormat.Formatted.name,\n    pagingRequest)\n\nresponse = client.GetRecordsByAppId(request)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Page Size: {response.data.pageSize}')\nprint(f'Page Number: {response.data.pageNumber}')\nprint(f'Total Pages: {response.data.totalPages}')\nprint(f'Total Records: {response.data.totalRecords}')\n\nfor record in response.data.records:\n    print(f'AppId: {record.appId}')\n    print(f'RecordId: {record.recordId}')\n\n    for field in record.fields:\n        print(f'Type: {field.type}')\n        print(f'FieldId: {field.fieldId}')\n        print(f'Value: {field.GetResultValueString()}')\n```\n\n#### Get Record By Id\n\nReturns an onspring record based on the provided app and record ids.\n\n```python\nfrom OnspringApiSdk.Models import GetRecordByIdRequest\n\nrequest = GetRecordByIdRequest(appId=195, recordId=60)\n\nresponse = client.GetRecordById(request)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'AppId: {response.data.appId}')\nprint(f'RecordId: {response.data.recordId}')\n\nfor field in response.data.fields:\n    print(f'Type: {field.type}')\n    print(f'FieldId: {field.fieldId}')\n    print(f'Value: {field.GetResultValueString()}')\n```\n\nYou can also specify what field values to return and in what format (Raw vs. Formatted) to return them.\n\n```python\nfrom OnspringApiSdk.Models import GetRecordByIdRequest\nfrom OnspringApiSdk.Enums import DataFormat\n\nrequest = GetRecordByIdRequest(\n    appId=195, \n    recordId=60,\n    fieldIds=[9686],\n    dataFormat=DataFormat.Formatted.name)\n\nresponse = client.GetRecordById(request)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'AppId: {response.data.appId}')\nprint(f'RecordId: {response.data.recordId}')\n\nfor field in response.data.fields:\n    print(f'Type: {field.type}')\n    print(f'FieldId: {field.fieldId}')\n    print(f'Value: {field.GetResultValueString()}')\n```\n\n#### Delete Record By Id\n\n```python\nresponse = client.DeleteRecordById(appId=195, recordId=60)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Message: {response.message}')\n```\n\n#### Get Records By Ids\n\nReturns a collection of Onspring records based on the provided appId and recordIds.\n\n```python\nfrom OnspringApiSdk.Models import GetBatchRecordsRequest\n\nrequest = GetBatchRecordsRequest(appId=195, recordIds=[1, 2, 3])\n\nresponse = client.GetRecordsByIds(request)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Count: {response.data.count}')\n\nfor record in response.data.records:\n    print(f'AppId: {record.appId}')\n    print(f'RecordId: {record.recordId}')\n\n    for field in record.fields:\n        print(f'Type: {field.type}')\n        print(f'FieldId: {field.fieldId}')\n        print(f'Value: {field.GetResultValueString()}')\n```\n\nYou can also specify what field values to return and in what format (Raw vs. Formatted) to return them.\n\n```python\nfrom OnspringApiSdk.Models import GetBatchRecordsRequest\nfrom OnspringApiSdk.Enums import DataFormat\n\nrequest = GetBatchRecordsRequest(\n    appId=195, \n    recordIds=[1, 2, 3],\n    fieldIds=[9686],\n    dataFormat=DataFormat.Formatted.name)\n\nresponse = client.GetRecordsByIds(request)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Count: {response.data.count}')\n\nfor record in response.data.records:\n    print(f'AppId: {record.appId}')\n    print(f'RecordId: {record.recordId}')\n\n    for field in record.fields:\n        print(f'Type: {field.type}')\n        print(f'FieldId: {field.fieldId}')\n        print(f'Value: {field.GetResultValueString()}')\n```\n\n#### Query Records\n\nReturns a paged colletion of records based on a criteria that can be paged through. By default the page size is 50 and page number is 1.\n\n```python\nfrom OnspringApiSdk.Models import QueryRecordsRequest\n\nfieldId = 6983\noperator = 'eq'\nvalue = '\\'Test Task 5\\''\n\nrequest = QueryRecordsRequest(appId=195, filter=f'{fieldId} {operator} {value}')\n\nresponse = client.QueryRecords(request)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Page Size: {response.data.pageSize}')\nprint(f'Page Number: {response.data.pageNumber}')\nprint(f'Total Pages: {response.data.totalPages}')\nprint(f'Total Records: {response.data.totalRecords}')\n\nfor record in response.data.records:\n    print(f'AppId: {record.appId}')\n    print(f'RecordId: {record.recordId}')\n\n    for field in record.fields:\n        print(f'Type: {field.type}')\n        print(f'FieldId: {field.fieldId}')\n        print(f'Value: {field.GetResultValueString()}')\n```\n\nYou can set your own page size and page number (max is 1,000) as well. In addition to specifying what field values to return and in what format (Raw vs. Formatted) to return them.\n\n```python\nfrom OnspringApiSdk.Models import PagingRequest, QueryRecordsRequest\nfrom OnspringApiSdk.Enums import DataFormat\n\npagingRequest = PagingRequest(1, 10)\nfieldId = 6983\noperator = 'eq'\nvalue = '\\'Test Task 5\\''\n\nrequest = QueryRecordsRequest(\n    appId=195, \n    filter=f'{fieldId} {operator} {value}',\n    fieldIds=[9686],\n    dataFormat=DataFormat.Formatted.name,\n    pagingRequest)\n\nresponse = client.QueryRecords(request)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Page Size: {response.data.pageSize}')\nprint(f'Page Number: {response.data.pageNumber}')\nprint(f'Total Pages: {response.data.totalPages}')\nprint(f'Total Records: {response.data.totalRecords}')\n\nfor record in response.data.records:\n    print(f'AppId: {record.appId}')\n    print(f'RecordId: {record.recordId}')\n\n    for field in record.fields:\n        print(f'Type: {field.type}')\n        print(f'FieldId: {field.fieldId}')\n        print(f'Value: {field.GetResultValueString()}')\n```\n\nFor further details on constructing the `filter` parameter please refer to the [documentation](https://software.onspring.com/hubfs/Training/Admin%20Guide%20-%20v2%20API.pdf) for v2 of the Onspring API.\n\n#### Add or Update A Record\n\nYou can add a record by not providing a record id value. If successful will return the id of the added record.\n\n```python\nfrom OnspringApiSdk.Models import StringFieldValue, GuidFieldValue, DateFieldValue, IntegerListValue, Record\n\nfields = []\n\nstatus = uuid.UUID('4118d53a-9121-4345-8682-07f23d606daa')\ndueDate = datetime.utcnow()\n\nfields.append(StringFieldValue(6983, 'Test Task via API'))\nfields.append(StringFieldValue(6984, 'This is a task.'))\nfields.append(GuidFieldValue(6986, status))\nfields.append(DateFieldValue(6985, dueDate))\nfields.append(IntegerListValue(6987, [4]))\n\nrecord = Record(\n    appId=195, \n    fields)\n\nresponse = client.AddOrUpdateRecord(record)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Id: {response.data.id}')\nfor warning in response.data.warnings:\n    print(f'Warning: {warning}')\n```\n\nYou can update a record by providing its id. If successful will return the id of record updated.\n\n```python\nfrom OnspringApiSdk.Models import StringFieldValue, GuidFieldValue, DateFieldValue, IntegerListValue, Record\n\nfields = []\n\nstatus = uuid.UUID('1c1c5f7e-cd03-4b70-9790-0f83b24b5863')\ndueDate = datetime.utcnow()\n\nfields.append(StringFieldValue(6983, 'Test Task via API'))\nfields.append(StringFieldValue(6984, 'This is a task.'))\nfields.append(GuidFieldValue(6986, status))\nfields.append(DateFieldValue(6985, dueDate))\nfields.append(IntegerListValue(6987, [4]))\n\nrecord = Record(\n    appId=195, \n    fields, \n    recordId=103)\n\nresponse = client.AddOrUpdateRecord(record)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Id: {response.data.id}')\nfor warning in response.data.warnings:\n    print(f'Warning: {warning}')\n```\n\n#### Delete Records By Ids\n\n```python\nfrom OnspringApiSdk.Models import DeleteBatchRecordsRequest\n\nrequest = DeleteBatchRecordsRequest(appId=195, recordIds=[1, 2, 3])\n\nresponse = client.DeleteRecordsByIds(request)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Message: {response.message}')\n```\n\n### Reports\n\n#### Get Report By Id\n\nReturns the report for the provided id.\n\n```python\nfrom OnspringApiSdk.Models import GetReportByIdRequest\n\nrequest = GetReportByIdRequest(reportId=53)\n\nresponse = client.GetReportById(request)\n\nprint(f'Status Code: {response.statusCode}')\nprint('Columns:')\nprint(f'{\", \".join(response.data.columns)}')\nprint('Rows:')\nfor row in response.data.rows:\n    print(f'Record Id {row.recordId}: {\", \".join([str(cell) for cell in row.cells])}')\n```\n\nYou can also specify the format of the data in the report as well as whether you are requesting the report's data or its chart data.\n\n```python\nfrom OnspringApiSdk.Models import GetReportByIdRequest\nfrom OnspringApiSdk.Enums import DataFormat, ReportDataType\n\nrequest = GetReportByIdRequest(\n    reportId=53,\n    apiDataFormat=DataFormat.Formatted.name,\n    dataFormat=ReportDataType.ChartData.name)\n\nresponse = client.GetReportById(request)\n\nprint(f'Status Code: {response.statusCode}')\nprint('Columns:')\nprint(f'{\", \".join(response.data.columns)}')\nprint('Rows:')\nfor row in response.data.rows:\n    print(f'Record Id {row.recordId}: {\", \".join([str(cell) for cell in row.cells])}')\n```\n\n#### Get Reports By App Id\n\nReturns a paged collection of reports that can be paged through. By default the page size is 50 and page number is 1.\n\n```python\nresponse = client.GetReportsByAppId(appId=195)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'App Id: {appId}')\nprint('Reports:')\n\nfor report in response.data.reports:\n    print(f' Id: {report.id}')\n    print(f' Name: {report.name}')\n    print(f' Description: {report.description}')\n```\n\nYou can set your own page size and page number (max is 1,000) as well.\n\n```python\nfrom OnspringApiSdk.Models import PagingRequest\n\npagingRequest = PagingRequest(1,10)\n\nresponse = client.GetReportsByAppId(appId=195, pagingRequest)\n\nprint(f'Status Code: {response.statusCode}')\nprint(f'Page Number: {response.data.pageNumber}')\nprint(f'Page Number: {response.data.pageSize}')\nprint(f'Page Number: {response.data.totalPages}')\nprint(f'Page Number: {response.data.totalRecords}')\nprint(f'App Id: {appId}')\nprint('Reports:')\n\nfor report in response.data.reports:\n    print(f' Id: {report.id}')\n    print(f' Name: {report.name}')\n    print(f' Description: {report.description}')\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevanfreeborn%2Fonspring-api-sdk-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevanfreeborn%2Fonspring-api-sdk-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevanfreeborn%2Fonspring-api-sdk-python/lists"}