Third Light Developer Exchange

Code and templating community forum for developers and software integrators

You are not logged in.


If you wish to join the Developer Exchange, please contact your account manager - this is to avoid unnecessary spam in the forums. Many thanks for your understanding.

#1 2021-07-17 00:18:17

Registered: 2021-07-06
Posts: 4

ASP.Net - (501) Not Implemented


I get server error message (501) Not Implemented when using API to create an upload from Asp.Net.

The API works fine from Swagger UI.
curl -X PUT "https://chorus/rest/v1/uploads" -H "accept: application/json" -H "X-Chorus-Session: xD08seWiOWp8kmo7ySmkri8dPnDmYMsz" -H "Content-Type: application/json" -d "{ \"destinationFolderId\": \"cd0cb9d4-795d-4753-9aba-275e22c256b2\"}"

Asp.Net code

        protected void Button2_Click(object sender, EventArgs e)

            string url = "https://chorus/rest/v1/uploads";
            string data = "{ \"destinationFolderId\": \"cd0cb9d4-795d-4753-9aba-275e22c256b2\"}";
            string[] headers = { "accept:application/json", "X-Chorus-Session:xD08seWiOWp8kmo7ySmkri8dPnDmYMsz","Content-Type:application/json" };
            string strResponse = myclass.REST_API_Request(url, data, headers);

            myclass = null;

        public string REST_API_Request(string url, string data, string[] headers )
            WebRequest myReq = WebRequest.Create(url);
            foreach (string h in headers)
                string key = h.Split(':')[0];
                string val = h.Split(':')[1];

                myReq.Headers.Add(key, val);

            if (data != "")
                myReq.Method = "POST";
                myReq.ContentLength = data.Length;
                myReq.ContentType = "application/json; charset=UTF-8";

                UTF8Encoding enc = new UTF8Encoding();
                using (Stream ds = myReq.GetRequestStream())
                    ds.Write(enc.GetBytes(data), 0, data.Length);

            WebResponse wr = myReq.GetResponse();
            Stream receiveStream = wr.GetResponseStream();
            StreamReader reader = new StreamReader(receiveStream, Encoding.UTF8);
            string content = reader.ReadToEnd();

            return content;




Board footer