public IHttpActionResult DeleteWebhook(string id, [FromUri] string token, [FromUri] string shopname)
        {
            var service = new ShopifyService();
            var webhooks = service.DeleteEntity("webhooks", token, shopname, id);

            return Ok(webhooks);
        }
        public IHttpActionResult GetCollections([FromUri] string token, [FromUri] string shopname,
            [FromUri] string[] fields, [FromUri] int top = 0)
        {
            var service = new ShopifyService();
            var collections = service.GetEntities("custom_collections", token, shopname, fields, top, null);

            return Ok(collections);
        }
        public IHttpActionResult GetCollection(string id, [FromUri] string token, [FromUri] string shopname,
            [FromUri] string[] fields, [FromUri] int top = 0)
        {
            var service = new ShopifyService();
            var collection = service.GetEntity("collections", id, token, shopname, fields, top);

            return Ok(collection);
        }
        public IHttpActionResult GetAccessToken([FromUri] string code, [FromUri] string shop)
        {
            var shopName = shop.Replace(".myshopify.com", "");
            var service = new ShopifyService();
            var token = service.GetAccessToken(code, shopName);

            return Ok(token); // Returns 401 if our App is'nt installed or the Token is invalid
        }
        public IHttpActionResult CreateWebhook([FromBody]JObject webhook, [FromUri] string token,
            [FromUri] string shopname)
        {
            var service = new ShopifyService();
            var webhooks = service.CreateEntity("webhooks", token, shopname, webhook);

            return Ok(webhooks);
        }
        public IHttpActionResult GetCustomer(string id, [FromUri] string token, [FromUri] string shopname,
            [FromUri] string[] fields, [FromUri] int top = 0)
        {
            var service = new ShopifyService();
            var customer = service.GetEntity("customers", id, token, shopname, fields, top);

            return Ok(customer);
        }
        public IHttpActionResult Login(string shopname)
        {
            var loginUrl = new ShopifyService().GetLoginUrl(shopname);

            return Redirect(loginUrl);
        }
        public IHttpActionResult GetWebhooks([FromUri] string token, [FromUri] string shopname,
            [FromUri] string[] fields, [FromUri] int top = 0)
        {
            var service = new ShopifyService();
            var webhooks = service.GetEntities("webhooks", token, shopname, fields, top, null);

            return Ok(webhooks);
        }
        public IHttpActionResult GetProducts([FromUri] string token, [FromUri] string shopname,
            [FromUri] string[] fields, [FromUri] int top = 0)
        {
            var service = new ShopifyService();
            var products = service.GetEntities("products", token, shopname, fields, top, null);

            return Ok(products);
        }
        public IHttpActionResult GetProduct(string id, [FromUri] string token, [FromUri] string shopname,
            [FromUri] string[] fields, [FromUri] int top = 0)
        {
            var service = new ShopifyService();
            var product = service.GetEntity("products", id, token, shopname, fields, top);

            return Ok(product);
        }
        public IHttpActionResult GetFilters([FromUri] string token, [FromUri] string shopname, [FromUri] string[] fields,
            [FromUri] int top = 0)
        {
            var service = new ShopifyService();
            var filters = service.GetEntities("customer_saved_searches", token, shopname, fields, top, null);

            return Ok(filters);
        }