# First, make sure your personal PVS API key is saved as character string in the pvs.key variable:
# Note that some officeTypeIds are only available on the state level or national level
# (e.g. "L" for State Legislature only if stateId is specified!)
pvs.key <- "yourkey"
# get a list of officials by state and office type
CAlegislators <- Officials.getByOfficeTypeState(officeTypeId="L", stateId="CA")
CAlegislators
suprcourt <- Officials.getByOfficeTypeState(officeTypeId="J")
suprcourt
Run the code above in your browser using DataLab