Best way to clear a space via CLI or library

For testing purposes I would like to delete everything in a space, both content and models. Is there an easy way to do that?

Alternatively I would be happy just deleting all content in a space if a subsequent import overwrites the existing models (e.g. if an Articles model already exists it’s fields will be overwritten by importing the definition of a new articles model with slightly different fields).

Hi @a.ritchie! Welcome!

This is a perfect use case for space environments! With a single API call or a few clicks in the webapp you can delete a sandbox environment. Here are some links to resources on space environments:

To answer your question directly, there isn’t an easy way to delete all the content and all the content types in a space. You’d have to get all the entries in a space, iterate through and delete each one, then get all the content types in the space, iterate through and delete each one.

Can you give some more details around what is the end goal you are trying to achieve? Thanks!

Hope this helps!