Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@postman/postman-sdk

Package Overview
Dependencies
Maintainers
349
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@postman/postman-sdk

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

  • 0.0.46
  • npm
  • Socket score

Version published
Maintainers
349
Created
Source

About

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

Installation

npm install @postman/postman-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.
    • type: string
  • apiKey: Postman api key needed for collector
    • type: string
  • receiverBaseUrl: Where the data should be shipped to collector's http endpoint.
    • type: string(valid url)
    • default: Postman's servers
  • bufferIntervalInMilliseconds: Time interval for data queueing. Export is triggered after every interval.
    • type: number
    • default: 5000
  • enable: enable or disable tracing.
    • type: boolean
    • Can be set by using an environment variable 'POSTMAN_SDK_ENABLE' , which will over-ride any other config
  • debug: Enable debug logger
    • type: boolean
  • truncateData: Changes data in request/response body from {key: value} to {key: { type: typeof(value) } }
    • type: boolean
    • default: false
  • environment: Instrumentation environment development/prod etc. ( implementation TO-DO)
    • type: string
  • redactSensitiveData: Regex rules to redact data from requests.
    • type: { enable: true/false, rules: { ruleName: ''}}
    Example
    initialize(
      collectionId: '<postmanCollectionId>'
      apiKey: '<apiKey>',
      redactSensitiveData: { 
        enable: true,
        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
    • type: Function(request: http.IncomingMessage) : boolean
    • For propertires available on request see: https://nodejs.org/docs/latest-v14.x/api/http.html#http_class_http_incomingmessage
    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')
      }
    })
    

FAQs

Package last updated on 10 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc