Skip to content

shanonplace/delete-taxonomy-schemes-and-concepts

Repository files navigation

Taxonomy Concept Deletion Script

This Node.js script deletes all taxonomy concepts and concept schemes in your Contentful organization using the Contentful Management API.

Setup

  1. Copy .env.sample to .env and fill in your credentials.

  2. Run npm install to install dependencies.

  3. Run the script in dry run mode (default): node delete-taxonomy-concepts-and-schemes.js

    To actually delete concepts and concept schemes, run: node delete-taxonomy-concepts-and-schemes.js --dry-run=false or node delete-taxonomy-concepts-and-schemes.js --no-dry-run

    The script uses minimist for argument parsing.

Environment Variables

  • CONTENTFUL_MANAGEMENT_TOKEN: Your Contentful management API token
  • ORGANIZATION_ID: Your organization ID

How it works

flowchart TD
	A[Start] --> B[Fetch all taxonomy concepts from the Organization]
	B --> C[Delete each concept]
	C --> D[Fetch all concept schemes from the Organization]
	D --> E[Delete each concept scheme]
	E --> F[Done]
Loading

Notes

  • By default, the script runs in dry run mode and will only show what would be deleted. No deletions will occur unless you pass --dry-run=false or --no-dry-run.
  • Before any deletion (or in dry run), the script automatically backs up all concepts and concept schemes to JSON files in the taxonomy-backup directory. The backup files include the organization ID and the current date/time in both the filename and the file contents.
  • This script will delete all taxonomy concepts and concept schemes in the specified organization using the Contentful plain client. Use with caution.
  • See Contentful API docs for more details.

About

Script to clear all taxonomy concepts and concept schemes from a Contentful Organization

Topics

Resources

Stars

Watchers

Forks