Skip to content

Instantly share code, notes, and snippets.

@patrykkalinowski
Created December 14, 2017 12:50
Show Gist options
  • Save patrykkalinowski/bfb784708c7bf42e851c00a51f171cb3 to your computer and use it in GitHub Desktop.
Save patrykkalinowski/bfb784708c7bf42e851c00a51f171cb3 to your computer and use it in GitHub Desktop.
require 'rest-client'
require 'json'
properties = File.open('./hubspot-contact-properties-list-shortened.txt')
request = "http://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=APIKEY&showListMemberships=true&formSubmissionMode=all&count=1000"
properties.each do |property|
request << "&property=#{property}"
end
response = JSON.parse(RestClient.get(request))
puts "Received contacts: #{response['contacts'].count}"
puts "Received contact datapoints: #{response['contacts'].first.keys.count}"
puts "Received properties: #{response['contacts'].first['properties'].count}"
puts "Received properties: #{response['contacts'].first['properties'].keys}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment