Collect Workspace 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 User Table Columns Used in the fields
Parameter
Parameter Name |
Description |
Required Fields |
---|---|---|
|
Name of the user within the user’s account |
Optional |
|
User ID number associated with their EDX account |
Optional |
|
title of submission found within the workspace |
Optional |
|
Description of the submission found within the workspace |
Optional |
|
Date the workspace was created |
Optional |
|
State of the workspace |
Optional |
|
ID of the resource revision of a submission within the workspace |
Optional |
|
Type of the submission within the workspace |
Optional |
|
Approval status of a submission within the workspace |
Optional |
|
URL of an image resource found within the workspace |
Optional |
|
ID of the owner for the workspace |
Optional |
|
String text name of the landing page for a workspace |
Optional |
|
Boolean to determine if the workspace submission is group reviewed |
Optional |
|
Boolean to determine if the workspace has open access |
Optional |
|
Boolean to determine if the workspace is only available to access by NETL-only users |
Optional |
|
Date of last modification to a submission within the workspace |
Optional |
|
Project number associated with a submission within a workspace |
Optional |
|
A list of user IDs in the workspace |
Optional |
Note
When using the *
within the fields
parameter, it will include all fields
Example 1: Single Workspace 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': ['<WORKSPACE-ID-HERE>'], # Required.
'fields': ['<ENTER-PARAMETER-HERE>'] #Required
}
url = 'https://edx.netl.doe.gov/api/3/action/workspace_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())
{
"help":"/api/3/action/help_show?name=workspace_metadata",
"success":true,
"result":{
"total_count":3,
"metadata":[
{
"workspace_id":"0aa9f4e9-f4bf-470d-aeea-8affcf7c8b9d",
"roster":[
"35de479c-e02c-4d60-8f3d-8234caeee02e"
]
},
{
"workspace_id":"657a84e6-3950-4af8-aa2e-9c6d32794918",
"roster":[
"b1b62511-8e97-4474-a58d-a53c10dec4ff",
"938907a2-c261-46f9-b154-ea070dd8887b"
]
},
{
"workspace_id":"da435e4c-23fd-43a4-91cc-d08a1bce033c",
"roster":[
"89ba43f7-d490-48cb-9719-72c4c88344a3"
]
}
]
Example 2 : Multi-Workspace 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': ['<WORKSPACE-ID-HERE>', '<WORKSPACE-ID-HERE>', '<WORKSPACE-ID-HERE>'], # Required.
'fields': ['<ENTER-PARAMETER-HERE>', '<ENTER-PARAMETER-HERE>', '<ENTER-PARAMETER-HERE>'] #Required
}
url = 'https://edx.netl.doe.gov/api/3/action/workspace_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())