How to retrieve collections not linked to any workspace?

Question for Kin:
Hello,
I discovered I have a lot of collections in Profile / My Collections, but only few of them are used in workspaces. I would like to know if there is an easy way, given a collection, to know if it belongs to a workspace or not, so that I can keep it or delete it.
Thanks in advance
Laurent

Hi, @LCHOLLET,

Welcome to the community!

You can do this using the Postman API. You need to:

  1. List all collections associated with your user.
  2. List all collections associated with all your workspaces.
  3. Locate all collections from step 1 that aren’t present in step 2.

This can be a little cumbersome. I created a script that uses postmanctl and jq to help out. You’ll need to install both tools, which should work cross-platform. The script, however, will need to be modified for Windows.

The script is here: https://github.com/kevinswiber/postmanctl/blob/master/examples/find-orphan-collections/find-orphan-collections.sh

This will only list the collection UIDs. You can use postmanctl to get more details: postmanctl describe collection <uid>.

Hope that helps,

Kevin

1 Like

Hi Kevin,

Thanks a lot for your help!

I have installed your tool but failed when configuring the API key.

Do you have an example of the expected content for

$HOME/.postmanctl.yaml

?

Thks again!

Laurent

Hi @LCHOLLET,

An example config file is here: https://github.com/kevinswiber/postmanctl/blob/master/configs/example.postmanctl.yaml, but you don’t have to edit this directly.

Here are instructions for configuring access: https://github.com/kevinswiber/postmanctl/tree/master/configs#configuring-access. You’ll need a Postman API Key to add to your configuration, which can be generated here: https://go.postman.co/settings/me/api-keys.

Hope that helps.

Best,

Kevin

Hi Kevin,

I succeed in having the list of orphans and could compare and check it is correct!

Thanks a lot

Laurent

1 Like