public List<String[]> contactRequest(String token) { /* stops working after the first 10 because REST api limit */ String output = httpRequest(token,"https://www.yammer.com/api/v1/users.json"); if (output != "") { JSONArray jObject = new JSONArray (output); // json List<String[]> ppl = new List<String[]> (); //int c = 0; JSONObject data, tmp; String[] items; String uid,fname,lname,email,phone="",org,profilepicture,miniprofilepicture; //maybe use less memory because im using heaps apparently for (int i = 0; i < jObject.Length (); i++) { //if(i < 8){//limit for now data = jObject.GetJSONObject (i); // get data object uid = data.GetString ("id"); //userdeets = httpRequest (token, "https://www.yammer.com/api/v1/users/" + uid + ".json"); //if (userdeets != "") { //Console.WriteLine (uid); //person = new JSONObject (userdeets); // get data object fname = data.GetString ("first_name"); lname = data.GetString ("last_name"); email = data.GetString ("email"); profilepicture = data.GetString ("mugshot_url_template"); profilepicture = profilepicture.Replace ("{width}x{height}", "300x300"); miniprofilepicture = data.GetString ("mugshot_url"); tmp = data.GetJSONObject ("contact"); phone = tmp.GetString ("phone_numbers"); try{ tmp = new JSONArray (phone).GetJSONObject (0); phone = tmp.GetString ("number"); } catch{ phone = ""; } org = data.GetString ("network_name"); //Console.WriteLine (fname + " : " + lname + " : " + email + " : " + phone + " : " + org + " : " + uid); items = new String[] { fname, lname, email, phone, org, uid, profilepicture, miniprofilepicture }; ppl.Add (items); tmp.Dispose (); data.Dispose (); fname = ""; lname = ""; email = ""; phone = ""; org = ""; uid = ""; profilepicture = ""; //}//individual users //c++; //}//limit }//loop jObject.Dispose(); return ppl; }//get all users return new List<String[]>(); }
public String[] getUserDeets(String token) { Console.WriteLine ("into the belly of it m8"); String output = httpRequest(token,"https://www.yammer.com/api/v1/users/current.json"); Console.WriteLine ("we dun it now"); if (output != "") { //JSONArray jObject = new JSONArray (output); // json String[] details; JSONObject data, tmp; //String[] items; String uid, fname, lname, email, phone = "", org, profilepicture; //maybe use less memory because im using heaps apparently data = new JSONObject (output); // get data object uid = data.GetString ("id"); fname = data.GetString ("first_name"); lname = data.GetString ("last_name"); email = data.GetString ("email"); profilepicture = data.GetString ("mugshot_url_template"); profilepicture = profilepicture.Replace ("{width}x{height}", "300x300"); tmp = data.GetJSONObject ("contact"); phone = tmp.GetString ("phone_numbers"); try { tmp = new JSONArray (phone).GetJSONObject (0); phone = tmp.GetString ("number"); } catch { phone = ""; } org = data.GetString ("network_name"); details = new String[] { fname, lname, email, phone, org, uid, profilepicture }; tmp.Dispose (); data.Dispose (); fname = ""; lname = ""; email = ""; phone = ""; org = ""; uid = ""; profilepicture = ""; //jObject.Dispose (); return details; } String[] gg = null; return gg; }