Catalog
using System.Net; using System.IO; using System.Web.Script.Serialization; using System.Collections.Generic; using System; namespace SSActivewear { public class API { public class Request { public Request() { Method = ""; Host = "https://api.ssactivewear.com"; URLPath = ""; CustomerNumber = "YourCustomerNumber"; APIKey = "YourAPIKey"; ContentType = "application/json"; } private string Method { get; set; } private string Host { get; set; } private string URLPath { get; set; } private string CustomerNumber { get; set; } private string APIKey { get; set; } private string ContentType { get; set; } JavaScriptSerializer serializer = new JavaScriptSerializer(); //-------------------------Products------------------------- public void GET_Categories() { Method = "GET"; URLPath = "/v1/categories/71"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Host + URLPath); request.Method = Method; request.Credentials = new NetworkCredential(CustomerNumber, APIKey); string Result = ""; string ErrorText = ""; List Categories = new List(); try { HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader StreamReader = new StreamReader(response.GetResponseStream()); Result = StreamReader.ReadToEnd(); if (response.StatusCode == HttpStatusCode.OK) { Categories = serializer.Deserialize<List>(Result); } else { ErrorText = Result; } } catch (Exception ex) { ErrorText = System.Convert.ToString(ex.Message); } if (string.IsNullOrEmpty(ErrorText)) { for (int i = 0; i <= Categories.Count - 1; i++) { string CategoryName = System.Convert.ToString(Categories[i].name); } } } public void GET_Styles() { Method = "GET"; URLPath = "/v1/styles/00760"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Host + URLPath); request.Method = Method; request.Credentials = new NetworkCredential(CustomerNumber, APIKey); string Result = ""; string ErrorText = ""; List