public virtual List <T> GetObjects <T>(int id, string parentNoun, RESTOptions <T> options) where T : Noun.Base.BaseNoun, new()
        {
            HttpWebResponse response = null;

            try
            {
                string restUrl = _serverURL + Constant.REST_BASE_PATH;
                if (!String.IsNullOrEmpty(parentNoun))
                {
                    restUrl += "/" + parentNoun;
                }
                else
                {
                    restUrl += "/" + Noun.Base.BaseNoun.GetNoun(typeof(T));
                }
                if (id > 0)
                {
                    restUrl += "/" + id;
                }
                if (!String.IsNullOrEmpty(parentNoun))
                {
                    restUrl += "/" + Noun.Base.BaseNoun.GetNoun(typeof(T));
                }
                string responseText = this.getObjectStringResponse(restUrl, options.GetPostParameters(), options.IfModifiedSince);

                return(JsonConvert.DeserializeObject <List <T> >(responseText));
            }
            finally
            {
                if (response != null)
                {
                    response.Close();
                }
            }
        }
        public virtual T GetObject <T>(int id, RESTOptions <T> options) where T : Noun.Base.BaseNoun, new()
        {
            HttpWebResponse response = null;

            try
            {
                string restUrl      = _serverURL + Constant.REST_BASE_PATH + "/" + Noun.Base.BaseNoun.GetNoun(typeof(T)) + "/" + id;
                string responseText = this.getObjectStringResponse(restUrl, options.GetPostParameters(), options.IfModifiedSince);

                T objT = JsonConvert.DeserializeObject <T>(responseText);
                return(objT);
            }
            finally
            {
                if (response != null)
                {
                    response.Close();
                }
            }
        }
        protected virtual string getObjectStringResponse(string baseUrl, Dictionary <string, object> parameters, DateTime ifModifiedSince)
        {
            string          responseText;
            HttpWebResponse response = null;

            try
            {
                string parameterString = RESTOptions <Noun.File> .GetUrlParameters(parameters);

                bool canGetAsPost = false;
                if (!String.IsNullOrEmpty(LastResponseHeaders.OpenAssetVersion))
                {
                    canGetAsPost = this.MeetsRESTRequirement(LastResponseHeaders.OpenAssetVersion, "9.0.0");
                }
                if (canGetAsPost && parameterString.Length > 1024)
                {
                    string formDataBoundary = String.Format("----------{0:N}", Guid.NewGuid());
                    byte[] formData         = GetMultipartFormData(parameters, formDataBoundary);
                    string contentType      = "multipart/form-data; boundary=" + formDataBoundary;

                    response = getRESTResponse(baseUrl, "POST", ifModifiedSince, formData, false, contentType, "GET");
                }
                else
                {
                    response = getRESTResponse(baseUrl + "?" + parameterString, "GET", ifModifiedSince);
                }
                TextReader tr = this.getReaderFromResponse(response);
                responseText = tr.ReadToEnd();
                tr.Close();
                tr.Dispose();
            }
            finally
            {
                if (response != null)
                {
                    response.Close();
                }
            }
            return(responseText);
        }
 public virtual List <T> GetObjects <T>(RESTOptions <T> options) where T : Noun.Base.BaseNoun, new()
 {
     return(GetObjects <T>(0, null, options));
 }