People Data Labs Ruby Library
Official Ruby client for the People Data Labs API.
This is a simple Ruby client library to access the various API endpoints provided by People Data Labs.
This library bundles up PDL API requests into simple function calls, making it easy to integrate into your projects. You can use the various API endpoints to access up-to-date, real-world data from our massive Person and Company Datasets.
Table of Contents
- 🔧 Installation
- 🚀 Usage
- 🏝 Sandbox Usage
- 🌐 Endpoints
- 📘 Documentation
- ⚠️ Upgrading from v1.X.X to v2.0.0
- Add this line to your application's Gemfile:
gem 'peopledatalabs'
- And then execute:
$ bundle
Or install it yourself as:
$ gem install peopledatalabs
- Sign up for a free PDL API key
First, add your API Key:
Peopledatalabs.api_key = 'api_key'
Then, send requests to any PDL API Endpoint:
Using Person APIs
# By Enrichment
Peopledatalabs::Enrichment.person(params: { phone: '4155688415' })
# By Bulk Enrichment
Peopledatalabs::Bulk.person(params: {requests: [{params: {profile: ['linkedin.com/in/seanthorne']}}, {params: {profile: ['linkedin.com/in/randrewn']}}]})
# By Search (SQL)
Peopledatalabs::Search.person(searchType: 'sql', query: "SELECT * FROM person WHERE job_company_name='people data labs'")
# By Search (Elasticsearch)
Peopledatalabs::Search.person(searchType: 'elastic', query: {"query": {"term": {"job_company_name": "people data labs"}}})
# By PDL_ID
Peopledatalabs::Retrieve.person(person_id: 'qEnOZ5Oh0poWnQ1luFBfVw_0000')
# By Fuzzy Enrichment
Peopledatalabs::Identify.person(params: { name: 'sean thorne' })
Using Company APIs
# By Enrichment
Peopledatalabs::Enrichment.company(params: { website: 'peopledatalabs.com' })
# By Bulk Enrichment
Peopledatalabs::Bulk.company(params: {requests: [{params: {profile: ['linkedin.com/company/peopledatalabs']}}, {params: {profile: ['linkedin.com/company/apple']}}]})
# By Search (SQL)
Peopledatalabs::Search.company(searchType: 'sql', query: "SELECT * FROM company WHERE tags='big data' AND industry='financial services' AND location.country='united states'")
# By Search (Elasticsearch)
Peopledatalabs::Search.company(searchType: 'elastic', query: {"query": "must": [{"term": {"tags": "big data"}}, {"term": {"industry": "financial services"}}, {"term": {"location_country": "united states"}}]})
Using Autocomplete API
# Get Autocomplete Suggestions
Peopledatalabs::Autocomplete.retrieve(field: 'title', text: 'full', size: 10)
Using Cleaner APIs
# Clean Raw Company Strings
Peopledatalabs::Cleaner.company(kind: 'name', value: 'peOple DaTa LabS')
# Clean Raw Location Strings
Peopledatalabs::Cleaner.location(value: '455 Market Street, San Francisco, California 94105, US')
# Clean Raw School Strings
Peopledatalabs::Cleaner.school(kind: 'name', value: 'university of oregon')
Using Job Title Enrichment API
# Get Job Title Enrichment
Peopledatalabs::JobTitle.retrieve(job_title: 'data scientist')
Using Skill Enrichment API
# Get Skill Enrichment
Peopledatalabs::Skill.retrieve(skill: 'c++')
Using IP Enrichment API
# Get IP Enrichment
Peopledatalabs::Enrichment.ip(ip: '72.212.42.169')
# To enable sandbox usage, use the following flag
Peopledatalabs.sandbox = true
Person Endpoints
API Endpoint | peopledatalabs Function |
---|---|
Person Enrichment API | Peopledatalabs::Enrichment.person(...params) |
Person Bulk Person Enrichment API | Peopledatalabs::Bulk.person(...records) |
Person Search API | Peopledatalabs::Search.person(...params) |
Person Retrieve API | Peopledatalabs::Autocomplete.retrieve(...params) |
Person Identify API | Peopledatalabs::Identify.person(...params) |
Company Endpoints
API Endpoint | peopledatalabs Function |
---|---|
Company Enrichment API | Peopledatalabs::Enrichment.company(...params) |
Company Bulk Enrichment API | Peopledatalabs::Bulk.company(...params) |
Company Search API | Peopledatalabs::Search.company(...params) |
IP Endpoints
API Endpoint | peopledatalabs Function |
---|---|
IP Enrichment API | Peopledatalabs::Enrichment.ip(...params) |
Supporting Endpoints
API Endpoint | peopledatalabs Function |
---|---|
Autocomplete API | Peopledatalabs::Autocomplete.retrieve(...params) |
Company Cleaner API | Peopledatalabs::Cleaner.company(...params) |
Location Cleaner API | Peopledatalabs::Cleaner.location(...params) |
School Cleaner API | Peopledatalabs::Cleaner.school(...params) |
Job Title Enrichment API | Peopledatalabs::JobTitle.retrieve(...params) |
Skill Enrichment API | Peopledatalabs::Skill.retrieve(...params) |
All of our API endpoints are documented at: https://docs.peopledatalabs.com/
These docs describe the supported input parameters, output responses and also provide additional technical context.
As illustrated in the Endpoints section above, each of our API endpoints is mapped to a specific method in the peopledatalabs class. For each of these class methods, all function inputs are mapped as input parameters to the respective API endpoint, meaning that you can use the API documentation linked above to determine the input parameters for each endpoint.
As an example:
The following is valid because name
is a supported input parameter to the Person Identify API:
Peopledatalabs::Identify.person(params: { name: 'sean thorne' })
Conversely, this would be invalid because fake_parameter
is not an input parameter to the Person Identify API:
Peopledatalabs::Identify.person(params: { fake_parameter: 'anything' })
Bulk Person and Person Search now use .person instead of .people
i.e. Peopledatalabs::Bulk.people(...records) is now Peopledatalabs::Bulk.person(...records)
i.e. Peopledatalabs::Search.people(...params) is now Peopledatalabs::Search.person(...params)