Edit Folder in EDX Drive

API Endpoint: edit_folder

Edit an existing folder’s name within a private collaborative workspace’s EDX Drive.

Important

An API Key is required for ALL private workspace activities

Parameter Definitions

Parameter name

Description

Required Field

workspace_id

The name or ID of workspace that you wish to edit folder in

Required

folder_id

The ID of the folder that you wish to make a name change to

Required

new_folder_name

The new folder name you wish to use

Required

Example 1: Edit Folder Name on EDX Drive

Attention

  • Add the "User-Agent": parameter within the headers of the API request

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

  • python
  • output
import requests
headers = {
    "EDX-API-Key": 'YOUR-API-KEY-HERE',
    "User-Agent": "EDX-USER"
}

data = {
    "workspace_id": 'YOUR-WORKSPACE-NAME-OR-ID-HERE',
    "folder_id": 'YOUR-FOLDER-ID-HERE',
    "new_folder_name": 'My New Name For My Folder'
}

url = 'https://edx.netl.doe.gov/api/3/action/edit_folder'

r = requests.post(
    url, # URL to API endpoint
    headers=headers, # Headers dictionary
    data=data, # Dictionary of data params
)
print (r.json())
print("End results")
{
    'help': 'https://edx.netl.doe.gov/api/3/action/help_show?name=edit_folder',
    'success': True,
    'result': {
        'workspace_id': 'WORKSPACE-ID-HERE',
        'folder_id': 'FOLDER-ID-HERE',
        'name': 'API Test Update 07-20-2020'
    }
}