ADCImportExport.Program.AzureDataCatalog.Update C# (CSharp) Method

Update() public method

public Update ( string postPayload, string viewType, string &id ) : string
postPayload string
viewType string
id string
return string
            public string Update(string postPayload, string viewType, out string id)
            {

                var fullUri = string.Format("https://api.azuredatacatalog.com/catalogs/{0}/views/{1}?api-version=2016-03-30", CatalogName, viewType);

                string requestId = null;
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(fullUri);
                request.Method = "POST";
                try
                {
                    var response = SetRequestAndGetResponse(request, out requestId, postPayload);
                    var responseStream = response.GetResponseStream();

                    id = response.Headers["location"];

                    StreamReader reader = new StreamReader(responseStream);
                    return reader.ReadToEnd();
                }
                catch (WebException ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(ex.Status);
                    Console.WriteLine("Request Id: " + requestId);
                    if (ex.Response != null)
                    {
                        // can use ex.Response.Status, .StatusDescription
                        if (ex.Response.ContentLength != 0)
                        {
                            using (var stream = ex.Response.GetResponseStream())
                            {
                                using (var reader = new StreamReader(stream))
                                {
                                    Console.WriteLine("Failed Update of asset: " + postPayload.Substring(0, 50));
                                    Console.WriteLine(reader.ReadToEnd());
                                }
                            }
                        }
                    }
                    id = null;
                    return null;
                }
            }