[Postman API] Filter collections by workspace

Hi,

My company is starting to use postman pro and we’re planning on using a workspace for each different project we’re working on. We are thinking of using a different collection for each version of the project, so that the previous versions remain documented as the project evolves.

We would like to automate the duplication of the current version being worked on when we decide to «close» the current version. For example, I have a collection called «Develop» and would like to make a copy to the same workspace and call it v10.50, and the next time I would copy it to 10.51, etc.

I found that you can get and create collections from your account using the postman API, so I’m thinking it would be possible to get a collection and create a new one using the data retrieved from the API.

It looks like it is possible to create a new collection inside a specific workspace but I haven’t found a way to find a collection within a specific workspace, the «get all collections» endpoint doesn’t seem to accept a «workspace» parameter.

I can’t rely on the name of the collection either because several collections in different workspaces can have the same name.

I guess if I can’t find any other way I could keep the id of the current version’s collection for each workspace in a file somewhere and refer to it that way but I would prefer not having to do that if possible.

Also, if someone knows a better way to do what I want, I would be glad to hear it.

Thanks in advance.

You can get a list of collection ids belonging to a particular workspace in the GET single workspace endpoint. Look at the example response for this request https://docs.api.getpostman.com/#feefc577-d86b-4a71-8c06-9816e0df970d.

You can use this collection id to get details of the collection.

Thank you for the quick reply!