Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pitchbook API with JS and JQuery
const BASE_URL = "https://api.pitchbook.com"
const TOKEN = "TOKEN HERE"
$.ajaxSetup({
headers: { 'authorization': TOKEN }
});
const generalSearch = function(name) {
var def = jQuery.Deferred();
$.getJSON( BASE_URL + '/search?name=' + name, function( response ) {
def.resolve(response.results.results);
});
return def.promise();
}
const getCompanyProfile = function(companyID) {
var def = jQuery.Deferred();
$.getJSON( BASE_URL + '/companies/' + companyID['companyId'] + '/details', function( response ) {
// def.resolve(response);
console.log(response)
});
return def.promise();
}
const companySearch = function(keywords) {
var def = jQuery.Deferred();
$.getJSON( BASE_URL + '/companies/search?keywords=' + keywords, function( response ) {
const companyIDs = response.results.items;
companyIDs.forEach(function(companyObj, index){
getCompanyProfile(companyObj).then(function(companyProfile){
// console.log(companyProfile)
});
});
});
return def.promise();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment