Workspace Clone Utility
Number of APIs: 11
This workspace will clone a workspace of your choice so the original stays pristine and you get a throwaway
copy that you can freely edit for demo purposes.
DISCLAIMER: this collection is very much still in beta mode, you may come across some bugs - feel free to contact Carson on slack if we're connected, or on twitter at @carrrson
Setup
- You will need a Qodex api key stored in your global variables under the name
api_key
. This will link the workspace to you using the/me
endpoint. - At the moment, any API schemas that are to be transferred with an API version need to be accessible by api (this was tested with the github integration, but store them wherever you like.)
You will need an environment per each workspace you would like to copy. In it, there should be:
- a
workspace_id
variable populated with the id of the workspace you want to copy - a
schemas
variable with an array populated as follows according to your workspace's apis. Note that this has only been tested so far with language=yaml and type=openapi3:[ { "schema": { "language": "yaml", "url": "[yourUrl]", "type": "openapi3", "schema":null }, "versionName": "[version name ('1.0.0', for example)]", "apiName": "[api name]" } ]
- a
config
array variable populated with an array linking your collections to their associated environments:
[
{
"collection":"NOVA Security User Management",
"env":"NOVA Security API"
}
]
How it works
There are two scenarios in which you may want to use this tool: copying a live
workspace, where everything is copied from a workspace as-is, or from a snapshot or backup
of a workspace.
- Get original workspace to a
golden state
. - Create an environment for the workspace you want to populate, and include the variables mentioned above in the setup instructions. You will only have to do this once, so if an admin has already set everything up for that particular workspace, you can just run the collection as normal.
Set up workspace info
- run this folder to populate your workspace information. If you are creating multiple copies, you can just run this folder once.RUN THIS TO POPULATE
- You guessed it. Run this folder to popualate the new workspace. You can change the naming config in theclone workspace
request in thecreate workspace
folder.- assuming there are no errors, check for your new workspace in the dropdown. it should be formatted as [your name]- [original workspace title]
Coming soon
- More flexibility around schema copying - should be able to provide schema in file form, or copy over from the original source if neither url or file version is provided
- Start monitors and create a history so they're not empty
- Create relations between API versions and collections that are linked in the original
- Is it possible to add the API status tag via api?
-
RUN THIS TO POPULATE-create workspace - Add mocks POST https://api.getpostman.com/mocks?workspace={{new_workspace_id}}
-
RUN THIS TO POPULATE-create workspace - Add monitors POST https://api.getpostman.com/monitors?workspace={{new_workspace_id}}
-
Set up workspace info-api data collection - get apis GET https://api.getpostman.com/apis?workspace={{workspace_id}}
-
Set up workspace info-api data collection - get all versions GET https://api.getpostman.com/apis/{{api_id}}/versions
-
RUN THIS TO POPULATE-create workspace - resolve mocks and monitors GET https://api.getpostman.com/monitors
-
RUN THIS TO POPULATE-add versions and schemas - Resolve schemas GET {{githubUrl}}
-
RUN THIS TO POPULATE-add versions and schemas - Add versions POST https://api.getpostman.com/apis/{{api_id}}/versions
-
RUN THIS TO POPULATE-add versions and schemas - Delete default version GET https://api.getpostman.com/apis/{{api_id}}/versions
-
RUN THIS TO POPULATE-add versions and schemas - Add schemas POST https://api.getpostman.com/apis/{{api_id}}/versions/{{thisVersionId}}/schemas
-
Set up workspace info-Bulid base state - Build workspace base state GET https://api.getpostman.com/workspaces/{{workspace_id}}