Skip to content

Instantly share code, notes, and snippets.

@Shigawire
Last active Apr 12, 2017
Embed
What would you like to do?
---
title: FAQ Export
published: true
listed: false
hande: faq-export
slug: faq-export
response_type: application/json
---
{
"requests": [
{% for faq_entry in contents.faq_entries %}
{
"action": "addObject",
"body":
{
"objectID": "{{ faq_entry._id | escape }}",
"title": "{{ faq_entry.title | escape }}",
"body": "{{ faq_entry.body | strip_html | strip_newlines | escape }}",
"url": "https://<mysite>{% path_to faq_entry %}"
}
}
{% unless forloop.last %}
,
{% endunless %}
{% endfor %}
]
}
APPLICATION_ID=ALGOLIA_APP_ID API_KEY=ALGOLIA_API_KEY
curl https://<mysite>/faq-entries-export > batchFile.json
curl -X POST \
-H "X-Algolia-API-Key: ${API_KEY}" \
-H "X-Algolia-Application-Id: ${APPLICATION_ID}" \
--data-binary @batchFile.json \
"https://${APPLICATION_ID}.algolia.net/1/indexes/<algolia_index>/batch"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment