how do you create theme with REST api

Highlighted
Excursionist
58 2 1

Hi what is the code to create a theme on a store using the REST theme api? I don't understand how to do it and what I have tried so far doesn't seem to work. I was following the nodejs and react tutorial for app development so if anyone can help me that would be great.

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1040 140 165

Hey @benjk,

 

You can create a theme using via the themes endpoint.

 

POST /admin/api/2020-01/themes.json
{
  "theme": {
    "name": "Some new theme"
  }
}

 

Once it's created, you can add assets via the assets endpoint:

PUT /admin/api/2020-01/themes/#{theme_id}/assets.json
{
  "asset": {
    "key": "templates/index.liquid",
    "value": "<p>Hello</p>"
  }
}
0 Likes