{"id":13598265,"url":"https://github.com/Unity3dAzure/RESTClient","last_synced_at":"2025-04-10T06:31:45.971Z","repository":{"id":97709907,"uuid":"108529483","full_name":"Unity3dAzure/RESTClient","owner":"Unity3dAzure","description":"REST Client for Unity with JSON and XML parsing. (Features JSON helper to handle nested arrays and deserializing abstract types)","archived":false,"fork":false,"pushed_at":"2020-11-28T15:42:04.000Z","size":23,"stargazers_count":49,"open_issues_count":2,"forks_count":14,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-02T17:33:03.030Z","etag":null,"topics":["json-parsing","jsonutility","restclient","unity","unitywebrequest","xml-parsing"],"latest_commit_sha":null,"homepage":"https://deadlyfingers.net","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/Unity3dAzure.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-10-27T09:53:56.000Z","updated_at":"2024-06-14T00:49:39.000Z","dependencies_parsed_at":"2023-06-02T21:00:14.183Z","dependency_job_id":null,"html_url":"https://github.com/Unity3dAzure/RESTClient","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Unity3dAzure%2FRESTClient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Unity3dAzure%2FRESTClient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Unity3dAzure%2FRESTClient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Unity3dAzure%2FRESTClient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Unity3dAzure","download_url":"https://codeload.github.com/Unity3dAzure/RESTClient/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223427693,"owners_count":17143332,"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":["json-parsing","jsonutility","restclient","unity","unitywebrequest","xml-parsing"],"created_at":"2024-08-01T17:00:51.140Z","updated_at":"2024-11-06T22:32:03.377Z","avatar_url":"https://github.com/Unity3dAzure.png","language":"C#","readme":"# REST Client for Unity\nFor Unity developers looking to use REST Services in their Unity game / app.\n\n**RESTClient** for Unity is built on top of [UnityWebRequest](https://docs.unity3d.com/Manual/UnityWebRequest.html) and Unity's [JsonUtility](https://docs.unity3d.com/ScriptReference/JsonUtility.html) to make it easier to compose REST requests and return the results serialized as native C# data model objects.\n\n## Features\n - Methods to add request body, headers and query strings to REST requests.\n - Ability to return result as native object or as plain text.\n - Work around for nested arrays.\n - Work around for parsing abstract types on UWP.\n\n## How do I use this with cloud services?\nCheckout the following projects for Unity which were built using this REST Client library as  examples.\n - [Azure App Services](https://github.com/Unity3dAzure/AppServices)\n - [Azure Blob Storage](https://github.com/Unity3dAzure/StorageServices)\n - [Azure Functions](https://github.com/Unity3dAzure/AzureFunctions)\n - [Nether (serverless)](https://github.com/MicrosoftDX/nether/tree/serverless/src/Client/Unity)\n\n## Example Usage\nThis snippet shows how to **POST** a REST request to a new [Azure Function](https://azure.microsoft.com/en-gb/services/functions/) HTTP Trigger \"hello\" sample function:\n\n```\nusing RESTClient;\nusing System;\n```\n\n```\npublic class RESTClientExample : MonoBehaviour {\n\n  private string url = \"https://***.azurewebsites.net/api/hello\"; // Azure Function API endpoint\n  private string code = \"***\"; // Azure Function code\n\n\tvoid Start () {\n\t\tStartCoroutine( SayHello(SayHelloCompleted) );\n\t}\n\n\tprivate IEnumerator SayHello(Action\u003cIRestResponse\u003cstring\u003e\u003e callback = null) {\n\t\tRestRequest request = new RestRequest(url, Method.POST);\n\t\trequest.AddHeader(\"Content-Type\", \"application/json\");\n\t\trequest.AddQueryParam(\"code\", code);\n\t\trequest.AddBody(\"{\\\"name\\\": \\\"unity\\\"}\");\n\t\tyield return request.Request.Send();\n\t\trequest.GetText(callback);\n\t}\n\n\tprivate void SayHelloCompleted(IRestResponse\u003cstring\u003e response) {\n\t\tif (response.IsError) {\n\t\t\tDebug.LogError(\"Request error: \" + response.StatusCode);\n\t\t\treturn;\n\t\t}\n\t\tDebug.Log(\"Completed: \" + response.Content);\n\t}\n\n}\n```\n\n## Requirements\nRequires Unity v5.3 or greater as [UnityWebRequest](https://docs.unity3d.com/Manual/UnityWebRequest.html) and [JsonUtility](https://docs.unity3d.com/ScriptReference/JsonUtility.html) features are used. Unity will be extending platform support for UnityWebRequest so keep Unity up to date if you need to support these additional platforms.\n\n## Supported platforms\nIntended to work on all the platforms [UnityWebRequest](https://docs.unity3d.com/Manual/UnityWebRequest.html) supports including:\n* Unity Editor (Mac/PC) and Standalone players\n* iOS\n* Android\n* Windows 10 (UWP)\n\n## Troubleshooting\n- Remember to wrap async calls with [`StartCoroutine()`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.StartCoroutine.html)\n- Before building for a target platform remember to check the **Internet Client capability** is enabled in the Unity player settings, otherwise all REST calls will fail with a '-1' status error.\n\nQuestions or tweet [@deadlyfingers](https://twitter.com/deadlyfingers)\n","funding_links":[],"categories":["Open Source Packages","Open Source Repositories","NetWork","C# #","C\\#"],"sub_categories":["Networking"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUnity3dAzure%2FRESTClient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FUnity3dAzure%2FRESTClient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUnity3dAzure%2FRESTClient/lists"}