Requests
There are two primary ways to pass parameters in an API request (when using Python):
- Setting parameters through a parameters JSON object.
- Setting the parameters directly in the URL of the API request.
We recommend that users pass parameters through a parameters JSON object, though parameters may also be passed in the URL if desired. Anything found in a JSON object will take precedence over parameters found in the URL. Here is an example of our Person Enrichment API for reference.
URL
import requests
API_KEY = # YOUR API KEY
pdl_url = "https://api.peopledatalabs.com/v5/person/enrich?api_key=%s&[email protected]&company=Hallspot&company=People Data Labs" % API_KEY
json_response = requests.get(pdl_url).json()
###
JSON Object
# See https://github.com/peopledatalabs/peopledatalabs-python
from peopledatalabs import PDLPY
# Create a client, specifying an API key
client = PDLPY(
api_key="YOUR API KEY",
)
params = {
"company": ["Hallspot", "People Data Labs"],
"email": ["[email protected]"]
}
response = client.person.enrichment(**params)
print(response.text)
// See https://github.com/peopledatalabs/peopledatalabs-js
import PDLJS from 'peopledatalabs';
const PDLJSClient = new PDLJS({ apiKey: "YOUR API KEY" });
const params = {
company: "Hallspot",
company: "People Data Labs",
email: "[email protected]"
}
PDLJSClient.person.enrichment(params).then((data) => {
console.log(data);
}).catch((error) => {
console.log(error);
});
# See https://github.com/peopledatalabs/peopledatalabs-ruby
require 'peopledatalabs'
Peopledatalabs.api_key = 'YOUR API KEY'
params = {
"company": ["Hallspot", "People Data Labs"],
"email": ["[email protected]"]
}
response = Peopledatalabs::Enrichment.person(params: params)
puts response
import requests
API_KEY = # YOUR API KEY
pdl_url = "https://api.peopledatalabs.com/v5/person/enrich"
params = {
"api_key": API_KEY,
"company": ["Hallspot", "People Data Labs"],
"email": ["[email protected]"]
}
json_response = requests.get(pdl_url, params=params).json()
###
Updated 11 days ago
Did this page help you?