package awesomefb;

import com.mongodb.util.JSON;
import org.json.JSONArray;
import org.json.JSONObject;

import java.io.IOException;

/**
 * Created by earl on 5/25/2015.
 */
public class FacebookManager {
    private static FacebookManager instance = null;
    private final String
            ACCESS_TOKEN = "CAAJK2NXosZAABAPjvopDAeoFgmBFZB98ixFdop1sFGiBKsZB2ZAZCrPgVein9u6lxxG28fDHELyvE1Unyvmi2XSkaG5wuIflAYTc2vp7DT4xkD6j9lFN1l60la0sVsLbPRysxbOV6kmbAKpLPXbvza4Rb1bW5k9gu0ZBZARbI4ZBcUYwlb5Wat2OhZC4zaqEoXZCDSLAy6CTZBSvXtNujkGRipF";

    public static FacebookManager getInstance() {
        if (instance == null) {
            instance = new FacebookManager();
        }
        return instance;
    }

    protected FacebookManager() {}

    public JSONObject request(String node, Object params) {
        String apiEndpoint = "https://graph.facebook.com/v2.3/";
        String url = apiEndpoint + node + "?";
        if (params != null) {
            url += params + "&";
        }
        url += "access_token=" + ACCESS_TOKEN;

        try {
            JSONObject obj = JsonReader.readJsonFromUrl(url);
            if (obj.has("error")) {
                System.out.println(obj.getJSONObject("error").getString("message"));
            } else {
                return obj;
            }
        } catch (IOException e) {
            System.out.println(e.toString());
        }
        return null;
    }
}

@@ -248,24 +248,100 @@
 nce = null;%0A
+    private final String API_ENDPOINT = %22https://graph.facebook.com/v2.3/%22;%0A
     private 
@@ -890,90 +890,26 @@
 ing 
-apiEndpoint = %22https://graph.facebook.com/v2.3/%22;%0A        String url = apiEndpoint
+url = API_ENDPOINT
  + n
@@ -1120,154 +1120,8 @@
 l);%0A
-            if (obj.has(%22error%22)) %7B%0A                System.out.println(obj.getJSONObject(%22error%22).getString(%22message%22));%0A            %7D else %7B%0A    
     
@@ -1144,22 +1144,8 @@
 bj;%0A
-            %7D%0A
     

Make api endpoint constant