{"id":48288083,"url":"https://github.com/recombee/net-api-client","last_synced_at":"2026-04-04T23:00:00.435Z","repository":{"id":20815154,"uuid":"90993538","full_name":"recombee/net-api-client","owner":"recombee","description":".NET client for easy use of the Recombee recommendation API","archived":false,"fork":false,"pushed_at":"2025-10-23T13:10:08.000Z","size":7337,"stargazers_count":7,"open_issues_count":5,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-23T15:13:25.974Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/recombee.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-05-11T15:15:00.000Z","updated_at":"2025-10-23T13:10:08.000Z","dependencies_parsed_at":"2025-10-23T15:09:47.108Z","dependency_job_id":"d2c55220-a3a8-49a0-a4cf-d45f5feb6dc1","html_url":"https://github.com/recombee/net-api-client","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/recombee/net-api-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recombee%2Fnet-api-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recombee%2Fnet-api-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recombee%2Fnet-api-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recombee%2Fnet-api-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/recombee","download_url":"https://codeload.github.com/recombee/net-api-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recombee%2Fnet-api-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31418285,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T20:09:54.854Z","status":"ssl_error","status_checked_at":"2026-04-04T20:09:44.350Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-04-04T22:59:59.615Z","updated_at":"2026-04-04T23:00:00.417Z","avatar_url":"https://github.com/recombee.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Recombee API Client\n\nA .NET client (SDK) for easy use of the [Recombee](https://www.recombee.com/) recommendation API.\n\nIf you don't have an account at Recombee yet, you can create a free account [here](https://www.recombee.com/).\n\nDocumentation of the API can be found at [docs.recombee.com](https://docs.recombee.com/).\n\n## Installation\n\nTo install Recombee.ApiClient, run the following command in the Package Manager Console\n```\nInstall-Package Recombee.ApiClient\n```\n\n## Examples\n\n### Basic example\n\n```cs\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Recombee.ApiClient;\nusing Recombee.ApiClient.ApiRequests;\nusing Recombee.ApiClient.Bindings;\nusing Recombee.ApiClient.Util;\n\npublic class BasicExample\n{\n    static int Main(string[] args)\n    {\n        RecombeeClient client = new RecombeeClient(\"--my-database-id--\", \"--db-private-token--\", region: Region.UsWest);\n\n        try\n        {\n            const int NUM = 100;\n            var userIds = Enumerable.Range(0, NUM).Select(i =\u003e String.Format(\"user-{0}\", i));\n            var itemIds = Enumerable.Range(0, NUM).Select(i =\u003e String.Format(\"item-{0}\", i));\n            // Generate some random purchases of items by users\n            const double PROBABILITY_PURCHASED = 0.1;\n            Random r = new Random();\n            var purchases = new List\u003cRequest\u003e();\n\n            foreach(var userId in userIds) {\n                purchases.AddRange(\n                    itemIds.Where(_ =\u003e r.NextDouble() \u003c PROBABILITY_PURCHASED)\n                           .Select(itemId =\u003e\n                                    new AddPurchase(userId, itemId, cascadeCreate: true) // Use cascadeCreate parameter to create\n                           )                                                             // the yet non-existing users and items\n                );\n            }\n\n            Console.WriteLine(\"Send purchases\");\n            client.Send(new Batch(purchases)); //Use Batch for faster processing of larger data\n\n            // Recommend 5 items for user 'user-25'\n            RecommendationResponse recommendationResponse = client.Send(new RecommendItemsToUser(\"user-25\", 5));\n            Console.WriteLine(\"Recommended items:\");\n            foreach(Recommendation rec in recommendationResponse.Recomms) Console.WriteLine(rec.Id);\n\n            // User scrolled down - get next 3 recommended items\n            recommendationResponse = client.Send(new RecommendNextItems(recommendationResponse.RecommId, 3));\n            Console.WriteLine(\"Next recommended items:\");\n            foreach(Recommendation rec in recommendationResponse.Recomms) Console.WriteLine(rec.Id);\n\n        }\n        catch(ApiException e)\n        {\n         Console.WriteLine(e.ToString());\n         // Use fallback\n        }\n\n        return 0;\n    }\n}\n\n```\n\n### Using property values\n\n```cs\nusing System;\nusing System.Threading.Tasks;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Recombee.ApiClient;\nusing Recombee.ApiClient.ApiRequests;\nusing Recombee.ApiClient.Bindings;\nusing Recombee.ApiClient.Util;\n\npublic class PropertiesExample\n{\n    static async Task\u003cint\u003e Main(string[] args)\n    {\n        RecombeeClient client = new RecombeeClient(\"--my-database-id--\", \"--db-private-token--\", region: Region.ApSe);\n\n        /*\n        We will use computers as items in this example\n        Computers have four properties\n            - price (floating point number)\n            - number of processor cores (integer number)\n            - description (string)\n            - image (url of computer's photo)\n        */\n\n         try\n         {\n            client.Send(new ResetDatabase()); // Clear everything from the database\n            client.Send(new AddItemProperty(\"price\", \"double\"));\n            client.Send(new AddItemProperty(\"num-cores\", \"int\"));\n            client.Send(new AddItemProperty(\"description\", \"string\"));\n            client.Send(new AddItemProperty(\"image\", \"image\"));\n\n            // Prepare requests for setting a catalog of computers\n            var requests = new List\u003cRequest\u003e();\n            const int NUM = 100;\n            Random r = new Random();\n            var itemIds = Enumerable.Range(0, NUM).Select(i =\u003e String.Format(\"computer-{0}\", i));\n            foreach(var itemId in itemIds)\n            {\n                var req = new SetItemValues(\n                    itemId,\n                    //values:\n                    new Dictionary\u003cstring, object\u003e() {\n                        {\"price\", 600.0 + 400*r.NextDouble()},\n                        {\"num-cores\", 1 + r.Next(7)},\n                        {\"description\", \"Great computer\"},\n                        {\"image\", String.Format(\"http://examplesite.com/products/{0}.jpg\", itemId)}\n                    },\n                    cascadeCreate: true // Use cascadeCreate for creating item\n                                        // with given itemId, if it doesn't exist\n                );  \n                                           \n                requests.Add(req);\n            }\n            await client.SendAsync(new Batch(requests)); // Send catalog to the recommender system\n\n            // Generate some random purchases of items by users\n            var userIds = Enumerable.Range(0, NUM).Select(i =\u003e String.Format(\"user-{0}\", i));\n            const double PROBABILITY_PURCHASED = 0.1;\n            var purchases = new List\u003cRequest\u003e();\n\n            foreach(var userId in userIds) {\n                purchases.AddRange(\n                    itemIds.Where(_ =\u003e r.NextDouble() \u003c PROBABILITY_PURCHASED)\n                           .Select(itemId =\u003e \n                                    new AddPurchase(userId, itemId, cascadeCreate: true) // Use cascadeCreate parameter to create\n                           )                                                             // the yet non-existing users and items                                                               \n                );\n            }\n\n            client.Send(new Batch(purchases)); // Send purchases to the recommender system\n        \n\n            // Get 5 recommendations for user-42, who is currently viewing computer-6\n            // Recommend only computers that have at least 3 cores\n            RecommendationResponse recommendationResponse = await client.SendAsync\n                                            (new RecommendItemsToItem(\"computer-6\", \"user-42\", 5,\n                                                                      filter: \" 'num-cores'\u003e=3 \"));\n            Console.WriteLine(\"Recommended items with at least 3 processor cores:\");\n            foreach(Recommendation rec in recommendationResponse.Recomms) Console.WriteLine(rec.Id);\n\n            // Recommend only items that are more expensive then currently viewed item (up-sell)\n            recommendationResponse = await client.SendAsync(new RecommendItemsToItem(\"computer-6\", \"user-42\", 5,\n                                            filter: \" 'price' \u003e context_item[\\\"price\\\"] \"));\n            Console.WriteLine(\"Recommended up-sell items:\");\n            foreach(Recommendation rec in recommendationResponse.Recomms) Console.WriteLine(rec.Id);\n\n            // Filters, boosters and other settings can be set also in the Admin UI (admin.recombee.com)\n            // when scenario is specified\n            recommendationResponse = await client.SendAsync(\n                new RecommendItemsToItem(\"computer-6\", \"user-42\", 5, scenario: \"product_detail\")\n            );\n\n            // Perform personalized full-text search with a user's search query (e.g. \"computers\")\n            SearchResponse searchResponse = await client.SendAsync(\n              new SearchItems(\"user-42\", \"computers\", 5, scenario: \"search_top\")\n            );\n            Console.WriteLine(\"Search matches:\");\n            foreach(Recommendation rec in searchResponse.Recomms) Console.WriteLine(rec.Id);\n\n         }\n         catch(ApiException e)\n         {\n             Console.WriteLine(e.ToString());\n             // Use fallback\n         }\n        return 0;\n    }\n}\n```\n\n## Exception handling\n\nVarious errors can occur while processing request, for example because of adding an already existing item or submitting interaction of nonexistent user without *cascadeCreate* set to true. These errors lead to throwing the *ResponseException* by the *send* method of the client. Another reason for throwing an exception is a timeout. *ApiException* is the base class of both *ResponseException* and *TimeoutException*.\n\nWe are doing our best to provide the fastest and most reliable service, but production-level applications must implement a fallback solution since errors can always happen. The fallback might be, for example, showing the most popular items from the current category, or not displaying recommendations at all.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecombee%2Fnet-api-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frecombee%2Fnet-api-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecombee%2Fnet-api-client/lists"}