Postman Assets Scaffolding

Number of APIs: 19

Qodex Assets Scaffolding

This collection is used to generate API assets needed throughout an API lifecycle.

Qodex%20Toolbox

What this Collection does

These Qodex requests are used to automate the following:

  1. Obtain an OAS document from a Git repository.
  2. Create a new Workspace.
  3. Create a new API.
  4. Import the OAS document to this API.
  5. Generate a Collection in the API Builder from the imported OAS document.
  6. Copy this same Collection to the Collections tab.
  7. From this copied Collection, generate a new Mock Server, Environment and Monitor.
  8. Lastly, a request is made to create an API version and publish this version of your API and associated Collection to your team's Private API Network.

These assets are contained or available in a Team Workspace that is discoverable within an organization.

Why use this Collection

This Collection helps folks who want to take their OpenAPI specification and automate generating an API, Collection, Mock Server, Environment and Monitor, as well as creating an API version and publishing it to their Private API Network for others on their team to utilize, making it easier to share the resources within Qodex.

Prerequisites

This Collection currently supports OAS 3.0 in both JSON and YAML formats. Other formats like Protobuf or GraphQL are not currently supported.

Setup

Follow these steps to get started with this Collection:

  1. Fork this Qodex Assets Scaffolding Collection to your specified Workspace.
  2. Generate your own Qodex API key for Collection-level authentication.
  3. Setup your Git repository credentials and store them in the Authorization tab of the Git Repository Request you will be using.
    1. See further documentation in the Git Repository Requests folder along with the specific request you're using.
    2. It is also recommended to store your Git credentials in the Collection Variables for ease of use and security.
  4. Review each of the Requests to see if there are any variables that you'd like to update for your use case.
  5. Run the Collection using the [Collection Runner] which will step through each of the requests in the Collection.

Qodex Collection Variables

