Public Resource Data Search API
API Endpoint: resource_search
Searches for resources satisfying a given search criteria.
Important
By default, results will return a maximum of 250 resource metadata
Please utilize
offsetandlimitto page through further resultsAn overall count will always be provided in your results
This endpoint returns a dictionary with 2 fields: count and results. The count field contains the total number of Resources found without the limit or query parameters having an effect. The results field is a list of dictized Resource objects.
Parameter Definitions
Parameter Name |
Description |
Example |
|---|---|---|
|
Max amount of results returned by query. By default, max amount of 250 is applied. Your limit cannot exceed 250 |
|
|
The number of results to skip before returning results by the query |
|
|
Value that all queried results will be ordered by |
|
|
Variable which will be queried in the search |
|
Valid Query Fields
Field Name |
Description |
Example |
|---|---|---|
|
Format of the resource |
|
|
Name of the resource |
|
|
Description of the resource |
|
|
License type of the resource |
|
|
See “Search Against All Fields” |
|
Important
- Spaces will be stripped from query terms if they exist at the beginning or end of the field value
User Input Example:
'name: oil'User Input After API Stripping:
'name:oil'
Searching Against All Fields
Attention
In order to search against all fields, use
'*: <term>'Example:
'*:oil'to search against all valid fields for the term “oil”
Attention
In order to return all public resources, you can use '*:*'
EDX License Parameters
These parameters are used when specifying a license type.
Note
You may use either the exact License Value Name when defining license in your data dictionary
License Value Name |
Description |
|---|---|
|
BSD-3 Clause |
|
Creative Commons Attribution |
|
Creative Commons Attribution Share-Alike |
|
Creative Commons CCZero |
|
Creative Commons Non-Commercial (Any) |
|
Controlled Unclassified Information |
|
GNU Free Documentation License |
|
License Not Specified |
|
Non-Disclosure Agreement |
|
No License Restrictions |
|
Official Use Only |
|
Open Data Commons Attribution License |
|
Open Data Commons Open Database License (ODbL) |
|
Open Data Commons Public Domain Dedication and License (PDDL) |
|
Other (Attribution) |
|
Other (Non-Commercial) |
|
Other (Not Open) |
|
Other (Open) |
|
Other (Public Domain) |
|
Proprietary (Commercial) |
|
UK Open Government License (OGL) |
Example 1: Simplified Public Resource Search
Note
- In order to query on specific fields use the format
field:value Example
'query': 'name:oil'
- In order to query on specific fields use the format
Important
- Spaces will be stripped from query terms if they exist at the beginning or end of the field value
User Input Example:
'name: oil'User Input After API Stripping:
'name:oil'
import requests
headers = {
"EDX-API-Key": 'YOUR-API-KEY-HERE',
"User-Agent": 'EDX-USER',
'Content-Type': 'application/json',
'Accept':'application/json'
}
data = {
'query': 'name:oil'
}
url = 'https://edx.netl.doe.gov/api/3/action/resource_search'
r = requests.post(
url, # URL to API endpoint
headers=headers, # Headers dictionary
json=data, # Dictionary of data params
)
r_json = r.json()
print (r.json())
{'help': '/api/3/action/help_show?name=resource_search', 'success': True,
'result': {'count': 203, 'results': [{'id': '2b90f43d-426e-4754-80b2-1d890c9605e2',
'package_id': 'd0199726-61b8-4aa5-ad28-aff21ca91792', 'revision_id': 'c4b1e06c-b166-4b22-8a42-8773bd9e5ac7',
'url': 'https://edx.netl.doe.gov/storage/f/edx/2024/04/2024-04-01T20:38:18.812004/2b90f43d-426e-4754-80b2-1d890c9605e2/MINORELEMENTSINOIL-FIELDWATERS_Rittenhouseetal1968.pdf', 'format': 'PDF',
'description': 'Original manuscript describing original sampling and analysis.', 'hash': 'md5:d88e7c649fea16aa06bcd40a72c58bf4',
'position': 0, 'name': 'MINORELEMENTSINOIL-FIELDWATERS_Rittenhouseetal1968.pdf',
'resource_type': 'file.upload', 'mimetype': 'application/pdf', 'mimetype_inner': None,
'size': 1128718, 'created': '2024-04-01T20:38:19.362000', 'last_modified': '2024-04-01T20:39:37.491756',
'cache_url': '/storage/f/edx/2024/04/2024-04-01T20:38:18.812004/2b90f43d-426e-4754-80b2-1d890c9605e2/MINORELEMENTSINOIL-FIELDWATERS_Rittenhouseetal1968.pdf', 'cache_last_updated': None,
'url_type': 'upload', 'state': 'active', 'license_type': 'notspecified', 'folder_id': 'root',
'owner_org': None, 'recycle_removed': False, 'fgdc_metadata': True,
'rating': None, 'key': '2024-04-01T20:38:18.812004/2b90f43d-426e-4754-80b2-1d890c9605e2/MINORELEMENTSINOIL-FIELDWATERS_Rittenhouseetal1968.pdf',
'owner': 'nsiefert', 'revision_timestamp': 'April 1, 2024, 20:39:39 (EST)', 'intended_use_auth': False}, {'id': '57625482-a413-476c-8157-bf08b641abad',
'package_id': '9edc95eb-b342-47fc-a849-b00c121bb40d', 'revision_id': '85bf2623-e2bc-4d2b-a3c0-ada4320e536c',
'url': 'https://edx.netl.doe.gov/storage/f/edx/2023/08/2023-08-14T22:26:15.690Z/57625482-a413-476c-8157-bf08b641abad/csod_2023-oil-and-gas-fields-and-operators.zip', 'format': 'ZIP',
'description': '', 'hash': 'md5:349a3fe576f0ad6b204cc5013d0e03b8', 'position': 0, 'name': 'csod_2023-oil-and-gas-fields-and-operators.zip',
'resource_type': 'file.upload', 'mimetype': 'application/octet-stream', 'mimetype_inner': None, 'size': 66990818, 'created': '2023-08-14T18:24:12.116000',
'last_modified': '2023-08-14T18:27:34.376886', 'cache_url': 'storage/f/edx/2023/08/2023-08-14T22:26:15.690Z/57625482-a413-476c-8157-bf08b641abad/csod_2023-oil-and-gas-fields-and-operators.zip', 'cache_last_updated': None, 'url_type': 'upload',
'state': 'active', 'license_type': 'cc-by-sa', 'folder_id': 'root', 'owner_org': None, 'recycle_removed': False,
'fgdc_metadata': True, 'rating': None, 'key': '2023-08-14T22:26:15.690Z/57625482-a413-476c-8157-bf08b641abad/csod_2023-oil-and-gas-fields-and-operators.zip',
'owner': 'paigemork', 'revision_timestamp': 'August 14, 2023, 18:27:38 (EST)', 'intended_use_auth': False}, {'id': 'b2f663b6-7194-49ab-9c0a-69695b0042c4',
'package_id': 'fbf80e19-3611-479b-af68-0a2408af5eba', 'revision_id': '897f3831-13a5-4bbc-9398-ec898e6d3479',
'url': 'https://edx.netl.doe.gov/storage/f/edx/2018/09/2018-09-05T16:26:47.335Z/64aa6712-0dbf-42bc-a158-478fdc4c30c9/salina-xrf-soil-mp.png', 'format': 'PNG', 'description': '', 'hash': 'md5:8d17adb41166a514df38fc36cb3c262e', 'position': None, 'name': 'Salina XRF (soil+MP).png', 'resource_type': 'file.upload', 'mimetype': None, 'mimetype_inner': None, 'size': 186977, 'created': '2018-09-05T12:26:56', 'last_modified': '2018-09-05T12:26:56', 'cache_url': 'https://edx.netl.doe.gov/storage/f/2018-09-05T16%3A26%3A47.335Z/salina-xrf-soil-mp.png', 'cache_last_updated': None, 'url_type': 'upload', 'state': 'active', 'license_type': 'no-license-restriction', 'folder_id': 'root', 'owner_org': None, 'recycle_removed': False, 'fgdc_metadata': False, 'rating': None, 'owner': 'medustin', 'cache_url_updated': '2018-09-05T12:26:56', 'key': '2018-09-05T16:26:47.335Z/salina-xrf-soil-mp.png', 'revision_timestamp': 'September 5, 2018, 16:26:58 (EST)', 'intended_use_auth': False}, ...]}}
Example 2: Advanced Public Search
Note
- In order to query on specific fields use the format
field:value Example
'query': 'name:oil'
- In order to query on specific fields use the format
Important
- Spaces will be stripped from query terms if they exist at the beginning or end of the field value
User Input Example:
'name: oil'User Input After API Stripping:
'name:oil'
Note
- Submitting a list of query fields, such as
'query': ['name:oil', 'format:pdf'], will search with an AND condition Example:
resource.name ILIKE %oil AND resource.format ILIKE %pdf
import requests
headers = {
"EDX-API-Key": 'YOUR-API-KEY-HERE',
"User-Agent": 'EDX-USER',
'Content-Type': 'application/json',
'Accept':'application/json'
}
data = {
'query': ['name:oil', 'format:pdf'],
'limit': 5,
'offset': 10,
'order_by': 'created desc'
}
url = 'https://edx.netl.doe.gov/api/3/action/resource_search'
r = requests.post(
url, # URL to API endpoint
headers=headers, # Headers dictionary
json=data, # Dictionary of data params
)
r_json = r.json()
print (r.json())
{'help': '/api/3/action/help_show?name=resource_search', 'success': True, 'result': {'count': 12846, 'results': [{'id': 'fb41438b-7ab0-4ccd-839e-bea898f831b2',
'package_id': 'a280bd87-59de-4006-b5ae-72c35e1d7162', 'revision_id': '02016b7e-5af3-088d-2c38-624a10034b70', 'url': 'https://edx.netl.doe.gov/storage/f/edx/2016/09/2016-09-29T14:18:13.133Z/1a5519eb-800d-443c-ae08-3e3d6878f5c9/BC14990_15.pdf',
'format': 'PDF', 'description': '', 'hash': '', 'position': None, 'name': 'BC14990_15.pdf', 'resource_type': 'file.upload', 'mimetype': None, 'mimetype_inner': None,
'size': 193868, 'created': '2016-09-21T12:35:58', 'last_modified': '2016-09-21T12:35:58', 'cache_url': 'https://edx.netl.doe.gov/storage/f/2016-09-29T14:18:13.133Z/BC14990_15.pdf',
'cache_last_updated': None, 'url_type': 'upload', 'state': 'active', 'license_type': 'other-open', 'folder_id': 'root', 'owner_org': None, 'recycle_removed': False,
'fgdc_metadata': False, 'rating': None, 'owner': 'admin', 'cache_url_updated': '2016-09-21T12:35:58', 'ostiid': '0', 'key': '2016-09-29T14:18:13.133Z/BC14990_15.pdf',
'revision_timestamp': 'September 29, 2016, 14:18:13 (EST)', 'intended_use_auth': False}, {'id': '367cd2c7-d9ab-46fb-abbb-3ac977ad7dbe',
'package_id': 'b6803a53-b4fd-41ec-a42a-2fa087449f22', 'revision_id': '7a2e4a4b-37c5-3bb0-981c-1dce68bac40c',
'url': 'https://edx.netl.doe.gov/storage/f/edx/2016/09/2016-09-29T22:51:54.834Z/5bf112e2-b252-41c8-ba87-e5cc814daf83/3320.pdf', 'format': 'PDF', 'description': '',
'hash': '', 'position': None, 'name': '3320.pdf', 'resource_type': 'file.upload', 'mimetype': None, 'mimetype_inner': None, 'size': 853549,
'created': '2016-09-21T12:35:58', 'last_modified': '2016-09-21T12:35:58', 'cache_url': 'https://edx.netl.doe.gov/storage/f/2016-09-29T22:51:54.834Z/3320.pdf',
'cache_last_updated': None, 'url_type': 'upload', 'state': 'active', 'license_type': 'other-open', 'folder_id': 'root', 'owner_org': None, 'recycle_removed': False,
'fgdc_metadata': False, 'rating': None, 'owner': 'admin', 'cache_url_updated': '2016-09-21T12:35:58', 'ostiid': 'NULL', 'key': '2016-09-29T22:51:54.834Z/3320.pdf',
'revision_timestamp': 'September 29, 2016, 22:51:55 (EST)', 'intended_use_auth': False}, {'id': 'a018e7dd-e40d-4c55-9fef-768fc7e22926', 'package_id': '533bdea0-38b7-4061-9d8e-a6252efce657',
'revision_id': '2dd34d5b-8b48-5dc9-0079-ad1b9aee8cc1', 'url': 'https://edx.netl.doe.gov/storage/f/edx/2016/09/2016-09-29T14:21:27.756Z/d067408a-27c9-4869-80da-c41b5c44e5b1/45.pdf', 'format': 'PDF', 'description': '',
'hash': '', 'position': None, 'name': '45.pdf', 'resource_type': 'file.upload', 'mimetype': None, 'mimetype_inner': None, 'size': 284577,
'created': '2016-09-21T12:35:58', 'last_modified': '2016-09-21T12:35:58', 'cache_url': 'https://edx.netl.doe.gov/storage/f/2016-09-29T14:21:27.756Z/45.pdf',
'cache_last_updated': None, 'url_type': 'upload', 'state': 'active', 'license_type': 'other-open', 'folder_id': 'root', 'owner_org': None, 'recycle_removed': False,
'fgdc_metadata': False, 'rating': None, 'owner': 'admin', 'cache_url_updated': '2016-09-21T12:35:58', 'ostiid': '0', 'key': '2016-09-29T14:21:27.756Z/45.pdf',
'revision_timestamp': 'September 29, 2016, 14:21:27 (EST)', 'intended_use_auth': False} ... ]}}