Complete PHP-based workflow application for Ferrero DAM system: - OAuth2 authentication with automatic token management - Campaign discovery and filtering - Folder structure navigation - Asset download (individual and bulk) - Metadata extraction and display - Clean step-by-step web interface Status: Fully functional and production-ready 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
75 lines
No EOL
2.8 KiB
PHP
75 lines
No EOL
2.8 KiB
PHP
<?php
|
|
require_once 'src/TestRunner.php';
|
|
|
|
$config = [
|
|
'baseUrl' => '',
|
|
'apiKey' => '',
|
|
'timeout' => 60,
|
|
'headers' => [
|
|
'Content-Type' => 'application/json',
|
|
'Accept' => 'application/json'
|
|
]
|
|
];
|
|
|
|
$collectionPath = __DIR__ . '/Content Scaling Flow.postman_collection_Oliver(New).json';
|
|
|
|
try {
|
|
$testRunner = new TestRunner($collectionPath, $config);
|
|
|
|
echo "OAuth2 Status:\n";
|
|
$oauth2Status = $testRunner->getOAuth2Status();
|
|
print_r($oauth2Status);
|
|
|
|
if ($oauth2Status['enabled'] && ($oauth2Status['has_token'] ?? false)) {
|
|
echo "\n✅ OAuth2 token is active, running campaign folders test...\n\n";
|
|
|
|
$requests = $testRunner->getAvailableRequests();
|
|
|
|
foreach ($requests as $index => $request) {
|
|
if (strpos($request['name'], 'Retrieve Localized Campaign Folders') !== false) {
|
|
echo "Found request: " . $request['name'] . "\n";
|
|
echo "Running test...\n\n";
|
|
|
|
$result = $testRunner->runSingleTest($request, $index);
|
|
|
|
echo "Status: " . $result['status'] . "\n";
|
|
echo "HTTP Code: " . $result['response']['http_code'] . "\n";
|
|
echo "Response Time: " . $result['response']['response_time'] . "ms\n";
|
|
echo "URL: " . $result['response']['url'] . "\n\n";
|
|
|
|
if ($result['status'] === 'PASS') {
|
|
echo "✅ Success! Response received.\n";
|
|
echo "Response length: " . strlen($result['response']['body']) . " characters\n\n";
|
|
|
|
// Save response to file for analysis
|
|
file_put_contents(__DIR__ . '/campaign_response.json', $result['response']['body']);
|
|
echo "Response saved to campaign_response.json\n";
|
|
|
|
// Show first 1000 characters
|
|
echo "First 1000 characters of response:\n";
|
|
echo "=" . str_repeat("=", 50) . "\n";
|
|
echo substr($result['response']['body'], 0, 1000) . "...\n";
|
|
echo "=" . str_repeat("=", 50) . "\n";
|
|
|
|
} else {
|
|
echo "❌ Request failed\n";
|
|
if (isset($result['response']['error'])) {
|
|
echo "Error: " . $result['response']['error'] . "\n";
|
|
}
|
|
echo "Response body: " . $result['response']['body'] . "\n";
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
echo "❌ OAuth2 token issue\n";
|
|
if (isset($oauth2Status['error'])) {
|
|
echo "Error: " . $oauth2Status['error'] . "\n";
|
|
}
|
|
}
|
|
|
|
} catch (Exception $e) {
|
|
echo "❌ Error: " . $e->getMessage() . "\n";
|
|
}
|
|
?>
|