{"id":20543609,"url":"https://github.com/iwate/odatahttpclient","last_synced_at":"2026-05-29T05:00:47.420Z","repository":{"id":44454168,"uuid":"129606555","full_name":"iwate/ODataHttpClient","owner":"iwate","description":"The simplest implementation of OData client.","archived":false,"fork":false,"pushed_at":"2025-12-17T07:08:03.000Z","size":176,"stargazers_count":26,"open_issues_count":0,"forks_count":13,"subscribers_count":6,"default_branch":"master","last_synced_at":"2026-04-15T18:16:19.511Z","etag":null,"topics":["csharp","dotnet","odata","odata-client","simple"],"latest_commit_sha":null,"homepage":"https://iwate.github.io/ODataHttpClient/","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/iwate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["iwate"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2018-04-15T12:10:28.000Z","updated_at":"2025-12-17T07:08:07.000Z","dependencies_parsed_at":"2024-07-16T17:27:35.998Z","dependency_job_id":"21568192-e631-43bd-852c-ca02be1b4da7","html_url":"https://github.com/iwate/ODataHttpClient","commit_stats":null,"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"purl":"pkg:github/iwate/ODataHttpClient","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwate%2FODataHttpClient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwate%2FODataHttpClient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwate%2FODataHttpClient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwate%2FODataHttpClient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iwate","download_url":"https://codeload.github.com/iwate/ODataHttpClient/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwate%2FODataHttpClient/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33637485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["csharp","dotnet","odata","odata-client","simple"],"created_at":"2024-11-16T01:39:00.965Z","updated_at":"2026-05-29T05:00:47.400Z","avatar_url":"https://github.com/iwate.png","language":"C#","funding_links":["https://github.com/sponsors/iwate"],"categories":[],"sub_categories":[],"readme":"[![Test](https://github.com/iwate/ODataHttpClient/actions/workflows/test.yml/badge.svg)](https://github.com/iwate/ODataHttpClient/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/iwate/ODataHttpClient/branch/master/graph/badge.svg)](https://codecov.io/gh/iwate/ODataHttpClient)\n[![NuGet version](https://badge.fury.io/nu/ODataHttpClient.svg)](https://badge.fury.io/nu/ODataHttpClient)\n\nThe simplest implementation of OData client.\n\n## Install\n\n    $ dotnet add package ODataHttpClient\n    PS\u003e Install-Package  ODataHttpClient\n\n## Restrictions\n\n- Not support XML (JSON only)\n- Not support Query Builder\n\n## Usage\n\n### Simple Request\n\n    var client = new HttpClient();\n    var odata = new ODataClient(client);\n    var request = Request.Get($\"{endpoint}/Products?$count=true\");\n    var response = await odata.SendAsync(request);\n\n    if (response.Success) \n    {\n        var total = response.ReadAs\u003cint\u003e(\"$['@odata.count']\");\n        var products = response.ReadAs\u003cIEnumerable\u003cProduct\u003e\u003e(\"$.value\");\n    }\n\n### Batch Request\n\n    var client = new HttpClient();\n    var odata = new ODataClient(client);\n    var batch = new BatchRequest($\"{endpoint}/$batch\")\n    {\n        Requests = new []\n        {\n            Request.Post($\"{endpoint}/Products\", new \n            { \n                Name = \"Sample\"\n            }),\n            Request.Post($\"{endpoint}/$1/Categories/$ref\", new Dictionay\u003cstring, string\u003e\n            {\n                [\"@odata.id\"] = $\"{endpoint}/Categories(0)\"\n            })\n        }\n    };\n\n    var responses = await odata.SendAsync(batch);\n    // You can also use BatchAsync. \n    // var responses = await odata.BatchAsync(batch);\n\n    if (responses.All(res =\u003e res.Success)) \n    {\n        var id = response.First().ReadAs\u003cint\u003e(\"$.Id\");\n    }\n### Parameterized Uri\n\n    var client = new HttpClient();\n    var odata = new ODataClient(client);\n    var request = Request.Get($\"{endpoint}/Products?$filter=ReleaseDate ge @Date\", new { Date = new DateTimeOffset(new DateTime(2000, 1, 1)) });\n    var response = await odata.SendAsync(request);\n\n    if (response.Success) \n    {\n        ...\n    }\n\nAnd you can use `@@` as escape for `@`.\n\n### Set OData Element Type\nIn default, OData element type is not contained in payload. If you want add element type, you sould use `type` parameter of Request factory method.\n\n    Request.Post(\"...\", payload, type: \"ODataDemo.Product\")\n\n### Change OData Element Type Key\nIn default, OData element type key is `odata.type`. If you want change key to other, you should use `typeKey` parameter of Request factory method.\n\n    Request.Post(\"...\", payload, type: \"ODataDemo.Product\", typeKey: \"@odata.type\")\n\n### Use for OData v3(v2)\nIf you use for OData v3(v2), you have to change serializer and parametalizer.\n\n#### 1. Global level settings\n\n    ODataClient.UseHistoricalGlobal();\n\n#### 2. Client level settings\nnot yet. If you want, please create issue ticket.\n\n## Credential\n\n### Basic Auth\n\n    var odata = new ODataClient(client, \"username\", \"password\");\n\n### Custom\nYou should modify default settings of client which be passed to ODataClient constructor or implemet `ICredentialBuilder`\n\n    public class CustomCredentialBuilder : ODataHttpClient.Credentials.ICredentialBuilder\n    {\n        public void Build(HttpClient client, HttpRequestMessage message)\n        {\n            // implement custom credential logic.\n        }\n    }\n\nAnd pass the builder instance to 2nd parameter constructor.\n\n    var odata = new ODataClient(client, new CustomCredentialBuilder());\n    \n## Json Serializer Settings\nIn default, ODataHttpClient use general json format. \nIf you change [OData V2 JSON Serialization Format](http://www.odata.org/documentation/odata-version-2-0/json-format/#PrimitiveTypes), can select a way of three.\n\n### 1. Global level settings\n\n    ODataHttpClient.Serializers.JsonSerializer.Default = ODataHttpClient.Serializers.JsonSerializer.Historical;\n\n### 2. Instance level settings\n\n    var odata = new ODataHttpClient(httpClient, ODataHttpClient.Serializers.JsonSerializer.Historical);\n    var request = odata.RequestFacotry.Get(\"...\"); // MUST use RequestFactory\n\n### 3. Request level settings\n\n    var serializer = ODataHttpClient.Serializers.JsonSerializer.Historical;\n    var request = Request.Get(\"...\", serializer); // pass serializer\n    var response = await odata.SendAsync(request);\n    var data = response.ReadAs\u003cdynamic\u003e(serializer); // pass serializer\n\n## NotFound(404)\n\nIn default, ODataHttpClient decide 404 response code of GET and HEAD request to success. If you change to error, can select a way of followings.\n\n```\nvar request = Request.Get(\"...\", acceptNotFound: false);\nvar response = await odata.SendAsync(request);\n```\n\nWhen a response code of other HTTP methods, like as POST,PUT,PATCH and DELETE, is 404, ODataHttpClient set `Response.Success` false.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwate%2Fodatahttpclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiwate%2Fodatahttpclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwate%2Fodatahttpclient/lists"}