@postman/postman-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.1.11 • Public • Published

Postman

About

This SDK instruments express app to capture http requests for auto-generating accurate postman live collections.

Installation

npm install @postman/postman-sdk

Supported Instrumentations

Instrumentation Supported Version SDK Version Tested
Sails >=1.5.3 >=0.1.6
Express >=4.18.2 >=0.1.6
http(nodejs) >=14 >=0.1.6
Fastify* >=3.0.0 >=0.1.8

Please Note : While other frameworks/variations of these frameworks (express derivatives) might work with our SDK, but they have not been extensively tested and might lead to discrepancies in results. We recommend using the specified framework or version to ensure accurate and consistent outcomes.

Note for Fastify support - Starting the server with fastify-cli using fastify start is not supported.

Initializing the SDK

At the top of your app.js file, before app is initialized add this.

initialize({
  collectionId: 'postman-collection-id'
  apiKey: '<your-postman-api-key>'
});

Configuration

SDK's initialization can be configured with these values

  • collectionId: Postman collectionId where requests will be added. This is the id for your live collection.

    • type: string
  • apiKey: Postman api key needed for authentication.

    • type: string
  • receiverBaseUrl: Where the data should be shipped to receiver's http endpoint.

    • type: string(valid url)
  • bufferIntervalInMilliseconds: The interval in milliseconds that the SDK waits before sending data to Postman. The default interval is 5000 milliseconds. This interval can be tweaked for lower or higher throughput systems.

    • type: number
    • default: 5000
  • enable: enable or disable the SDK. Disabled SDK does not capture any new traces, nor does it use up system resources.

    • type: boolean
    • Can be set by using an environment variable 'POSTMAN_SDK_ENABLE' , which will over-ride any other config
  • debug: Enable/Disable debug logs.

    • type: boolean
  • truncateData: Truncate the request and response body so that no PII data is sent to Postman. This is enabled by default. Disabling it sends actual request and response payloads.

    • type: boolean

    • default: true

    • Example:

      Sample payload or non-truncated payload:

      {
          "first_name": "John",
          "age": 30
      }

      Truncated payload:

      {
          "first_name": {
              "type": "String"
          },
          "age": {
              "type": "Number"
          }
      }
  • redactSensitiveData: Redact sensitive data such as api_keys and auth tokens, before they leave the sdk. When this is enabled, below redaction rules are applied by default (they are not case-sensitive):

      {
          "pmPostmanAPIKey": "PMAK-[a-f0-9]{24}-[a-f0-9]{34}",
          "pmPostmanAccessKey": "PMAT-[0-9a-z]{26}",
          "pmBasicAuth": "Basic [a-zA-Z0-9]{3,1000}(?![a-z0-9+({})!@#$%^&|*])[=]{0,2}",
          "pmBearerToken": "Bearer [a-z0-9A-Z\-\._~\+\/]{15,1000}"
      }
    • type: Object {enable: true/false, rules: {ruleName: '<regexPattern>'}}
    Example
    initialize(
      collectionId: '<postmanCollectionId>'
      apiKey: '<apiKey>',
      redactSensitiveData: {
        enable: true, // default
        rules: {
          apiToken: 'PMAK-[a-f0-9]' // Sample rule, you can add your own regex
        }
      }
    )
  • ignoreIncomingRequests: Return true/false to ignore incoming request from Live Collection

    Example
    initialize({
      ...otherParams,
      ignoreIncomingRequests: (request) => {
        return request.url.includes('knockknock');
      }
    });
  • ignoreOutgoingingRequests: Return true/false to ignore outgoing request from Live Collection

    Example
    initialize({
      ...otherParams,
      ignoreOutgoingRequests: (request) => {
        return request.headers['User-Agent'].includes('ignoreme');
      }
    });
  • samplingRatio - The ratio in which the traces generated should be sampled.

    • type: number
    • default: 1
    • For Example: 0.1 sampling ratio means 10% of the traces sampled.

Readme

Keywords

none

Package Sidebar

Install

npm i @postman/postman-sdk

Weekly Downloads

140

Version

0.1.11

License

See LICENSE in LICENSE.md

Unpacked Size

64.4 kB

Total Files

58

Last publish

