How to connect to

Hi!

I need to know how i connect to a Rest API(Parse.com)

i tried with jsonReader but doesnt work

or there is another way

thanks for your help!

Hi!

For advanced HTTP/REST communication, you can use the Experimental.Net.Http package.

Remember to add a package reference in your project references.

Here’s a short example on how to fetch strings over http, than can then be fed to the json library:


using Experimental.Net.Http;

    public class ClassThatDoesSomeHttpThings
    {
        private HttpMessageHandler _handler = new HttpMessageHandler();

        public void DoSomeHttpThings()
        {
            var request = _handler.CreateRequest("GET", url);
            request.Done += Done;
            request.Error += Error;
            request.HttpResponseType = HttpResponseType.String;
            request.SendAsync();
        }

        private void Done(HttpMessageHandlerRequest request)
        {
            var json = request.GetResponseContentString();
            //Do json parsing here

        }

        private void Error(HttpMessageHandlerRequest request, string error)
        {
            //Handle error
        }

    }

If this library feels a bit low level, rest assured that a new higher level http api is coming soon.

I’m doing the same, and have a half-working parse class in Uno. I plan to put it on github when it is in a more stable state (maybe this weekend?). Maybe we can share the effort!

Eivind, i managed to get data from parse.com, but now i need to send data and save it on the data (class/DB) of parse.com. Did you make it work?

ckarmy, Have only tried GETting from the REST api still, but I was able to manipulate the user objects in a cloud code function (fetching user data from facebook and storing it there). That was server-side javascript, of course. Still haven’t found a structure for my API that I’m happy with, so I’m still working on that. Haven’t done any GUI coding in decades, so I’m learning a lot.

GoodFactory, here’s what I’m at. Let me know what you think: https://gist.github.com/spookysys/4de6765aab0368c358f6

i managed to make POST and get data from parse, now i only need to make a facebook login, i have an simple sign up, log in and creating posts and stuff like that, its working really good.