Jae Wilson @DataCrew

Convert Postman Collections into Functions using a little AI, dataclasses and a tone of Python

April 8, 2025

Hook (1-2 sentences): You've got a Postman collection full of API endpoints, but translating each one into a consistently-styled Python function is tedious, error-prone, and — frankly — beneath you. Here's how to use a structured AI prompt, Python dataclasses, and your own code samples to auto-generate an entire function library in one shot.

Why It Matters (2-4 sentences): Without this, every new API endpoint means another handwritten function — and if you're the only one on your team who writes in snake_case, uses a specific auth object pattern, or knows to call client.get_data_sync instead of raw requests, that knowledge doesn't transfer. LLMs don't know your codebase, your conventions, or your API's quirks unless you teach them. By embedding your own code samples directly into the prompt, you turn a general-purpose LLM into a function-writing assistant that mimics your exact style — reliably, at scale.

What You'll Learn

  • Understand why "just ask ChatGPT" fails for proprietary APIs and how pattern-injection fixes it
  • Structure a Postman collection so it can be parsed and passed to an LLM prompt
  • Build a Python dataclass schema to represent API endpoint metadata cleanly
  • Craft a prompt that teaches an LLM your coding conventions (naming, auth patterns, parameter style)
  • Generate a full library of typed, consistently-styled Python functions from a collection in one pass