Collect Group Metadata Stats
Important
An API Key is required for ALL private workspace activities
The API Key name component can be added to your header using any of the following ways, “X-CKAN-API-Key”, “EDX-API-Key”, or “Authorization”.
Note
Only System Admins can user the stats collection APIs
Parameter Definitions
Parameter Name |
Description |
Required Fields |
---|---|---|
|
Dictionary of user id(s) to query |
Required |
|
Dictionary listing the table columns the query will search against |
Required |
Parameter Definitions for Group Table Columns Used in the fields
Parameter
Parameter Name |
Description |
Required Fields |
---|---|---|
|
Name of the group |
Optional |
|
User ID number associated with EDX group |
Optional |
|
Title of submission found within the group |
Optional |
|
Description of the submission found within the group |
Optional |
|
Date the group was created |
Optional |
|
State of the group |
Optional |
|
ID of the revision of a submission within the group |
Optional |
|
Type of the submission within the group |
Optional |
|
Approval status of a submission within the group |
Optional |
|
URL of an image resource found within the group |
Optional |
|
ID of the owner for a submission in a group |
Optional |
|
String text name of the landing page for a group |
Optional |
|
Boolean to determine if the submission is group reviewed |
Optional |
|
Boolean to determine if the group has open access |
Optional |
|
Boolean to determine if the group is only available to access by NETL-only users |
Optional |
|
Date of last modification to a submission within the group |
Optional |
|
Project number associated with a submission within a group |
Optional |
|
all submission IDs associated with the group (active or deleted) |
Optional |
Example 1: Single Group Metadata Stat Collection
Attention
Add the
"User-Agent":
parameter within theheaders
of the API requestSet
"User-Agent":
to the value"EDX-USER"
import requests
headers = {
"EDX-API-Key": '<YOUR_EDX_API_KEY>',
"User-Agent": 'EDX-USER',
'Content-Type': 'application/json',
'Accept':'application/json'
}
data = {
'ids': ['<GROUP-ID-HERE>'], # Required.
'fields': ['<ENTER-PARAMETER-HERE>'] # Required
}
url = 'https://edx.netl.doe.gov/api/3/action/group_metadata'
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())
Example 2 : Multi-Group Metadata Stat Collection
Attention
Add the
"User-Agent":
parameter within theheaders
of the API requestSet
"User-Agent":
to the value"EDX-USER"
import requests
headers = {
"EDX-API-Key": '<YOUR_EDX_API_KEY>',
"User-Agent": 'EDX-USER',
'Content-Type': 'application/json',
'Accept':'application/json'
}
data = {
'ids': ['<GROUP-ID-HERE>', '<GROUP-ID-HERE>', '<GROUP-ID-HERE>'], # Required.
'fields': ['<ENTER-PARAMETER-HERE>','<ENTER-PARAMETER-HERE>', '<ENTER-PARAMETER-HERE>', '<ENTER-PARAMETER-HERE>'] # Required
}
url = 'https://edx.netl.doe.gov/api/3/action/group_metadata'
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())