Project

General

Profile

Actions

Defect #10013

closed

Rest API - Create Version -> Internal server error 500

Added by Juraj Tomana almost 13 years ago. Updated almost 13 years ago.

Status:
Closed
Priority:
Urgent
Assignee:
-
Category:
REST API
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

I'm trying to create new version in project using Rest API using C# code:

Uri address = new Uri("http://myredmineserver/projects/test/versions.xml?key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");

      WebRequest request = WebRequest.Create(address);
      request.Method = "POST";
      string xml =
        "<?xml version=\"1.0\"?>\n" +
          "<version>\n" +
          "<project id=\"45\"/>\n" +
          "<name>1.0.0.10</name>\n" +
          "<due_date>2012-01-16</due_date>\n" +
          "<description>test test</description>\n" +
          "</version>";
      byte[] byteArray = Encoding.UTF8.GetBytes(xml);
      request.ContentType = "application/xml";
      request.ContentLength = byteArray.Length;
      Stream dataStream = request.GetRequestStream();
      dataStream.Write(byteArray, 0, byteArray.Length);
      dataStream.Close();
      WebResponse response = request.GetResponse();
      Console.WriteLine(((HttpWebResponse)response).StatusDescription);

I always get error 500: Internal server error.

Actions

Also available in: Atom PDF