Can I change a date on shopify blog using api?

2019-09-14 05:49发布

问题:

I must be brief, not much time left...

I'm trying to backdate some blog posts that were written in the run-up to our store launch.

I'm using curl from the command line and I can POST new blog articles, and I can PUT changes to existing blog articles, but I can't adjust the date of the existing articles yet.

Can you help me?

Thanks!

Here's my curl request...

curl -i  -H "Content-Type: application/json" -H "Accept: application/json" -X PUT -d '{ "article": {"id": xxxxxx, "created_at": "2012-08-25"}}' https://key:passwordlongstringhere@storename.myshopify.com/admin/blogs/#blogID/articles/#articleID.json

And yes, all the appropriate xxxx and #blogID have the right info in my request.

回答1:

Created at dates can not be set through the API or admin.



回答2:

The created_at field is read-only, as mentioned by John. However, you can change the published_at date to backdate the post as you desire.



回答3:

The connection will fail with "curl: (35) Unknown SSL protocol error in connection to shopname.myshopify.com:443" unless you add --sslv3 to the curl parameters. I have successfully used your example with this parameter to change the published date on a blog post via the api.