Advertisement
Guest User

Untitled

a guest
Aug 25th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.40 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using RestSharp;
  7. using System.Web;
  8. using System.IO;
  9.  
  10.  
  11. namespace myWorkAppV2
  12. {
  13.     class voloApi
  14.     {
  15.         public const string volo_username = "aziz.a4c";
  16.         public const string volo_password = "";
  17.         public const string volo_api_url = "http://all4cars.esellerpro.com/eSellerProAPI/services/api/rs/";
  18.  
  19.         public static void sampleVoloAPiRequest()
  20.         {
  21.             var client = new RestClient();
  22.             client.BaseUrl = new Uri(volo_api_url);
  23.             client.Authenticator = new RestSharp.Authenticators.HttpBasicAuthenticator(volo_username, volo_password);
  24.  
  25.             var request = new RestRequest("partialProducts", Method.PUT);
  26.             request.AddParameter("StockNumber","100103");
  27.             request.RequestFormat = DataFormat.Xml;
  28.  
  29.             publicObject.api_stockUpdate item = new publicObject.api_stockUpdate();
  30.             item.Location = "Rezaw - Dropshipping";
  31.             item.Quantity = "33";
  32.             item.StockUpdateType = "Delivery";
  33.  
  34.             request.AddXmlBody(item);
  35.  
  36.             //request.AddBody(item);
  37.  
  38.             var response = client.Execute(request);
  39.  
  40.             StreamWriter writer = new StreamWriter("apiResult.txt");
  41.             writer.Write(response);
  42.             writer.Close();  
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement