Updating Digital Product Metadata
Endpoint Overview
Update the metadata (such as name or description) of an existing digital product belonging to your organization.
- HTTP Method:
PATCH - Endpoint URL:
https://api.trywhiteowl.com/api/v1/digital - Authentication: Bearer Token (API Key)
- Required Permission:
digital:changemetadata(Ensure your API key has Changemetadata permission under Digital)
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 digital product to update. |
changes |
Object | Yes | Object containing the metadata properties to update. |
changes.name |
String | No | The new name/title for the digital product. |
changes.description |
String | No | The new description for the digital product. |
Example Payload:
{ "id": "dig_98765", "changes": { "name": "E-Book: Mastery in TypeScript (2nd Edition)", "description": "Comprehensive guide to modern TypeScript developments." }}Code Examples
Section titled “Code Examples”cURL
curl -X PATCH "https://api.trywhiteowl.com/api/v1/digital" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "id": "dig_98765", "changes": { "name": "E-Book: Mastery in TypeScript (2nd Edition)", "description": "Comprehensive guide to modern TypeScript developments." } }'JavaScript (Fetch)
const options = { method: 'PATCH', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ id: 'dig_98765', changes: { name: 'E-Book: Mastery in TypeScript (2nd Edition)', description: 'Comprehensive guide to modern TypeScript developments.' } })};
fetch('https://api.trywhiteowl.com/api/v1/digital', 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/digital"headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"}payload = { "id": "dig_98765", "changes": { "name": "E-Book: Mastery in TypeScript (2nd Edition)", "description": "Comprehensive guide to modern TypeScript developments." }}
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": "dig_98765", "name": "E-Book: Mastery in TypeScript", "description": "Introductory guide to TypeScript.", "organization": "org_12345", "type": "digital" } ], "updated": [ { "id": "dig_98765", "name": "E-Book: Mastery in TypeScript (2nd Edition)", "description": "Comprehensive guide to modern TypeScript developments.", "organization": "org_12345", "type": "digital" } ]}Error Responses
- Missing Product ID:
{ "success": false, "message": "id is required to change metadata"}- Product 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"}