Skip to content

Instantly share code, notes, and snippets.

@fontanka16
Created November 23, 2012 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fontanka16/4134601 to your computer and use it in GitHub Desktop.
Save fontanka16/4134601 to your computer and use it in GitHub Desktop.
example of json.decode
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Web.Helpers;
namespace bibliotekarien.GooglePlus
{
public class ActivitiesFetcher
{
public static bool GetActivities(string userId, string apiKey, int numberOfItems, out dynamic activities)
{
string requestString = "https://www.googleapis.com/plus/v1/people/{0}/activities/public?key={1}&maxResults={2}";
try
{
WebRequest request = WebRequest.Create(String.Format(requestString,userId,apiKey, numberOfItems));
request.Method = "GET";
System.Net.WebResponse resp = request.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream());
string s = sr.ReadToEnd().Trim();
activities = Json.Decode(s);
return true;
}
catch (Exception ee)
{
activities = null;
return false;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment