You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to test pause a campaign on one of the active campaign I have in Bing Ads. The error I am getting is invalid AccountId, but I know for sure the AccountId is valid I downloaded a campaigns report.
I tested with different AccountIds and Campaigns, none of them works, just the same error.
I even double checked the code that its only related to campaigns.
Below are is my code and the SOAP error:
TestPauseCampaign.php
<?phpnamespaceApp\Console\Commands\Bing;
useIlluminate\Console\Command;
useApp\Services\BingAds;
useIlluminate\Support\Facades\Log;
useMicrosoft\BingAds\Auth\ServiceClientType;
useMicrosoft\BingAds\Auth\ServiceClient;
useMicrosoft\BingAds\Auth\ApiEnvironment;
useMicrosoft\BingAds\v13\CampaignManagement\UpdateCampaignsRequest;
useMicrosoft\BingAds\V13\CampaignManagement\Campaign;
useMicrosoft\BingAds\V13\CampaignManagement\CampaignStatus;
useSoapFault;
classTestPauseCampaignextendsCommand
{
/** * The name and signature of the console command. * * @var string */protected$signature = 'app:test-pause-campaign';
/** * The console command description. * * @var string */protected$description = 'Command description';
/** * Execute the console command. */publicfunctionhandle()
{
$bing = newBingAds();
$authorizationData = $bing->getAuthorizationData();
$serviceClient = (newServiceClient(ServiceClientType::CampaignManagementVersion13, $authorizationData, ApiEnvironment::Production));
try {
$request = newUpdateCampaignsRequest();
$request->AccountId = 14191111;
Log::info($request->AccountId);
$campaign = newCampaign();
$campaign->Id = '34234234';
$campaign->Status = CampaignStatus::Paused;
$request->Campaigns = [$campaign];
$response = $serviceClient->GetService()->UpdateCampaigns($request);
Log::info($response);;
} catch (SoapFault$e) {
// Handle SOAP fault// Access the fault code$faultCode = $e->faultcode;
// Access the fault string (error message)$faultString = $e->getMessage();
// Access the fault details, if available$faultDetails = $e->detail; // This may contain more specific error information// Log or display the fault details for debugging// You can use var_dump or print_r to view the detailsLog::error(print_r($faultCode, true));
Log::error(print_r($faultString, true));
Log::error(print_r($faultDetails, true));
// Handle the error as needed// You can log the details, display an error message, or take other actions
} catch (\Throwable$th) {
//throw $th;Log::error($th);
}
}
}
I am doing this in Laravel.
I wanted to test pause a campaign on one of the active campaign I have in Bing Ads. The error I am getting is invalid AccountId, but I know for sure the AccountId is valid I downloaded a campaigns report.
I tested with different AccountIds and Campaigns, none of them works, just the same error.
I even double checked the code that its only related to campaigns.
Below are is my code and the SOAP error:
TestPauseCampaign.php
Error Log
The text was updated successfully, but these errors were encountered: