Javascript API

matt145
New Member
2 0 0

Hello,

I created a static site for a customer years ago that recently created a shopify store to sell some products. If he was to use the shopify platform to create blog posts, could i access them via a GET request to display on the original site?

 

Thank you,

 

Matt

0 Likes
PBC
Excursionist
15 3 9

Hi 

You can use shopify api to get blog posts, but it should be done from the site backend (using php or something else). So you can make a request from the page to backend, then backend will fetch needed blog posts and return them to your page.

0 Likes
michaeltheodore
Explorer
59 6 8

You can access the Online Store Blogs using the Storefront API.

The Storefront API itself is written in GraphQL so there might be a learning curve but it does the job.

The API currently has the Blog endpoint so here it is

https://shopify.dev/docs/storefront-api/reference/online-store/blog

Let me know if this is enough or if you would like more information such as how to connect to the Storefront API with Apollo.

When you said you did a static site which framework or stack did you use?

0 Likes
matt145
New Member
2 0 0

Thank you both.

It is a create-react-app built and hosted on aws s3.

I'd rather not add a backend. Even adding apollo to pull the single blog post they might add seems a bit much. I think they should probably use shopify to develop the entire site into something more robust if this is something they need, of course that would mean porting features here and maybe other compatibility issues.

0 Likes