Import saved Postman responses

Your collection already describes a useful API exchange. Bring its saved response examples into a Gostly service, then point your application at that service for replay.

Start here when you have curated example responses. Keep your collection runner and application assertions as the owners of test logic.

Before you start

Use the licensed self-hosted Gostly installation and its local operator dashboard. Have permission to manage an isolated example workspace and service. These instructions describe the licensed product, not the separate OSS proxy CLI. A synthetic file can be inspected without an installation; importing and checking it requires the running stack.

Follow Install & Deploy if the stack is not ready. Review the shared import data-handling contract before uploading.

Download and inspect the input

A synthetic collection with one request and one saved JSON response. The reserved .invalid hostname is a placeholder; it is not a live API.

Download orders.postman.json

Expected imported route: GET /orders/order_demo_001. Expected response: 200 · application/json.

{
  "info": {
    "name": "Synthetic order example",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "Read a ready order",
      "request": {
        "method": "GET",
        "url": "https://orders.example.invalid/orders/order_demo_001"
      },
      "response": [
        {
          "name": "Ready order",
          "code": 200,
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "body": "{\"id\":\"order_demo_001\",\"status\":\"ready\",\"total\":42}"
        }
      ]
    }
  ]
}

Expected response body

{
  "id": "order_demo_001",
  "status": "ready",
  "total": 42
}

Prepare a safe source file

  • Work from a copy. Remove production tokens, cookies and private values from request headers, auth blocks, URLs, query values, bodies, variables and saved response examples.
  • Save a response example for every request you intend to test. A request without one imports as an empty 200 response with a warning.
  • Keep the complete request URL as a string or raw URL, including its query. A structured query list without a raw URL is not reconstructed by this importer; check the imported route.
  • Keep the one response case your first test needs. Multiple saved responses do not become a collection workflow or an ordered test sequence.

Import into the target service

  1. Prepare a target service. In an installed example workspace, create an empty service with Upstream URL https://orders.example.invalid, Routing Type Path and Routing Value /orders. Use a workspace without an overlapping route for this path.
  2. Import the collection. In the local operator dashboard, open Seed, choose orders.postman.json, select the service and Postman format, then Commit seed. Keep deduplication on for this file.
  3. Review the result before replay. Look for one added mock and GET /orders/order_demo_001 in the result. Read every warning and check the stored response. Sign-in pages, challenges, rate limits and errors carried inside a success response can be screened out.
  4. Run the client in MOCK mode. Switch the example service to MOCK. Pass your Gostly proxy origin as apiBase in the assertion below (http://localhost:8080 for the default local HTTP listener). The /orders path selects the service; the .invalid source hostname is not the client base URL.

For authenticated API uploads, use the parent's seeding endpoint instructions. A stored count does not prove the library is serving: an explicit reload rejection returns 502 after storage. Resolve the reload and inspect serving state before importing again.

Review options, warnings and the stored fixture

  • The dashboard exposes deduplication, which defaults on. It removes duplicates within one upload; it does not update existing mocks. Reimporting can add rows.
  • The API-only environment option accepts a URL-encoded JSON object, overlaid on collection variables before nested folder variables. It is not an environment-file upload. Response bodies and headers are not variable-interpolated.
  • The API-only keep_flagged option defaults false. Detected challenges, login pages/redirects, rate limits and errors inside 2xx bodies are screened before deduplication. Ordinary JSON 401, 404 or 500 error fixtures can remain. Review flagged entries rather than assuming every saved response was retained.

Read the full option contract and errors and warnings. Check the selected service, exact method/path/query, request body, response status, headers and body before relying on the imported case.

What the source supplies

Postman field mapping and limits
Source fieldImport behavior
Request method and URLThe method and path/query from a URL string or raw URL become the mock route. Include the complete raw URL when the query matters. The source hostname does not configure the target service.
Saved response examplesEach saved example becomes a candidate mock with its status, response headers and body, subject to screening and credential redaction.
Request bodyRaw bodies carry over. Form and multipart fields become a simple text representation; file uploads need a separate replay check.
Folders and variablesFolders flatten into requests. Collection/folder values can resolve in URLs and request bodies; unresolved placeholders produce warnings. Resolve the values you need before importing.
Scripts, authentication and assertionsConfigure these in your client or test runner. Import does not execute pre-request/test scripts or turn auth settings into request headers.

Check replay and application behavior

Save this JavaScript in your test harness and call the exported function with the Gostly proxy origin as apiBase. It is a reader-owned assertion; importing the file does not execute it. The reserved source hostname does not become the client base URL.

import assert from "node:assert/strict";

// Pass the base URL of your client configured to use Gostly.
export async function checkReadyOrder(apiBase) {
  const response = await fetch(
    new URL("/orders/order_demo_001", apiBase)
  );
  assert.equal(response.status, 200);
  assert.deepEqual(await response.json(), {
    id: "order_demo_001",
    status: "ready",
    total: 42
  });
}

This is a reader-owned assertion for the synthetic fixture. Add the application behavior you care about, such as rendering the ready state or enabling fulfilment.

  • Confirm the selected service is in MOCK mode and the request reached Gostly.
  • For a test upstream you control, deny live access or assert its request counter did not increase during this check.
  • Check the status and parsed response, then assert the behavior in your application. A successful import alone does not check that behavior.

Common questions

Can I import a collection without saved responses?

Yes, but each request without a saved example becomes an empty 200 response and produces a warning. Save a meaningful example before using that route in an application test.

Will my Postman environment and scripts run in Gostly?

Scripts do not run on import. Collection and folder values can resolve in request URLs and bodies; the seeding API also accepts a variable overlay. Import does not reproduce Postman's full variable scopes, runtime or authentication workflow.

Does importing the same file again update the existing mocks?

Yes. Each import syncs one import source of the service. Importing the same collection again, recognized by its Postman collection id or as the same file, refreshes that source: new requests are added, changed ones are replaced and ones the collection no longer has are removed. Rows a person edited or deleted stay as they are, and recordings and hand-made rows are not touched. Deduplication is separate: it removes repeated rows within one upload, based on method, route, status and response body. See Seed a Mock Library for named import sources.

Continue with your own case

Return to Seed a Mock Library for shared import, reload and storage behavior. Follow MOCK replay to inspect the response served to your application. Keep the useful client assertion as you expand coverage.