New Section API Testing 406 Error

New Member
10 0 0

Hi,


I am testing out the new Sections API in a developer’s preview store (Unite 2019). I have built a public app to make requests to the admin Sections API.

 

I am trying to create a new section but I am not fully sure how this new feature works, as the documentation is understandably lacking.

 

I am trying to make a post request to “/master_pages.json”, with the request formatted like this:

{  
   "name":"test-section",
   "default":false,
   "sections":[  
      {  
         "id":"page",
         "title":"Test Section",
         "section_file":"pages/product.liquid"
      }
   ],
   "blocks":[  
      {  
         "id":"test-block",
         "type":"test-product-block",
         "settings":[  
            {  
               "autoplay":{  
                  "type":"checkbox",
                  "value":"true"
               }
            }
         ]
      }
   ]
}

I am receiving a 406 error (The requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request), I am not sure if this is because my request is incorrect or if the POST feature of this API is active yet?

 

Thanks

0 Likes
Highlighted
Shopify Staff
Shopify Staff
536 4 75

Hi there Addison.

 

Thanks for your question-  it looks like you were seeing a 406 error because the POST feature of this API was not active. However, we've now updated the feature so that master pages can now be created via the REST API. If you attempt this request again, it should work as expected. 

 

Hope this helps Addison- let me know if you run into other issues :)

 

Liam Griffin

Shopify | Developer Tools & Education

0 Likes