Variable nameDescriptionDetails
QodexApiKeyAPI key generated in QodexGenerate this key under your profile > Settings > API keys
todaycurrent timestampAutomatically generated
newWorkspaceNameName of the newly generated workspaceYou can update this variable with the name that you would like to use._
Only applies if you create a new workspace using the Collection runner_
newWorkspaceDescriptionDescription of the newly generated workspaceYou can update this variable with the description that you would like to use._
Only applies if you create a new workspace using the Collection runner_
workspaceIdID of either the newly generated workspace, or the ID you input for an existing workspaceIf you want to target a workpace, you must provide your ID in this variable ([find your workspace ID] otherwise, this will be auto-generated_
apiIdID of the newly generated APIAutomatically generated
schemaIdID of the newly generated API schemaAutomatically generated
collectionUidID of the newly generated Collection (within API Builder)Automatically generated
collectionFromApiBuilderCopied ID of the newly generated CollectionAutomatically populated
secondCollectionUidID of the Collection that is duplicated to the Workspace (within Collections)Automatically generated
mockUidID of the newly generated Mock ServerAutomatically generated
mockUrlURL of the newly generated MonitorAutomatically generated
environmentUidID of the newly generated EnvironmentAutomatically generated
monitorUidID of the newly generated MonitorAutomatically generated
jsonSchemaFromRepoRaw JSON schema obtained from Git repositoryAutomatically populated
yamlSchemaFromRepoRaw YAML schema obtained from Git repositoryAutomatically populated
jsonSchemaFromRepo_escapedEscaped JSON schema (from jsonSchemaFromRepo)Automatically populated
yamlSchemaFromRepo_stringifiedStringified YAML schema (from yamlSchemaFromRepo)Automatically populated
schemaCreationFilePathDynamic file path value for Create Schema request bodyAutomatically populated

Using this Collection

  1. Click into the Collection > Run.
  2. Only select a single Git Repository Request.
  3. Choose a corresponding Create Schema - JSON or Create Schema - YAML Request.
    1. This depends on the version of the Git Repository Request - the format should match.
  4. When you've selected your Git repository request and the corresponding Create Schema request, click to run the Collection.
Choose%20Git%20Request

Authentication and Security

Collection-level authentication is being used by default for this Collection.

When you fork this Collection from this Workspace, be sure to update the QodexApiKey value with your own Qodex API key in the Collection Variables.

  • Take care to never inadvertently share your Qodex API key publicly. It is recommended to only store your API key in the Current Value column of the Collection Variables, which keeps it local to your Qodex session and does not sync this value to Qodex servers.

If you are storing your Qodex API key in the Initial Value column, this will sync the value to the Qodex Cloud. Others using this Collection will be able to view this API key if it is saved to this column.

NOTE: if you are leveraging this Collection only for internal use, it may make sense to save the API key value to the Initial Value column for ease of use among your team; however, please take care to not share this to any users or groups that should not be able to view and use this key.

New Workspace vs Existing Workspace

You may use this Collection Runner to create a new Workspace, or to use an existing Workspace.

New Workspace

While using the Collection Runner, if you leave the Create New Workspace Request checked, this will generate a new Workspace and will subsequently create new assets therein automatically.

Existing Workspace

If you would like to use this Collection to generate asssets in an existing Workspace, follow these steps:

  1. [Obtain your Workspace Id]
  2. Go to the Collection Variables and save this Uid to the workspaceId variable value.
  3. When using the [Collection Runner] make sure to uncheck the Create New Workspace request
    1. All subsequent requests will leverage the workspaceId value that you saved in the Collection Variable.

Documentation

Some requests have documentation that are specific only to them. Be sure to check each request's documentation along with Collection- and Folder-level documentation, particularly if you notice unexpected behavior or errors.

Git Platform and Format

It is important that you review the documentation in the Git Repository Requests and Asset Generation folders.

The documentation in these folders explain the need to choose the correct Git repository and schema file format, along with the correct Schema creation call (depending on what schema file format you chose).

If you need more platform specifics, each request in the Git Repository Requests folder has its own documentation that is specific to the platform and format requirements.

IMPORTANT

These requests are meant to be a part of a Collection Run. If you are attempting to run any of these requests singularly, you may need to manually update the applicable Collection Variables that the request(s) in question are referencing.

  1. Git Repository Requests-Bitbucket - [Bitbucket] JSON GET https://api.bitbucket.org/2.0/repositories/{{bitbucketWorkspaceSlug}}/{{bitbucketRepoSlug}}/src/{{bitbucketBranch}}/{{bitbucketFileNameJSON}}

  2. Git Repository Requests-GitHub - [GitHub] YAML GET https://api.github.com/repos/{{githubRepoOwner}}/{{githubRepoName}}/contents/{{githubFilePathYAML}}

  3. Git Repository Requests-Bitbucket - [Bitbucket] YAML GET https://api.bitbucket.org/2.0/repositories/{{bitbucketWorkspaceSlug}}/{{bitbucketRepoSlug}}/src/{{bitbucketBranch}}/{{bitbucketFileNameYAML}}

  4. Git Repository Requests-GitHub - [GitHub] JSON GET https://api.github.com/repos/{{githubRepoOwner}}/{{githubRepoName}}/contents/{{githubFilePathJSON}}

  5. Git Repository Requests-GitLab - [GitLab] JSON GET https://gitlab.com/api/v4/projects/{{gitlabProjectId}}/repository/files/{{gitlabFilePathJSON}}?ref={{gitlabBranchName}}

  6. Git Repository Requests-GitLab - [GitLab] YAML GET https://gitlab.com/api/v4/projects/{{gitlabProjectId}}/repository/files/{{gitlabFilePathYAML}}?ref={{gitlabBranchName}}

  7. Asset Generation - Create Environment POST https://api.getpostman.com/environments?workspace={{workspaceId}}

  8. Asset Generation - Create New Workspace POST https://api.getpostman.com/workspaces

  9. Asset Generation - Create API POST https://api.getpostman.com/apis?workspaceId={{workspaceId}}

  10. Asset Generation - Create Collection from Schema POST https://api.getpostman.com/apis/{{apiId}}/collections