Tag: postman

  • Testing the Nomad Pipeline Audio to Post Endpoint: A Step-by-Step Guide

    Testing the Nomad Pipeline Audio to Post Endpoint: A Step-by-Step Guide

    The Nomad Pipeline Audio to Draft plugin for WordPress allows you to automatically transform an audio file from your Media Library into a structured draft post using AI. Our plugin registers an ability that converts an audio file into post content via the Abilities API. This allows you to send HTTP requests from an external app or service to run the ability automatically.

    We use Postman to run clean, repeatable, and automated tests against our endpoints.

    This guide will show you exactly how to set up your environment, securely manage authentication, execute a happy-path request, and automate response capture.

    Prerequisites Checklist

    Before firing up Postman, verify that you have these pieces ready:

    • An active WordPress 7.0+ site running over HTTPS.
    • The Plugin installed and active on your test environment.
    • A WordPress account with the edit_posts capability (Editor or higher is recommended).
    • An Application Password generated from your WordPress user profile screen (do not use your regular login password).
    • An audio file pre-uploaded to your Media Library (note its ID).

    Setting Up Your Postman Environment

    When building API workflows, reproducibility is everything. Hardcoding URLs and credentials into your requests makes your collection brittle and creates security risks. Instead, we use a Postman Environment to separate operational parameters from sensitive tokens.

    Step 1: Create the Environment

    Create a new environment in Postman
    Create a new environment in Postman

    In Postman, create a new environment and populate it with these keys:

    Variables vs. Secrets

    • Regular Variables: These are structural values that change depending on your environment or test case. Examples include base_url, media_id, and external_run_id.
    • Sensitive Variables (Secrets): These are authorization credentials. In Postman, mark your wp_user and wp_app_password as secret type variables. This masks their values on screen and prevents you from accidentally leaking them.
    New Postman environment
    Add variables and secrets for your environment

    💡 Pro-Tip on external_run_id: This ID is crucial for Idempotence—the guarantee that submitting the exact same request multiple times won’t accidentally spin up duplicate processing jobs or clone your posts. For a fresh test, bump the suffix (e.g., -001, -002). To test if your server correctly handles duplicates, deliberately resend the request with the exact same ID.

    Step 2: Configure the main POST request

    Create an HTTP request and connect it to your Environment
    Create an HTTP request and connect it to your Environment

    Create a new HTTP request and select your environment from the menu located in the top-right corner of Postman.

    Next, let’s build the primary execution request.

    • Method: POST
    • URL: {{base_url}}/wp-json/wp-abilities/v1/abilities/nomad-pipeline-audio-to-draft/audio-to-post/run
    • Headers: Content-Type: application/json
    Configure the HTTP request
    Configure the HTTP request

    Step 3: Setting Up Authentication

    Do not inject credentials manually into your JSON payload or headers. Instead:

    1. Click on the Authorization tab of your request.
    2. Select Basic Auth from the Type dropdown.
    3. In the Username field, type: {{wp_user}}
    4. In the Password field, type: {{wp_app_password}}

    Postman will securely encode these variables behind the scenes into a standard HTTP Authorization header.

    Setting up Basic Auth for your request
    Setting up Basic Auth for your request

    Step 4: The request body payload

    Switch to the Body tab, select raw, and set the format type to JSON. Then paste the following request payload:

    {
      "input": {
        "contract_version": "1.0.0",
        "external_run_id": "run-ext-20260721-002",
        "source": "api",
        "audio": {
          "media_id": 134
        },
        "editorial_options": {
          "language": "en-US",
          "tone": "professional",
          "target_length": "medium",
          "temperature": 0.3
        },
        "proper_noun_hints": [
          "WordPress",
          "OpenAI",
          "Nomad Pipeline"
        ],
        "publish_options": {
          "status": "draft"
        }
      }
    }

    Important: the request payload must be wrapped inside input as an object. If you send fields at the root level, the API returns ability_invalid_input (for example: input is not of type object).

    Setting the request body payload
    Setting the request body payload

    Understanding the Key Parameters

    • audio: This field accepts a single input strategy. In our example, we pass a native media_id. Alternatively, the API accepts a signed_url or a raw base64 payload accompanied by a mime_type. Never mix these strategies in a single request!
    • proper_noun_hints: A highly practical list of custom terms, brands, or unique names. This tells the underlying AI model exactly how to spell industry-specific or personal terms properly during transcription and writing.
  • Verify the WordPress backend: If the response is pending or processing, poll again using your run workflow until it reaches completed. Then grab the generated post_id, open your WordPress admin dashboard, and verify the document exists with your expected settings (for example, saved as draft).
  • The JSON response of the Abilities API
    The JSON response of the Abilities API

    Troubleshooting and Verification Checklist

    When checking your results, use this clean workflow to verify success or isolate failures:

    1. Verify the WordPress Backend: Once a request returns a completed status, grab the generated post_id, open your WordPress admin dashboard, and ensure the document exists with your specified settings (e.g., saved safely as a draft).
    2. Handle 401 rest_forbidden errors: If you encounter this, your application password configuration is hitting a snag. Ensure you didn’t include extra trailing spaces when copying the password, and double-check that your server isn’t stripping HTTP Authorization headers before they reach WordPress.
    3. Isolate test failures: If you encounter unexpected system errors, don’t blindly resend the exact same data. Always assign a fresh, distinct value to external_run_id in your environment parameters to start a completely isolated, clean pipeline test.

    Common 400 errors

    • ability_invalid_input with message input is not of type object: your payload is missing the input wrapper.
    • ability_invalid_input with message about source (or other required fields): one or more required fields inside input are missing.