Afternoon,
Please see example code below:
usingSystem;
usingSystem.Collections.Generic;
usingSystem.IO;
usingSystem.Linq;
usingSystem.Net;
usingSystem.Text;
usingSystem.Threading.Tasks;
namespaceConsoleApplication1
{
classProgram
{
staticvoidMain(string[] args)
{
//Replace these with the actual tenant name, API key and ActionName
stringname=string.Empty;
stringapiKey=string.Empty;
stringactionName=string.Empty;
stringresult=string.Empty;
stringurl="https://api.euphoria.co.za/Euphoria.Api.aspx";
StringBuilderrequestString=newStringBuilder();
requestString.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
requestString.AppendLine("<XML>");
requestString.AppendLine("<Tenant>");
requestString.AppendFormat("<Name>{0}</Name>\n", name);
requestString.AppendFormat("<Auth>{0}</Auth>\n", apiKey);
requestString.AppendLine("</Tenant>");
requestString.AppendFormat("<ActionName>{0}</ActionName>\n", actionName);
// Add parameters here
requestString.AppendLine("</XML>");
try
{
// Request
HttpWebRequestrequestObj= (HttpWebRequest)WebRequest.Create(url);
requestObj.KeepAlive=false;
byte[] buffer=Encoding.ASCII.GetBytes(requestString.ToString());
requestObj.Method="POST";
requestObj.ContentLength=buffer.Length;
requestObj.ContentType="text/xml; encoding='UTF-8'";
requestObj.UserAgent="Example";
StreampostDataStream=requestObj.GetRequestStream();
postDataStream.Write(buffer, 0, buffer.Length);
postDataStream.Close();
// Response
HttpWebResponseresponse= (HttpWebResponse)requestObj.GetResponse();
if (response.StatusCode==HttpStatusCode.OK)
{
StreamReaderresponseStream=newStreamReader(response.GetResponseStream());
result=responseStream.ReadToEnd();
responseStream.Close();
responseStream.Dispose();
}
else
{
result="<Error>"+response.StatusDescription+"</Error>";
}
response.Close();
}
catch (Exceptionex)
{
Console.WriteLine(ex.Message);
}
Console.WriteLine(result);
Console.ReadLine();
}
}
}
Good day
Thanks for the assistance. Please see below feedback from my clients developers and please assist.
Hi Milton,
This still isn't ideal as its a bunch of C# code that is used to generate the XML data they require. We are not C# developers so we might miss something in trying to parse this code for exactly what they require.
Can they not just send us an explicit example of the XML we must send them? Surely they have prior examples?
Kind regards,
Doron
Good day
Please see below request from my clients developers.
Hi Milton,
This still isn't ideal as its a bunch of C# code that is used to generate the XML data they require. We are not C# developers so we might miss something in trying to parse this code for exactly what they require.
Can they not just send us an explicit example of the XML we must send them? Surely they have prior examples?
Kind regards,
DoronHi Milton,
This still isn't ideal as its a bunch of C# code that is used to generate the XML data they require. We are not C# developers so we might miss something in trying to parse this code for exactly what they require.
Can they not just send us an explicit example of the XML we must send them? Surely they have prior examples?
Kind regards,
Doron
Hi Milton,
Have you informed the developers of the following link on our site:
http://support.euphoria.co.za/support/solutions/109665
Unfortunately without knowing what language the developers are developing in it is impossible to provide accurate help, but doing a quick google search for "post xml to url using <insert coding language here>" should bring up quite a few examples of how to do the requested operation in the language specified, Alternatively if you would like to send us your developers contact number, I could arrange that both myself and my API developer schedule a conference call to discuss further, or to advise them on where the best place to start is, as we unfortunately do not develop applications for individual customers, but are happy to offer advise where we can.
You can email me directly on jon@euphoria.co.za, with the contact information.
Thanks and regards,
Milton
Hi could i please get assistance regarding a play load to be able to assist our developer to do a normal web request and post the xml to hte api URL. Since our developer can only do a REST or SOAP API to provide us with leads as our service provider could not do a NET API integration.