Admin Rest API - Collections endpoint?

Solved
ParanoidAndroid
Tourist
6 1 0

I don't see documentation about this endpoint, but if I pull it up in my browser (logged into my store first), it does produce a list of all my collections in my store as expected.

https://MYSTORE.myshopify.com/admin/api/2021-07/collections.json

ParanoidAndroid_0-1633359732924.png

 

My question is, why is this not documented, and why can I not do the same thing, with the x-shopify-access-token header, so I can do this programatically?

 

Accepted Solution (1)
ParanoidAndroid
Tourist
6 1 0

This is an accepted solution.

Ended up the only real solution is to use GraphQL here. Very easy to use if you already are using REST API.

$body = '{"query":"{  collections(first: 10) {    edges {      node {        id        handle        title      }    }  }}","variables":{}}';
//post that using curl to https://{shop_id}.myshopify.com/admin/api/2021-10/graphql.json
//include your x-shopify-access-token header

 

View solution in original post

Reply 1 (1)
ParanoidAndroid
Tourist
6 1 0

This is an accepted solution.

Ended up the only real solution is to use GraphQL here. Very easy to use if you already are using REST API.

$body = '{"query":"{  collections(first: 10) {    edges {      node {        id        handle        title      }    }  }}","variables":{}}';
//post that using curl to https://{shop_id}.myshopify.com/admin/api/2021-10/graphql.json
//include your x-shopify-access-token header