Skip to content

Instantly share code, notes, and snippets.

@wkarney
Last active February 24, 2020 21:05
Show Gist options
  • Select an option

  • Save wkarney/e0e9aa626320d77b8cbaaaf046b21a09 to your computer and use it in GitHub Desktop.

Select an option

Save wkarney/e0e9aa626320d77b8cbaaaf046b21a09 to your computer and use it in GitHub Desktop.
[VA Facilities API Intro] Some examples for US VA Dept Facilities API #Python #API
# Import requests package
import requests
# API Key (request one at https://developer.va.gov/apply)
apikey = 'your-api-key-here'
# Typical request
url = 'https://dev-api.va.gov/services/va_facilities/v0/facilities/'
response = requests.get(
url,
params={'ids':['vha_688','nvc_100']}, # example IDs, see schema
headers={"apiKey": apikey}
)
response.json()
# Bulk request - json
bulkurl = 'https://dev-api.va.gov/services/va_facilities/v0/facilities/all'
response = requests.get(
bulkurl,
params ={},
headers={"apiKey": apikey, 'Accept':'application/vnd.geo+json'}
)
va_bulk_json = response.json()
va_bulk_info = []
for i in range(len(va_bulk_json['features'])):
va_bulk_info.append(va_bulk_json['features'][i]['properties'])
va_bulk_info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment