postman-cli 1.23.1 → 1.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +4 -1
  2. package/man/postman.1 +287 -2
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -64,7 +64,10 @@ This package automatically downloads the appropriate binary for your platform:
64
64
  - Windows (x64)
65
65
 
66
66
  > **Note:** Linux support excludes Alpine Linux distributions due to libc compatibility requirements.
67
- For Alpine environments, consider using alternative installation methods or running from a glibc-based base image.
67
+
68
+ ## Troubleshooting Installation
69
+
70
+ The Postman CLI relies on platform-specific binaries distributed as optional dependencies. If you encounter "Binary not found" errors, ensure you're not using `--no-optional` or `--omit=optional` flags during installation, and verify that your `.npmrc` configuration doesn't contain `optional=false`. Installation failures may also occur due to network/registry access issues blocking `@postman/*` scoped packages or when using an unsupported platform architecture.
68
71
 
69
72
  ## Resources
70
73
 
package/man/postman.1 CHANGED
@@ -1,4 +1,4 @@
1
- .TH POSTMAN 1 "2025-11-05" "v1.23.1" "Postman CLI Manual"
1
+ .TH POSTMAN 1 "2025-11-10" "v1.24.1" "Postman CLI Manual"
2
2
  .SH NAME
3
3
  postman \- Command\-line companion utility for Postman
4
4
  .SH SYNOPSIS
@@ -267,7 +267,7 @@ Eg. postman api publish <apiId> \-\-name v1\e
267
267
 
268
268
 
269
269
  .SS "runner"
270
- Run runners on your own environments for monitoring your APIs
270
+ [BETA] Run runners on your own environments for monitoring your APIs
271
271
 
272
272
  .B Usage:
273
273
  [options] [command]
@@ -415,6 +415,291 @@ Skip the prepare step before pushing
415
415
  .B \-y, \-\-yes
416
416
  Skip all confirmation prompts
417
417
 
418
+ .SS "request"
419
+ Send HTTP requests from the command line with full Postman capabilities including authentication, environment variables, assertions, retries, and detailed output control.
420
+
421
+ .B Usage:
422
+ [METHOD] <URL> [options]
423
+
424
+ .B Options:
425
+ .TP
426
+ .B \-H, \-\-header <header>
427
+ Add HTTP header in key:value format. Can be used multiple times. Example: \-H "Content\-Type:application/json" \-H "X\-API\-Key:abc123" (default: )
428
+ .TP
429
+ .B \-d, \-\-body <body>
430
+ Request body content. Supports: inline string, @filepath for file content, or "\-" for stdin. Example: \-\-body '{"name":"John"}' or \-\-body @data.json
431
+ .TP
432
+ .B \-f, \-\-form <field>
433
+ Add multipart/form\-data field in key=value format. Can be used multiple times. For file uploads use key=@filepath. Example: \-f "name=John" \-f "avatar=@photo.jpg" (default: )
434
+ .TP
435
+ .B \-e, \-\-environment <path>
436
+ Load Postman Environment by UUID or file path. Variables in URL, headers, and body will be resolved. Example: \-e dev.postman_environment.json
437
+ .TP
438
+ .B \-\-auth\-<type>\-<param> <value>
439
+ [Optional] Supply authentication parameters dynamically.
440
+ Use \-\-auth\-<type>\-<param> where <type> is the auth method and <param> is the parameter.
441
+ Supported auth types: basic, bearer, digest, oauth1, oauth2, hawk, aws, ntlm, apikey
442
+ Examples:
443
+ Basic Auth: \-\-auth\-basic\-username user \-\-auth\-basic\-password pass
444
+ Bearer Token: \-\-auth\-bearer\-token mytoken123
445
+ API Key: \-\-auth\-apikey\-key "X\-API\-Key" \-\-auth\-apikey\-value "abc123" \-\-auth\-apikey\-in header
446
+ AWS: \-\-auth\-aws\-accessKey KEY \-\-auth\-aws\-secretKey SECRET \-\-auth\-aws\-service s3
447
+ Type: string, Default: null
448
+ .TP
449
+ .B \-\-timeout <n>
450
+ Request timeout in milliseconds. Request will fail if no response within this time. (default: 300000)
451
+ .TP
452
+ .B \-\-redirects\-ignore
453
+ Prevents Postman CLI from automatically following 3XX redirect responses. By default, redirects are followed.
454
+ .TP
455
+ .B \-\-redirects\-max <n>
456
+ Maximum number of redirects to follow. Default is unlimited. Useful for preventing redirect loops.
457
+ .TP
458
+ .B \-\-redirects\-follow\-method
459
+ Preserves the original HTTP method when following redirects. By default, redirects are followed with GET method.
460
+ .TP
461
+ .B \-\-redirects\-remove\-referrer
462
+ Removes the Referer header when following redirects. By default, Referer header is sent with redirects.
463
+ .TP
464
+ .B \-\-retry <n>
465
+ Number of retry attempts for failed requests (4xx, 5xx, network errors). Useful for flaky endpoints or rate\-limited APIs. (default: 0)
466
+ .TP
467
+ .B \-\-retry\-delay <ms>
468
+ Delay between retry attempts in milliseconds. (default: 1000)
469
+ .TP
470
+ .B \-\-script\-pre\-request <script>
471
+ Add JavaScript script to run before the request. Can be inline JS or @filepath to load from file. Scripts have access to pm.* APIs. Example: \-\-script\-pre\-request "pm.environment.set('timestamp', Date.now());" or \-\-script\-pre\-request @setup.js
472
+ .TP
473
+ .B \-\-script\-post\-request <script>
474
+ Add JavaScript script to run after the request. Can be inline JS or @filepath to load from file. Scripts have access to pm.* APIs. Example: \-\-script\-post\-request "console.log(pm.response.json());" or \-\-script\-post\-request @validate.js
475
+ .TP
476
+ .B \-o, \-\-output <path>
477
+ Save complete response to JSON file.Useful for debugging or further processing.
478
+ .TP
479
+ .B \-\-verbose
480
+ Show detailed request and response information including headers, body, and metadata.
481
+ .TP
482
+ .B \-q, \-\-quiet
483
+ Quiet mode: suppress all output except response body. Useful for piping to other commands.
484
+ .TP
485
+ .B \-\-debug
486
+ Debug mode: show detailed execution information including retry attempts, redirects, and timing breakdowns.
487
+
488
+ .TP Examples:
489
+
490
+ Examples:
491
+
492
+ Basic Requests:
493
+ Simple GET request (method defaults to GET):
494
+ postman request https://api.example.com/users
495
+
496
+ GET request with explicit method:
497
+ postman request GET https://api.example.com/users
498
+
499
+ POST request with JSON body:
500
+ postman request POST https://api.example.com/users \e
501
+ \-\-body '{"name": "Alice", "email": "alice@example.com"}'
502
+
503
+ PUT request with body from file:
504
+ postman request PUT https://api.example.com/users/123 \-\-body @user\-data.json
505
+
506
+ DELETE request:
507
+ postman request DELETE https://api.example.com/users/123
508
+
509
+ Authentication:
510
+ Bearer token authentication:
511
+ postman request https://api.example.com/protected \e
512
+ \-\-auth\-bearer\-token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
513
+
514
+ Basic authentication:
515
+ postman request https://api.example.com/protected \e
516
+ \-\-auth\-basic\-username myuser \e
517
+ \-\-auth\-basic\-password mypass
518
+
519
+ API Key in header:
520
+ postman request https://api.example.com/data \e
521
+ \-\-auth\-apikey\-key "X\-API\-Key" \e
522
+ \-\-auth\-apikey\-value "abc123xyz" \e
523
+ \-\-auth\-apikey\-in header
524
+
525
+ API Key in query parameter:
526
+ postman request https://api.example.com/data \e
527
+ \-\-auth\-apikey\-key "apikey" \e
528
+ \-\-auth\-apikey\-value "abc123xyz" \e
529
+ \-\-auth\-apikey\-in query
530
+
531
+ AWS Signature v4 authentication:
532
+ postman request https://s3.amazonaws.com/my\-bucket/object \e
533
+ \-\-auth\-aws\-accessKey AKIAIOSFODNN7EXAMPLE \e
534
+ \-\-auth\-aws\-secretKey wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY \e
535
+ \-\-auth\-aws\-service s3 \e
536
+ \-\-auth\-aws\-region us\-east\-1
537
+
538
+ Headers and Forms:
539
+ Add custom headers:
540
+ postman request https://api.example.com/data \e
541
+ \-H "Content\-Type:application/json" \e
542
+ \-H "X\-Custom\-Header:custom\-value" \e
543
+ \-H "Accept:application/json"
544
+
545
+ Multipart form data (file upload):
546
+ postman request POST https://api.example.com/upload \e
547
+ \-f "file=@document.pdf" \e
548
+ \-f "title=My Document" \e
549
+ \-f "description=Important file"
550
+
551
+ Form data with multiple files:
552
+ postman request POST https://api.example.com/gallery \e
553
+ \-f "photos=@image1.jpg" \e
554
+ \-f "photos=@image2.jpg" \e
555
+ \-f "album_name=Vacation 2025"
556
+
557
+ Environment Variables:
558
+ Use Postman environment file:
559
+ postman request https://api.example.com/{{endpoint}} \e
560
+ \-e production.postman_environment.json \e
561
+ \-H "Authorization:Bearer {{auth_token}}"
562
+
563
+ Environment with authentication:
564
+ postman request POST https://{{base_url}}/api/data \e
565
+ \-e dev.postman_environment.json \e
566
+ \-\-body '{"userId": "{{user_id}}", "data": "test"}'
567
+
568
+ Pre\-Request and Post\-Request Scripts:
569
+ Inline pre\-request script (set timestamp before request):
570
+ postman request https://api.example.com/data \e
571
+ \-\-script\-pre\-request "pm.environment.set('timestamp', Date.now());"
572
+
573
+ Inline post\-request script (log response):
574
+ postman request https://api.example.com/users \e
575
+ \-\-script\-post\-request "console.log('Response:', pm.response.json());"
576
+
577
+ Load pre\-request script from file:
578
+ postman request https://api.example.com/data \e
579
+ \-\-script\-pre\-request @setup.js
580
+
581
+ Load post\-request script from file:
582
+ postman request https://api.example.com/users \e
583
+ \-\-script\-post\-request @validate.js
584
+
585
+ Combine both pre\-request and post\-request scripts (inline):
586
+ postman request POST https://api.example.com/orders \e
587
+ \-\-body '{"product": "widget", "quantity": 5}' \e
588
+ \-\-script\-pre\-request "pm.environment.set('requestTime', new Date().toISOString());" \e
589
+ \-\-script\-post\-request "const order = pm.response.json(); console.log('Order created:', order.id);"
590
+
591
+ Combine both scripts (from files):
592
+ postman request POST https://api.example.com/process \e
593
+ \-\-body @data.json \e
594
+ \-\-script\-pre\-request @setup.js \e
595
+ \-\-script\-post\-request @teardown.js
596
+
597
+ Use scripts for dynamic authentication (inline):
598
+ postman request https://api.example.com/protected \e
599
+ \-\-script\-pre\-request "pm.request.headers.add({key: 'X\-Request\-ID', value: Date.now().toString()});" \e
600
+ \-\-script\-post\-request "console.log('Status:', pm.response.code);"
601
+
602
+ Advanced post\-request script with validation (from file):
603
+ postman request https://api.example.com/users/123 \e
604
+ \-\-script\-post\-request @validate\-user\-response.js
605
+
606
+ Example setup.js file content:
607
+ // Set dynamic timestamp
608
+ pm.environment.set('timestamp', Date.now());
609
+ // Add custom header
610
+ pm.request.headers.add({
611
+ key: 'X\-Request\-Time',
612
+ value: new Date().toISOString()
613
+ });
614
+
615
+ Example validate.js file content:
616
+ // Validate response structure
617
+ const response = pm.response.json();
618
+ if (!response.id) {
619
+ console.error('Response missing required id field');
620
+ }
621
+ console.log('Validation passed for:', response.id);
622
+
623
+ Retry Logic:
624
+ Retry failed requests up to 3 times:
625
+ postman request https://api.flaky\-service.com/data \e
626
+ \-\-retry 3 \e
627
+ \-\-retry\-delay 2000
628
+
629
+ Retry with debug output to see all attempts:
630
+ postman request https://api.example.com/data \e
631
+ \-\-retry 5 \e
632
+ \-\-retry\-delay 1000 \e
633
+ \-\-debug
634
+
635
+ Output Control:
636
+ Save complete response to JSON file (status, headers, body, timings):
637
+ postman request https://api.example.com/data \-\-output response.json
638
+
639
+ Download binary file using quiet mode and shell redirection:
640
+ postman request https://cdn.example.com/archive.zip \-\-quiet > archive.zip
641
+
642
+ Quiet mode \- only output response body (useful for piping):
643
+ postman request https://api.example.com/data \-\-quiet | jq '.results[]'
644
+
645
+ Verbose mode \- show all request/response details:
646
+ postman request https://api.example.com/data \-\-verbose
647
+
648
+ Debug mode \- show execution details, redirects, timing:
649
+ postman request https://api.example.com/data \-\-debug
650
+
651
+ Advanced Use Cases:
652
+ Complete CI/CD health check with validation:
653
+ postman request https://api.production.com/health \e
654
+ \-\-timeout 5000 \e
655
+ \-\-retry 3 \e
656
+ \-\-retry\-delay 1000 \e
657
+ \-\-script\-post\-request "pm.test('Health check status', function() { \e
658
+ const resp = pm.response.json(); \e
659
+ pm.expect(resp.status).to.equal('healthy'); \e
660
+ });" \e
661
+ \-\-quiet
662
+
663
+ Long\-running request with complete response capture:
664
+ postman request https://api.example.com/long\-process \e
665
+ \-\-output response.json \e
666
+ \-\-timeout 300000 \e
667
+ \-\-verbose
668
+
669
+ Chain requests using jq and environment variables:
670
+ TOKEN=$(postman request POST https://api.example.com/login \e
671
+ \-\-body '{"username":"admin","password":"pass"}' \e
672
+ \-\-quiet | jq \-r '.token')
673
+
674
+ postman request https://api.example.com/protected \e
675
+ \-\-auth\-bearer\-token "${TOKEN}" \e
676
+ \-\-script\-post\-request "console.log('Authorized access granted');"
677
+
678
+ Request with environment variables and post\-processing:
679
+ postman request POST https://{{base_url}}/api/users \e
680
+ \-e dev.postman_environment.json \e
681
+ \-\-body '{"name": "{{test_user}}", "role": "admin"}' \e
682
+ \-\-script\-post\-request "const user = pm.response.json(); console.log('Created user with ID:', user.id);"
683
+
684
+ Usage Notes:
685
+ \- Quick API testing without leaving the terminal
686
+ \- CI/CD pipelines with pre/post\-request scripts for dynamic setup and validation
687
+ \- Automated health checks and monitoring
688
+ \- Replacing curl/wget with Postman's powerful features
689
+ \- Testing APIs with complex authentication schemes
690
+ \- Integration with Postman Environments for multi\-environment testing
691
+ \- Use pre\-request scripts to set dynamic values, headers, or environment variables
692
+ \- Use post\-request scripts to process responses, log data, or validate results
693
+
694
+ Exit Codes:
695
+ 0: Success (2xx\-3xx response, all tests passed)
696
+ N: Number of failed tests (e.g., exit code 3 means 3 tests failed)
697
+
698
+ Piping Output:
699
+ postman request https://api.example.com/users \-\-quiet | jq '.[] | .name'
700
+
701
+
702
+
418
703
  .SH SEE ALSO
419
704
  Full documentation: https://learning.postman.com/docs/postman\-cli/postman\-cli\-overview/
420
705
  .SH AUTHOR
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postman-cli",
3
- "version": "1.23.1",
3
+ "version": "1.24.1",
4
4
  "description": "Official Postman CLI - Command-line companion for API development, testing, and automation",
5
5
  "keywords": [
6
6
  "postman",
@@ -58,9 +58,9 @@
58
58
  "man/"
59
59
  ],
60
60
  "optionalDependencies": {
61
- "@postman/pm-bin-macos-arm64": "1.23.1",
62
- "@postman/pm-bin-macos-x64": "1.23.1",
63
- "@postman/pm-bin-linux-x64": "1.23.1",
64
- "@postman/pm-bin-windows-x64": "1.23.1"
61
+ "@postman/pm-bin-macos-arm64": "1.24.1",
62
+ "@postman/pm-bin-macos-x64": "1.24.1",
63
+ "@postman/pm-bin-linux-x64": "1.24.1",
64
+ "@postman/pm-bin-windows-x64": "1.24.1"
65
65
  }
66
66
  }