Convert a .Net Web client to an AXIOS Post

Job ID: 33716616

Budget: $10 – $30 USD

I have a .net WebRequest that Posts to an API that I want converted to a true Vue.JS AXIOS POST call. The call works and I have been using it for years. However I want to put it client side and need it changed. I know I can call it on the Server and pass down the results but I want to test pure client side at this time. The Response needs to be put into a comma separated string. The XML that is sent is in the attached file along with the expected response. I don't need an application just the code.

Dim req As WebRequest = Nothing
Dim rsp As WebResponse = Nothing
Dim sr As StreamReader = Nothing
Try
Dim uri As String = "http://profiles.catalyst.harvard.edu/services/GetPMIDs/default.asp"
req = WebRequest.Create(uri)
req.Method = "POST" ' Post method
req.ContentType = "text/xml" ' content type
' Wrap the request stream with a text-based writer
Dim writer As StreamWriter = New StreamWriter(req.GetRequestStream())
' Write the XML text into the stream
writer.WriteLine(xmlFile)
writer.Close()
' Send the data to the webserver
rsp = req.GetResponse()
sr = New StreamReader(rsp.GetResponseStream())
Dim cresponse As New StringBuilder
Dim response As String = sr.ReadToEnd

response = response.Replace("</PMID>", ",")
response = response.Replace("</PMIDList>", "")
response = response.Replace("<PMID>", "")
response = response.Replace("<PMIDList>", "")


response = response.TrimEnd(CChar(","))

Return response
Related categories: JavaScript Vue.js