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

ids

Dictionary of user id(s) to query

Required

field

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

Name of the group

Optional

id

User ID number associated with EDX group

Optional

title

Title of submission found within the group

Optional

description

Description of the submission found within the group

Optional

created

Date the group was created

Optional

state

State of the group

Optional

revision_id

ID of the revision of a submission within the group

Optional

type

Type of the submission within the group

Optional

approval_status

Approval status of a submission within the group

Optional

image_url

URL of an image resource found within the group

Optional

owner_id

ID of the owner for a submission in a group

Optional

landing_page

String text name of the landing page for a group

Optional

group_reviewed

Boolean to determine if the submission is group reviewed

Optional

open_access

Boolean to determine if the group has open access

Optional

netl_only

Boolean to determine if the group is only available to access by NETL-only users

Optional

last_modified

Date of last modification to a submission within the group

Optional

project_number

Project number associated with a submission within a group

Optional

submission_id

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 the headers of the API request

  • Set "User-Agent": to the value "EDX-USER"

  • python
  • Successful Output
  • Failed Output
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 the headers of the API request

  • Set "User-Agent": to the value "EDX-USER"

  • python
  • Successful Output
  • Failed Output
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())