Redirects
A Redirect lets you create URL redirects on a Shopify store. When a store visitor navigates to a redirect’s Path, they’ll be redirected to the redirect’s Target.
Creating a redirect
Section titled “Creating a redirect”var service = new RedirectService(myShopifyUrl, shopAccessToken);var redirect = new Redirect(){ Path = "/ipod", Target = "https://apple.com/ipod"}
redirect = await service.CreateAsync(redirect);Retrieving a redirect
Section titled “Retrieving a redirect”var service = new RedirectService(myShopifyUrl, shopAccessToken);var redirect = await service.GetAsync(redirectId);Updating a redirect
Section titled “Updating a redirect”var service = new RedirectService(myShopifyUrl, shopAccessToken);var redirect = await service.UpdateAsync(redirectId, new Redirect(){ Target = "https://apple.com/ipad", Path = "/ipad"});Deleting a redirect
Section titled “Deleting a redirect”var service = new RedirectService(myShopifyUrl, shopAccessToken);
await service.DeleteAsync(redirectId);Counting redirects
Section titled “Counting redirects”var service = new RedirectService(myShopifyUrl, shopAccessToken);int redirectCount = await service.CountAsync();
//Optionally filter the count to only those redirects with a specific path or targetint filteredRedirectCount = await service.CountAsync(path: "/ipod", target: "https://apple.com/ipod/");Listing redirects
Section titled “Listing redirects”var service = new RedirectService(myShopifyUrl, shopAccessToken);var redirects = await service.ListAsync();
//Optionally filter the list to only those redirects with a specific path or targetvar filteredRedirects = await service.ListAsync(new RedirectListOptions() { Path = "/ipod", Target = "https://apple.com/ipod"});