Giter Site home page Giter Site logo

deceptivescorpion / gpt-postman-collection-description-generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mclausaudio/gpt-postman-collection-description-generator

0.0 0.0 0.0 2.1 MB

Generates and updates a human-readable description for a Postman Collection using the OpenAI API, based on the collection ID provided as a command-line argument.

JavaScript 100.00%

gpt-postman-collection-description-generator's Introduction

GPT Postman Collection Description Generator

  • By Michael J. Claus

This script generates and updates a human-readable description for a Postman Collection using the OpenAI API, based on the collection ID provided as a command-line argument.

How it works is you provide a Postman Collection ID as a command-line argument, and the script will use the Postman API to retrieve the collection's name and the names of all of its folders and requests. It takes into account each requests name, endpoint, HTTP Method, and any pre-reqeuest script, post-request test script, and description if they are included. It will then use the OpenAI API to generate a description for the collection based on the collection name and the names of all of its folders and requests. The script will then ask you whether you want to update the existing description in Postman or not. Type `Y` to update the description or `N` to exit without updating.

A few key takeaways:

  • Working with the OpenAI API is surprisingly easy and straight forward!
  • Getting the prompt just right is tricky and takes lots of iteration, experimentation and tweaking.
  • Generating prompts consumes OpenAI Tokens, which you pay for. This is something to be mindful of when using the OpenAI API. It may be a good idea to include a token limit in the prompt generation if your collection has a lot of requests.

Note: The prompting and generated text can still definitely use some tweaking and it isn't perfect, but I think the project shows the potential of using the OpenAI API to generate descriptions for Postman Collections.

Quick Start

  1. Clone down the repo and cd into the root of the directory.
  2. Run npm install.
  3. Add a .env file containing values for POSTMAN_API_KEY=your_key OPENAI_API_KEY=your_key and OPENAI_ORGANIZATION_ID=your_org-id (you can get these from your Postman and OpenAI accounts).
  4. Run node main.js <collection_id> where <collection_id> is the ID of the Postman collection you want to generate a description for.

Example

Demo #1

Instagram Collection (I forked the collection and cleared the description so it would generate a new one). Before: During: After: Note: If a description already exists for the collection, it will generate a new one and ask if you want to overwrite the existing description.

Demo #2

JSONPlaceholder Collection (I created this collection and added some requests to it). Before: During: After:

Demo #3

Notion Collection (I forked the collection and cleared the description so it would generate a new one). Before: During: After:

Prerequisites

  • Node.js installed on your system
  • Postman API Key
  • OpenAI API Key and Organization ID

Installation

  1. Clone the repository:

git clone https://github.com/your-username/postman-collection-description-generator.git

  1. Navigate to the project directory:

cd postman-collection-description-generator

  1. Install the required dependencies:

npm install

  1. Create a .env file in the root directory of the project and add your Postman API Key, OpenAI API Key, and OpenAI Organization ID:

POSTMAN_API_KEY=your_postman_api_key OPENAI_API_KEY=your_openai_api_key OPENAI_ORGANIZATION_ID=your_openai_organization_id

Usage

Run the script with the collection ID as the first argument:

node main.js <collection_id>

Example:

node main.js 1081313-c3297b5a-b24e-405b-830e-005d457aa738

The script will generate a new description for the specified Postman Collection and ask you whether you want to update the existing description in Postman or not. Type `Y` to update the description or `N` to exit without updating.

License

This project is licensed under the MIT License. See the LICENSE file for details.

gpt-postman-collection-description-generator's People

Contributors

mclausaudio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.