Friday 30 January 2015

Shopify API Integration from .NET

To Integrate Shopify first You need Key and Password

So to generate an API key and password, go to http://store.myshopify.com/admin/apps, and click "Create a private API key" at the bottom.It will generate password and key for you.



Then copy and paste this code ....

  public string GetCustomers()
        {
            const string url = "https://store.myshopify.com/admin/customers.json";

            var req = (HttpWebRequest)WebRequest.Create(url);
            req.Method = "GET";
            req.ContentType = "application/json";
            req.Credentials = GetCredential(url);
            req.PreAuthenticate = true;

            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("api-key", "password"));
            return credentialCache;
        }




Done;)

Tuesday 27 January 2015

Deploy PHP website from Visual Studio 2013 to Microsoft Azure Websites

Uf after 3 hours of struggle i found the solution for php deployment in Azure.

So First we have to download PHP Tools for Visual Studio 2013. I have given the URL from that you can download Or you have another option means you can download from Nuget package manager

https://visualstudiogallery.msdn.microsoft.com/6eb51f05-ef01-4513-ac83-4c5f50c95fb5

OR
Click on tool then click on Extensions and Updates



After that you will get new screen and search for php and install it.










Now you are ready to deploy PHP project in Azure. So now create a php project.

















Like that visual studio allow PHP developers to develop php projects and enhance the experience with Microsoft Azure.

However, when we are working with php projects we don’t have the same wizard for uploading like ASP.net or MVC solution.
This time you will get a screen like this.



















To retrieve the parameters required for Microsoft Azure Websites, You need to go to the website’s DASHBOARD and download the publish profile that contain all the information.



















One More things you must ensure that your website has enabled the correct version of PHP  for that go to CONFIGURE  then General  then  PHP Version











Thats it ... hope it helped you. :)