c# - How to read Json data from Instagram RealTime API updates -
i'm trying use instagram realtime api updates whenever posts image specific tag, i've followed steps, i'm having problems read json data sent callback url. according instagram's documentation :
when posts new photo , triggers update of 1 of subscriptions, make post request callback url defined in subscription. post body contains raw text json body update objects.
i'm using c# , mvc 5, here's code read "raw text json body", note i'm saving json string in text file.
[httppost] public httpstatuscoderesult receive() { string json; using (var reader = new streamreader(request.inputstream)) { json = reader.readtoend(); } file.writealltext(path.combine(server.mappath("~/"), "test.txt"), json); return new httpstatuscoderesult(200); }
the problem is, when receive request, file create, empty. there's wrong code? problem instagram's api? i'd appreciate this.
found it! set inputstream position 0 , works!
Comments
Post a Comment