This c# code can connect sharepoint 2013 through restful by username and password

Thanks God, This c# code can connect sharepoint 2013 through restful by username and password

            HttpWebRequest endpointRequest = (HttpWebRequest)HttpWebRequest.Create("http://win-344c6v6tjp4:88/_api/web/lists");

            endpointRequest.Method = "GET";
            endpointRequest.Accept = "application/json;odata=verbose";
            NetworkCredential cred = new System.Net.NetworkCredential("administrator", "this is my password");
            endpointRequest.Credentials = cred;
            HttpWebResponse endpointResponse = (HttpWebResponse)endpointRequest.GetResponse();
            try
            {
                WebResponse webResponse = endpointRequest.GetResponse();
                Stream webStream = webResponse.GetResponseStream();
                StreamReader responseReader = new StreamReader(webStream);
                string response = responseReader.ReadToEnd();
                JObject jobj = JObject.Parse(response);
                JArray jarr = (JArray)jobj["d"]["results"];
                foreach (JObject j in jarr)
                {
                    Console.WriteLine(j["Title"] + " " + j["Body"]);
                }

                responseReader.Close();
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.Out.WriteLine(e.Message); Console.ReadLine();
            }

read count : 27