{"id":25778209,"url":"https://github.com/alandoherty/devicepilot-api-net","last_synced_at":"2025-02-27T06:29:59.205Z","repository":{"id":40913128,"uuid":"189388916","full_name":"alandoherty/devicepilot-api-net","owner":"alandoherty","description":"A .NET API client for the Device Pilot analytics system","archived":false,"fork":false,"pushed_at":"2022-12-08T05:37:46.000Z","size":16,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-08-06T13:11:29.427Z","etag":null,"topics":["api-client","csharp","devicepilot","iot","netframework45","netstandard13"],"latest_commit_sha":null,"homepage":"https://devicepilot.com","language":"C#","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/alandoherty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-30T09:52:46.000Z","updated_at":"2023-08-06T13:11:29.428Z","dependencies_parsed_at":"2023-01-24T12:45:40.684Z","dependency_job_id":null,"html_url":"https://github.com/alandoherty/devicepilot-api-net","commit_stats":null,"previous_names":[],"tags_count":1,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alandoherty%2Fdevicepilot-api-net","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alandoherty%2Fdevicepilot-api-net/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alandoherty%2Fdevicepilot-api-net/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alandoherty%2Fdevicepilot-api-net/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alandoherty","download_url":"https://codeload.github.com/alandoherty/devicepilot-api-net/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240989502,"owners_count":19889699,"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-client","csharp","devicepilot","iot","netframework45","netstandard13"],"created_at":"2025-02-27T06:29:58.625Z","updated_at":"2025-02-27T06:29:59.196Z","avatar_url":"https://github.com/alandoherty.png","language":"C#","readme":"\u003cdiv align=\"center\"\u003e\n\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/alandoherty/devicepilot-api-net/master/LICENSE)\n[![GitHub issues](https://img.shields.io/github/issues/alandoherty/devicepilot-api-net.svg?style=flat-square)](https://github.com/alandoherty/devicepilot-api-net/issues)\n[![GitHub stars](https://img.shields.io/github/stars/alandoherty/devicepilot-api-net.svg?style=flat-square)](https://github.com/alandoherty/devicepilot-api-net/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/alandoherty/devicepilot-api-net.svg?style=flat-square)](https://github.com/alandoherty/devicepilot-api-net/network)\n[![GitHub forks](https://img.shields.io/nuget/dt/DevicePilot.Api.svg?style=flat-square)](https://www.nuget.org/packages/DevicePilot.Api/)\n\n\u003c/div\u003e\n\n# devicepilot-api\n\nA .NET API client for the Device Pilot IoT analytics platform. Open permissive MIT license and requires a minimum of .NET Standard 1.3.\n\n## Getting Started\n\n[![NuGet Status](https://img.shields.io/nuget/v/DevicePilot.Api.svg?style=flat-square)](https://www.nuget.org/packages/DevicePilot.Api/)\n\nYou can install the package using either the CLI:\n\n```\ndotnet add package DevicePilot.Api\n```\n\nor from the NuGet package manager:\n\n```\nInstall-Package DevicePilot.Api\n```\n\n## Usage\n\nCreate an instance of the API client and configure your authentication token, you can find this on the API keys page of the platform.\n\n```csharp\nApiClient client = new ApiClient(Environment.GetEnvironmentVariable(\"DEVICEPILOT_TOKEN\"));\n```\n\nThe client will automatically retry each request 3 times if a transient error occurs.\n\n### Ingesting\n\nYou can start ingesting data immediately after creating the client, you can ingest either a single device update or as many as you want. If you ingest more than one device the batch API will be used, if you pass more than 500 devices the client will split up the request automatically.\n\n```csharp\nvar devices = new DeviceData[] {\n\tnew DeviceData() {\n\t\tId = \"switch1\",\n\t\tProperties = new Dictionary\u003cstring, object\u003e() {\n\t\t\t{ \"name\", \"Switch 1\" },\n\t\t\t{ \"isOn\", true },\n\t\t\t{ \"longitude\", 53.7005d },\n\t\t\t{ \"latitude\", 2.3015d }\n\t\t}\n\t},\n\tnew DeviceData() {\n\t\tId = \"switch2\",\n\t\tProperties = new Dictionary\u003cstring, object\u003e() {\n\t\t\t{ \"name\", \"Switch 2\" },\n\t\t\t{ \"isOn\", false },\n\t\t\t{ \"longitude\", 53.7005d },\n\t\t\t{ \"latitude\", 2.3015d }\n\t\t}\n\t}\n};\n\nawait client.BulkIngestAsync(devices);\n```\n\n### Mapped types\n\nOptionally you can use .NET objects to represent your device data structure. You can use either `client.IngestAsync\u003cT\u003e` or `client.BulkIngestAsync\u003cT\u003e`.\n\n```csharp\nclass MyDevice \n{\n\t[DeviceId]\n\tpublic string ID { get; set; }\n\n\t[DeviceProperty(\"online\")]\n\tpublic bool Online { get; set; }\n\n\t[DeviceProperty]\n\tpublic double Temperature { get; set; }\n\n\t[DeviceTimestamp]\n\tpublic DateTime? Timestamp { get; set; }\n}\n```\n\n```csharp\nawait client.IngestAsync\u003cMyDevice\u003e(new MyDevice() {\n\tID = \"temp1\",\n\tOnline = true,\n\tTemperature = 16.21d\n});\n```\n\n## Contributing\n\nAny pull requests or bug reports are welcome, please try and keep to the existing style conventions and comment any additions.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falandoherty%2Fdevicepilot-api-net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falandoherty%2Fdevicepilot-api-net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falandoherty%2Fdevicepilot-api-net/lists"}