Click here to Skip to main content
14,495,596 members
Rate this:
Please Sign up or sign in to vote.
See more:
I need to write an integration for Shopify. Shopify is an ecommerce platform which lets you create an ecommerce website.
So I have to write a c# code which pulls product information from a Shopify store.
any example would be appreciated

What I have tried:

public string GetCustomers()
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            const string Url = "";
            var req = (HttpWebRequest)WebRequest.Create(Url);
            req.Method = "GET";
            req.ContentType = "application/json";
            req.Credentials = GetCredential(Url);
            req.PreAuthenticate = true;
            req.KeepAlive = false;

          //  req.ProtocolVersion = HttpVersion.Version10;
            using (var resp = (HttpWebResponse)req.GetResponse())
                if (resp.StatusCode != HttpStatusCode.OK)
                    string message = String.Format("Call failed. Received HTTP {0}", resp.StatusCode);
                    throw new ApplicationException(message);

                var sr = new StreamReader(resp.GetResponseStream());
                return sr.ReadToEnd();

        private static CredentialCache GetCredential(string url)
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
            var credentialCache = new CredentialCache();
            credentialCache.Add(new Uri(url), "Basic", new NetworkCredential("fd49a55f3afafd8ab40809516b", "ccb2e52e272c0c3f6bfa"));
            return credentialCache;
Updated 15-Jan-18 3:45am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Malikdanish 15-Jan-18 9:55am
this project is not opening in vs 2010/2013
Malikdanish 15-Jan-18 9:56am
my code gives error on that line " using (var resp = (HttpWebResponse)req.GetResponse())

The request was aborted: Could not create SSL/TLS secure channel
Malikdanish 15-Jan-18 12:47pm
static void Main(string[] args)
// Create a request for the URL.
WebRequest request = WebRequest.Create("");
// Set the credentials.
request.Credentials = new NetworkCredential("hhhh", "hhhh");
// Get the response.
HttpWebResponse response = null;
// This is where the HTTP GET actually occurs.
response = (HttpWebResponse)request.GetResponse();
catch (Exception a)
// Display the status. You want to see "OK" here.
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream();
// Open the stream using a StreamReader
StreamReader reader = new StreamReader(dataStream);
// Read the content. T
string responseFromServer = reader.ReadToEnd();
// Display the content.
// Cleanup the streams and the response.
that solve my issue

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100