Updating Course Metadata
Endpoint Overview
Update the metadata (such as name or description) of an existing course within your organization.
- HTTP Method:
PATCH - Endpoint URL:
https://api.trywhiteowl.com/api/v1/courses - Authentication: Bearer Token (API Key)
- Required Permission:
course:changemetadata(Ensure your API key has Changemetadata permission under Courses)
Request Headers
Section titled “Request Headers”| Header | Type | Required | Description |
|---|---|---|---|
Authorization |
String | Yes | Bearer token format: Bearer YOUR_API_KEY |
Content-Type |
String | Yes | application/json |
Request Body
Section titled “Request Body”| Field | Type | Required | Description |
|---|---|---|---|
id |
String | Yes | The unique identifier of the course to update. |
changes |
Object | Yes | Object containing the metadata properties to update. |
changes.name |
String | No | The new name/title for the course. |
changes.description |
String | No | The new description for the course. |
Example Payload:
{ "id": "prod_12345", "changes": { "name": "Advanced Web Development", "description": "Master full-stack web development with modern tools." }}Code Examples
Section titled “Code Examples”cURL
curl -X PATCH "https://api.trywhiteowl.com/api/v1/courses" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "id": "prod_12345", "changes": { "name": "Advanced Web Development", "description": "Master full-stack web development with modern tools." } }'JavaScript (Fetch)
const options = { method: 'PATCH', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ id: 'prod_12345', changes: { name: 'Advanced Web Development', description: 'Master full-stack web development with modern tools.' } })};
fetch('https://api.trywhiteowl.com/api/v1/courses', options) .then(response => response.json()) .then(data => console.log(data)) .catch(err => console.error(err));Python (Requests)
import requests
url = "https://api.trywhiteowl.com/api/v1/courses"headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"}payload = { "id": "prod_12345", "changes": { "name": "Advanced Web Development", "description": "Master full-stack web development with modern tools." }}
response = requests.patch(url, headers=headers, json=payload)print(response.json())Response Structure
Section titled “Response Structure”Success Response (200 OK)
{ "success": true, "message": "Metadata updated successfully", "previous": [ { "id": "prod_12345", "name": "Intro to Web Dev", "description": "Basic web development course.", "organization": "org_98765", "type": "courses" } ], "updated": [ { "id": "prod_12345", "name": "Advanced Web Development", "description": "Master full-stack web development with modern tools.", "organization": "org_98765", "type": "courses" } ]}Error Responses
- Missing Course ID:
{ "success": false, "message": "id is required to change metadata"}- Course Not Found / Unauthorized:
{ "success": false, "message": "A course with this id does not exist"}- Internal / Database Error:
{ "success": false, "message": "There was an error changing metadata. Contact support if this problem percists"}