Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to automate removing all artifacts associated with an API Model when it is deleted from the dev portal

Not applicable

When deleting an API model from a dev portal environment, some artifacts are left behind in all dev portal environments. These artifacts are the smartdocs models taxonomy term (admin/structure/taxonomy/smartdocs_models), the view that filters on that taxonomy term (admin/structure/views -> taxonomy/term/my_api_model) and the content that was associated with each resource for that API (admin/content -> Filter:Type=SmartDocs Method).

So if I have a dev portal reserved for employees (internal site) and a dev portal open to the public (external site) and I delete a model from the internal site, there are still these artifacts in the internal and external site.

How can I automate a process to delete these artifacts from all environments? Since the model is gone, I see no reason to retain them and it is difficult to delete all of these artifacts manually.

Thank you for your time,

Mitchel

Solved Solved
1 3 166
1 ACCEPTED SOLUTION

@Mitchel Skees

Great Question & Welcome to Apigee Community 🙂

  • What happens when i create API Model in smartdocs ?
    • API Model information pushed to API Modelling data store associated with org.
    • That's the reason you see API Models across all environments.
    • Information that you see in "admin/content/smartdocs/models" & sub pages will be replicated across all portal which are connected to same Apigee Edge Org.
  • What happens when i publish / render API Model in smartdocs ?
    • Artifacts like taxonomy terms / nodes (pages which shows smartdocs) gets created & published in portal.
    • Artificats are stored in developer portal database mysql.
  • Does artifcats (Terms / Nodes) gets created automatically across all environments when i create API Model / publish API model in 1 environment ?
    • NO, You will see artifacts in that particular environment only. You shouldn't see terms / nodes across all environments.
  • I do see artifacts across all environements , what's the reason ?
    • When you clone the entire site from dev -> test -> live , portal database also cloned. That's the reason you see artifacts across all instances.
  • Does that mean when i create new API model & publish same in 1 environment , I see only API Model in listing but not any artificats like terms / nodes related to that API Model ?
    • Yes

Coming to your question,

  • Unless you have cloned entire site / manually published API Models in other environements there is no need to delete artifacts in other environment since they don't even exist.
  • What if some one manually published API models / created during site cloning from one environment to other environment ?
    • You need to manually delete same. I will explain how to clean same below.

How to manually delete same ?

  • I will delete nodes in "admin/content" first & then taxonomy terms.
    • It's very tricky if you have multiple API Models & hard to differentiate which content belongs to which API Model. How do i solve this issue ?
    • Create an admin view which filters smartdocs content by model name to delete same easily.
    • How to create same ?
    • I have attached a custom module, unzip same and add it to custom modules directory & enable same.
    • You can see admin view by navigating to "admin-view-filter-content-by-api-models"

2509-screen-shot-2016-04-21-at-24430-pm.png

  • Delete tags associated with API Model by navigating to "admin/structure/taxonomy/smartdocs_tags".
  • Delete API Model name taxonomy term by navigating to "admin/structure/taxonomy/smartdocs_models"

Agree, It's a not a great way to manage like above. See similar disucssion here which will help you manage API models by naming same according to environment so that you won't end up accidentally publishing / deleting other environment API models.

@Marsh Gardiner , @Daniel Johnson , @harsh , @Chris Novak Any inputs are welcome. Let us know what do you think about same ?

View solution in original post

3 REPLIES 3

@Mitchel Skees

Great Question & Welcome to Apigee Community 🙂

  • What happens when i create API Model in smartdocs ?
    • API Model information pushed to API Modelling data store associated with org.
    • That's the reason you see API Models across all environments.
    • Information that you see in "admin/content/smartdocs/models" & sub pages will be replicated across all portal which are connected to same Apigee Edge Org.
  • What happens when i publish / render API Model in smartdocs ?
    • Artifacts like taxonomy terms / nodes (pages which shows smartdocs) gets created & published in portal.
    • Artificats are stored in developer portal database mysql.
  • Does artifcats (Terms / Nodes) gets created automatically across all environments when i create API Model / publish API model in 1 environment ?
    • NO, You will see artifacts in that particular environment only. You shouldn't see terms / nodes across all environments.
  • I do see artifacts across all environements , what's the reason ?
    • When you clone the entire site from dev -> test -> live , portal database also cloned. That's the reason you see artifacts across all instances.
  • Does that mean when i create new API model & publish same in 1 environment , I see only API Model in listing but not any artificats like terms / nodes related to that API Model ?
    • Yes

Coming to your question,

  • Unless you have cloned entire site / manually published API Models in other environements there is no need to delete artifacts in other environment since they don't even exist.
  • What if some one manually published API models / created during site cloning from one environment to other environment ?
    • You need to manually delete same. I will explain how to clean same below.

How to manually delete same ?

  • I will delete nodes in "admin/content" first & then taxonomy terms.
    • It's very tricky if you have multiple API Models & hard to differentiate which content belongs to which API Model. How do i solve this issue ?
    • Create an admin view which filters smartdocs content by model name to delete same easily.
    • How to create same ?
    • I have attached a custom module, unzip same and add it to custom modules directory & enable same.
    • You can see admin view by navigating to "admin-view-filter-content-by-api-models"

2509-screen-shot-2016-04-21-at-24430-pm.png

  • Delete tags associated with API Model by navigating to "admin/structure/taxonomy/smartdocs_tags".
  • Delete API Model name taxonomy term by navigating to "admin/structure/taxonomy/smartdocs_models"

Agree, It's a not a great way to manage like above. See similar disucssion here which will help you manage API models by naming same according to environment so that you won't end up accidentally publishing / deleting other environment API models.

@Marsh Gardiner , @Daniel Johnson , @harsh , @Chris Novak Any inputs are welcome. Let us know what do you think about same ?

I would like to suggest Apigee create a cron job to scan the API Model Data Store and compare with the developer portal. If a model, taxonomy term or resource view is found out of sync, create a report and notify the admin. When the admin views the report all these artifacts are listed and grouped accordingly. Much like the view you created with options to edit, delete single or delete group. Can this be done?

Great Suggestion @Mitchel Skees , Ideally, It has to be completely automated. If API Model is deleted, All the artifacts should be deleted too. Let me loop in Dev Portal team. @harsh , @Daniel Johnson , @Chris Novak , @Marsh Gardiner FYI