The Mixed Reality Forums here are no longer being used or maintained.
There are a few other places we would like to direct you to for support, both from Microsoft and from the community.
The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.
For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.
If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.
And always feel free to hit us up on Twitter @MxdRealityDev.
Make REST API call in hololens
Hi everyone, I'm new in developping app for hololens, I didn't find a easy way to call a rest api in unity3d, does the cURL works? or there is other way to do it, thanks in adavanced for all the answers
Best Answers
-
Options
Hi Ruoyun_HUN,
You can use UnityWebRequest. I'm currently working on a Unity3D App that needed to make rest calls.
If you need a good Json library, i would suggest http://www.newtonsoft.com/json, a Unity3D version of the library can be found here : https://github.com/SaladLab/Json.Net.Unity3D.
Junior Consultant at Astrakhan
5 -
Optionsjames_ashley ✭✭✭✭
The easiest way is to just use the WWW class which gives you something like an async call. There's code samples in this walkthrough of using it to make REST calls to Cognitive Services.
James Ashley
VS 2017 v5.3.3, Unity 2017.3.0f3, MRTK 2017.1.2, W10 17063
Microsoft MVP, Freelance HoloLens/MR Developer
www.imaginativeuniversal.com5
Answers
Hi Ruoyun_HUN,
You can use UnityWebRequest. I'm currently working on a Unity3D App that needed to make rest calls.
If you need a good Json library, i would suggest http://www.newtonsoft.com/json, a Unity3D version of the library can be found here : https://github.com/SaladLab/Json.Net.Unity3D.
Junior Consultant at Astrakhan
The easiest way is to just use the WWW class which gives you something like an async call. There's code samples in this walkthrough of using it to make REST calls to Cognitive Services.
James Ashley
VS 2017 v5.3.3, Unity 2017.3.0f3, MRTK 2017.1.2, W10 17063
Microsoft MVP, Freelance HoloLens/MR Developer
www.imaginativeuniversal.com
Thank you guys, I actually tested the two ways with WWW and UnityWebRequest, I found that UnityWebRequest is better because when you want to do Put or Delete action, WWW can not do it
Guys, check this new package! I think we can improve our code making http requests using promises https://assetstore.unity.com/packages/tools/network/rest-client-for-unity-102501
I am using the package and everything works fine in Unity, but when I deploy it to my Hololens it doen't work any more. Following mistake pops up in VB.:
Error CS0012 The type 'IPromise<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'RSG.Promise, Version=3.0.0.0, Culture=neutral,
Do you know what to do? I am want a new developer and would be very grateful for every advice?
I solved the problem. Withs Tom solution everything works fine, but only in Unity. When I deploy it on the HoloLens it doesn't work. Do you have any idea guys?
The same thing happens to me, please, did anyone find any solution? If you could solve it, how?
I have the same problem. I tried UnityWebRegest and HttpClient. They work on the desktop, but not on the HoloLens.
Hey guys, I am not an expert, but I will try to help you. I solved it with UnityWebRequest. I changed the if condition (delete isnetworkerror) after yield return and I got the json in my Hologramms.