Collaborators

  • basile.barrincio
  • hoanguyenn
  • shreyansh.goyal
  • harikrishna.postman
  • sajal001
  • michaelhudelsonpostman
  • dima-postman
  • ihor.mariichyn
  • andrii.lymych
  • michael.browning
  • yevhenii.stepanov
  • arpit.sahu
  • akshat-nema
  • postman-web-platform-functional-account
  • ian.cundiff
  • rebecca.krosnick
  • soriat
  • meetsuraj2
  • nitish-postman
  • shub_postman
  • joshnedelkapostman
  • kevin.corbett
  • carlos.garcia.postman
  • anirudh.ms
  • akira28
  • cecilytoro
  • sumedha.kulkarni
  • suman.das
  • yashishdua
  • rljohnsn
  • salomekbg_postman
  • vtyson
  • indraneel_postman
  • grantkingpostman
  • shivangibajpai12
  • abhilash-postman
  • raghavendra-postman
  • ravi-postman
  • jedliu-postman
  • amaan.khan.postman
  • diwakarshukla_postman
  • imran.munir
  • markgritterpm
  • shruthivee
  • rajaswa
  • aki-kusanagi
  • yokawasa
  • ankit834
  • saurabh.agarwal
  • itsaamirpostman
  • postmanaut
  • noah.schwartz
  • dkrape
  • saurabh.vartak
  • wheatspaghetti
  • himanshu.ng056
  • honeynair
  • tonyzebastian
  • kasey.seo
  • parthverma
  • neha.kaura
  • josephps
  • parthpverma
  • muskaan06
  • sapnanayak
  • akshay_postman
  • jeroenvdpoll
  • harsuyash
  • ayush.chowdhury
  • plgah
  • sobtiankit
  • aravind-arun
  • smoya
  • mcturco
  • skatikia
  • dhinesh.sridhar
  • aman-pm
  • danek_szy
  • alexgul4enko
  • pamzani
  • fran.mendez
  • jonaslagoni
  • guru.pochineni
  • navneetbhole
  • piyush.daga
  • himanshu.vishwakarma
  • shraddha-arora-postman
  • anshitbansal
  • prathameshh
  • nitishpostman
  • yashja.in
  • varshini59
  • aviralpostman
  • theerthasenan
  • shikharpostman
  • amanpostman
  • greenblade29
  • anuragmewar
  • chris_pm
  • jk-postman
  • tphipps
  • akshay.kulkarni
  • vedkribhu
  • samarth.gulati
  • razvi07
  • cleverom
  • planetabhi
  • tiara.johnson
  • joe.fusco
  • jonathanhaviv
  • mudit.joshi
  • piyush.r
  • anjali2022
  • gkorosc-postman
  • raisinten
  • itsaamir
  • vinayak.parashar
  • rafaeltf
  • apoorv.gupta.postman
  • adrian.santana
  • kylerrenn94
  • jelle.vandevelde
  • atanas.a
  • samithjaganath
  • pranavj2000
  • pwitcher
  • anandh619
  • diegog24
  • atchyut.pulavarthi
  • kevinswiber-postman
  • sanketpath
  • opi-danihelka
  • arvind.khadri
  • cboornazian
  • irena-postman
  • rohan.grover
  • vincentbarth
  • aniketbewal
  • romulo-nascimento
  • ruben.baraut
  • arsh_13
  • tapanchudasama
  • akash.rajpurohit_postman
  • harsh.postman
  • rtlockwood
  • harshit.kochar
  • auddypostman
  • patricksevat
  • akinard-pm
  • ayush.jain
  • laszlogreczi
  • bhoomikaduapostman
  • roy-himanshu
  • nidhi_goyal
  • alexander-rubia
  • arjun.golabhanvi
  • anil.jnanoji
  • gbadebo.bello
  • ravi.prasad
  • jatin-postman
  • bharadwajpoduri7
  • liteshpatil17
  • tilak-patel-postman
  • hasnain.rajan
  • elizabeth.fung
  • manavbharambe
  • preetham.m
  • dhuhindhan.ilango
  • nishat.sayyed
  • rubencasas
  • sterling.chin-postman
  • anubhav-vats
  • adityabaradwaj
  • timhall
  • asutosh.sahoo
  • prasant.patel
  • bot_marketing_engineering
  • shreyansh_post
  • vaishnavichalla
  • lorenzo.ambrosi
  • arnaudlauret_postman
  • christina.hastenrathplus1
  • postman-dakshraj.sharma
  • ekansh-01
  • devsharma
  • ayushman9454
  • tonygo
  • postmanian
  • davidtran33
  • rutvik_gs
  • dsanders11
  • akkeshavan
  • rishabh.shukla
  • riyasaini
  • yash-postman
  • karnsharma
  • priyambadamadala
  • gaurav.rakheja
  • suhas_gaikwad
  • umeshp7
  • darshan.sen
  • yatin1997
  • kartikj
  • saswatds
  • sujayvenaik
  • kratigya
  • shubham.ranjan
  • davidespi
  • numaanashraf
  • shamasis
  • godfrzero
  • abhijitkane
  • kunagpal
  • hg07
  • kamalaknn
  • nikithaachhini
  • shreyas.panduranga
  • pratiksolim
  • sivcansingh
  • bhargavkaranam96
  • ronak.npm
  • codenirvana
  • tristandenyer
  • sabih.siddiqui
  • shashwat.dixit
  • kriss1897
  • gunjan4542
  • meetdeveloper
  • pawanbana
  • shreyshah
  • vshingala
  • barshan23
  • coditva
  • skrpl
  • jibinmathews7
  • diuda
  • postbot-bitbucket
  • postbot-buildkite
  • dannydainton
  • brandonmcastillo
  • michaelclaus
  • devansh21
  • arshad.ayub
  • sharma.nikhil1997
  • smitshah173
  • atishay-postman
  • saket_ranjan
  • dhawan29
  • arlemi.postman
  • akshaytate01
  • pankajk0791
  • mdamankh
  • apoorvajain08
  • james-postman
  • arvind-kalra
  • diptarag
  • dip_postman
  • akshay24
  • chetan.waingankar
  • axelonet
  • balakrishna.avulapati
  • harsha.dixit
  • saialekhya.yerragunta
  • pranav.singhal
  • amrindersandhu
  • deepanshurana
  • mudit1804
  • prashant-raghu
  • waseem.siddiqui
  • hemendra.kumar
  • bswisher
  • himanshu0809
  • avinashchoudhary
  • gouthamaj
  • shubham.joshi
  • ankitsaini
  • dev-pawankumar
  • tim.beauchamp
  • iamnishantgarg
  • amrit_vyas
  • ayush.raj
  • himanshu.s
  • brent.cromarty
  • sandeep.singh
  • abhijeetborole
  • mehul.agrawal
  • sonymathew
  • hardik286
  • appurvamurawat
  • poojat
  • phani-postman
  • chinmayj195
  • harsh_bansal
  • srinivas.kini
  • jony.cheung.postman
  • rrc083
  • diya.ninan
  • shruti_paranjape
  • utsav.kapoor1994
  • abhishek_s
  • subhash.yadav
  • pankajkumar05
  • prithvi.tharun
  • ashish.gupta1
  • joshuawise_postman
  • bot.npm.cf.starship
  • divy.khare
  • meenakshi.dhanani