Developer Forum [ All Topics | New Topic ]

Thread: Download Listing Service Integration

Hi,

We are downloading the diamond feed using the HTTP Post web service
1. DLS username and password to the authentication page.
2. Receive an encrypted ticket which is used to authenticate your session.
3. encrypted ticket to http://technet.rapaport.com/HTTP/DLS/GetFile.aspx Receive the diamond feed.
static void Main(string[] args)
{
//You must request a ticket using HTTPS protocol
string URLAuth = "https://technet.rapaport.com/HTTP/Authenticate.aspx";
WebClient webClient = new WebClient();
NameValueCollection formData = new NameValueCollection();
formData["Username"] = "myUser";
formData["Password"] = "myPassword";
byte[] responseBytes = webClient.UploadValues(URLAuth, "POST", formData);
string ResultAuth = Encoding.UTF8.GetString(responseBytes);
//After receiving an encrypted ticket, you can use it to authenticate your session.
//Now you can choose to change the protocol to HTTP so it works faster.
//Download File
string URL = "http://technet.rapaport.com/HTTP/DLS/GetFile.aspx";
WebRequest webRequest = WebRequest.Create(URL);
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
Stream reqStream = webRequest.GetRequestStream();
string postData = "ticket=" + ResultAuth;
byte[] postArray = Encoding.ASCII.GetBytes(postData);
reqStream.Write(postArray, 0, postArray.Length);
reqStream.Close();
HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();;
Stream stream = webResponse.GetResponseStream();
StreamReader reader = new StreamReader(stream);
string content = reader.ReadToEnd();
byte [] fileBytes = Encoding.ASCII.GetBytes(content);
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.ClearContent();
response.Clear();
response.ContentType = "application/csv";
response.AddHeader("Content-Disposition", "attachment; filename=fileName.csv;");
Response.BinaryWrite(fileBytes);
response.Flush();
response.End();
webResponse.Close();
after this code execution i get all diamonds data feed. but  i need those diamond feed which i  have checked.



Thanks,
Shobhit  Parasher



>> add a comment
shobhit
04/11/2017 09:46


2 Replies:

hi,

you should get diamonds that match your settings here https://member.rapnet.com/RapNet/Dls/GeneralSettings.aspx. can you please explain which diamonds you expect to get?

>> add a comment
Ephraim
4/13/2017 4:07:00 AM
hi,

you should get diamonds that match your settings here https://member.rapnet.com/RapNet/Dls/GeneralSettings.aspx. can you please explain which diamonds you expect to get?

>> add a comment
Ephraim
4/13/2017 4:07:00 AM