I'm using C# to access MS2PIP webserver via the RESTful API.
However, I immediately encountered an error when requesting a respond with the message: "500 Internal Server Error".
I'm not sure if it comes to the different version of API, but I used the similar code to run MS2PIP via the V1 API successfully last year.
My current codes are as follows.
string postData = "{\"params\":{\"frag_method\":\"CID\",\"ptm\":[\"Oxidation,15.994915,M\"]},\"peptides\":{\"spec_id\":[\"peptide1\",\"peptide2\"],\"peptide\":[\"SLMK\",\"GSNLR\"],\"modifications\":[\"3|Oxidation\",\"-\"],\"charge\":[2,3]},\"options\":{\"add_retention_time\":false}}";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://iomics.ugent.be/ms2pip/api/v2/task");
request.Method = "POST";
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
streamWriter.Write(postData);
streamWriter.Flush();
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
using (var streamReader = new StreamReader(response.GetResponseStream()))
{
responseFromServer = streamReader.ReadToEnd();
}
Solved.
For anyone who has this problem,
maybe you could try setting the protocol version by adding:
"request.ProtocolVersion = HttpVersion.Version10;"
Hi,
I'm using C# to access MS2PIP webserver via the RESTful API. However, I immediately encountered an error when requesting a respond with the message: "500 Internal Server Error". I'm not sure if it comes to the different version of API, but I used the similar code to run MS2PIP via the V1 API successfully last year.
My current codes are as follows.
Thank you very much.