Manually Importing JSON

Looking to import all my previous posts from a Strap instance I had running. I’ve got an export json file, possible to just iterate over it and post each using the POST API?

axios.post(
        "https://micro.blog/micropub",
        querystring.stringify({
          h: "entry",
          name: article.title,
          content: article.body,
          date_published: article.published_at,
          categories: [category.Tag],
        }),

Having troubles setting the date on a new post, and adding an existing category to it? Not seeing anything in the api docs, might just be missing it

1 Like

think I figured it out

axios.post(
        "https://micro.blog/micropub",
        querystring.stringify({
          h: "entry",
          name: article.title,
          content: article.body,
          published: article.published_at,
          category: [category.Tag],
        }),

Glad you got it working. Yes, the Micropub API field name is just “published” for the date. (In JSON Feed it’s “date_published”.)

1 Like

I thought it’d be helpful to share the full script here if you need to upload some exported posts that are in JSON format.

2 Likes

Thanks, @Jtomchak!