Assist with PTV Api path signature generation

Usage no npm install needed!

<script type="module">
  import ptvApiSignature from '';



PTV API signature generator

Hacked together a method for the API signature generation only

If you are after a full fledged swagger client implementation see ptv-api npm


First obtain a dev id and key from PTV here

If using in the browser - Please consider that you will need to support the crypto nodejs module. A polyfil exists here

Example usage

const ptvSig = require ('ptv-api-signature')
const BASE_URL = ''
const DEV_ID  =  'REPLACE'
const DEV_KEY =  'REPLACE1-1111-1111-1111-111111111111'

* Search for stops based on search term
* @param {String} search_term
const getStopsBySearchTerm = (search_term)  =>  {
return fetch(`${BASE_URL}${ptvSig.pathWithSig(`/v3/search/${search_term.toLowerCase()}`,  [{ name:  'route_types', value:  '0'  }], DEV_ID, DEV_KEY)}`).then(res  =>  res.json())

getStopsBySearchTerm('Balaclava').then(d => {