Skip to content
Joshua Harms edited this page Dec 20, 2023 · 1 revision

Blogs

In addition to an online storefront, Shopify shops come with a built-in blogging engine, allowing a shop to have one or more blogs. This service is for interacting with blogs themselves, not blog posts.

Creating a Blogs

var service = new BlogService(myShopifyUrl, shopAccessToken);
var blog = await service.CreateAsync(new Blog()
{
    Title = "My new blog"
});

Getting a Blog

var service = new BlogService(myShopifyUrl, shopAccessToken);
var blog = await service.GetAsync(blogId);

Updating a Blog

var service = new BlogService(myShopifyUrl, shopAccessToken);
var blog = await service.UpdateAsync(blogId, new Blog()
{
    Comments = "moderate"
});

Listing Blogs

var service = new BlogService(myShopifyUrl, shopAccessToken);
var blogs = await service.ListAsync();

Counting Blogs

var service = new BlogService(myShopifyUrl, shopAccessToken);
var count = await service.CountAsync();

Deleting a Blog

var service = new BlogService(myShopifyUrl, shopAccessToken);

await service.DeleteAsync(blogId);
Clone this wiki locally