Bulk-create entities
Import a directory of Markdown runbooks (or notes, knowledge docs) into Veirox entities in a single script.
Prerequisites
- CLI authenticated with a key that has
entities:writescope. - A directory of
.mdfiles (e.g../runbooks/).
Steps
#!/usr/bin/env bash
# bulk-import.sh
KIND="${KIND:-runbook}"
DIR="${DIR:-./runbooks}"
for file in "$DIR"/*.md; do
slug="$(basename "$file" .md)"
title="$(head -1 "$file" | sed 's/^# //')"
echo "Creating: $slug ($title)"
veirox entity create --kind "$KIND" --slug "$slug" --title "$title" --body-file "$file"
done
KIND=runbook DIR=./runbooks bash bulk-import.sh
Common pitfalls
- Duplicate slugs:
createfails if a slug already exists. Useveirox entity updatefor subsequent syncs (see the git hook recipe). - Title detection: the
head -1trick assumes the first line is an H1. Adjust for your file format.
See also
- ๐ Reference: veirox entity
- ๐ Concept: Entities
- ๐งโ๐ณ Recipe: Sync runbooks from git