LinkedIn Campagin API Link not inserted - api

I am using the marketing API to create ads with curl in PHP.
Creating Campaign Groups and Campaigns in this way is working perfectly fine. The basic creation of a creative and an ad is also working. The only problem is that i can’t add a destination URL and some other info’s like the description and Call-to-Action. But the destination URL or content Landing Page like it’s called in the documentation really is fundamental.
This is my code for the creative data:
$data = [
"creative" => [
"inlineContent" => [
"post" => [
"adContext" => [
"dscAdAccount" => "urn:li:sponsoredAccount:".$this->params->get('app.linkedin_my_acc_id'),
"dscStatus" => "ACTIVE"
],
"author" => "urn:li:organization:".$this->params->get('app.linkedin_my_org_id'),
"commentary" => $job->getCommentary(),
"visibility" => "PUBLIC",
"lifecycleState" => "PUBLISHED",
"isReshareDisabledByAuthor" => false,
"contentCallToActionLabel" => "DOWNLOAD",
"contentLandingPage" => "https://google.com",
"content" => [
"media" => [
"title" => "This is a test!",
"id" => $image
]
]
]
],
"campaign" => "urn:li:sponsoredCampaign:".$myCampaignId,
"intendedStatus" => "ACTIVE"
]
];
The structure is the same as in the documentation (https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads/account-structure/create-and-manage-creatives-new?view=li-lms-2023-01&tabs=http#creatives-inline-schema).
So what am I doing wrong? Why is LinkedIn ignoring my contentLandingPage and contentCallToActionLabel values? The request is working and Im not getting an unpermitted fields error so it seems to be correct…
Can someone help? I also can provide the code of the Campaign Group and the Campaign if needed.
Not sure if this is important but the objectiveType of my Campaign is “WEBSITE_VISIT” and the type is “SPONSORED_UPDATES”.

Related

Magento2 Update products via async/bulk/V1/products/bySku

I have a problem with updating multiple products via API with the async/bulk/ option.
I call this URL with HTTP Method PUT: https://my-shop-domain.com/rest/employees_en/async/bulk/V1/products/bySku (employees_en is one of my store codes)
My payload before encoding to JSON is:
$body = [
0 => [
'product' => [my product data here],
'saveOptions' => true
],
1 => [
'product' => [my other product data here],
'saveOptions' => true
],
2 => ...
];
However, I always get the response: "product" is required. Enter and try again.
Which is weird, because using the same body for creating products works like expected. Does anyone of you know what is wrong here?

Setting unknown property: yii\log\Logger::targets

After Installed the Yii in my system when I try to run it getting this error.
Unknown Property – yii\base\UnknownPropertyException
Setting unknown property: yii\log\Logger::targets
Here is some of the documentation I created while implementing logging in Yii, it might be of your help:
========================= Configure xampp to send the emails from localhost code ==========================================
Changes for C:\xampp\php\php.ini file:
search for [mail function]:
[mail function]
SMTP=localhost to SMTP=smtp.gmail.com
smtp_port=587
sendmail_from=me#example.com to sendmail_from=your email address
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
mail.add_x_header=Off
mail.log = syslog
Changes for C:\xampp\sendmail\sendmail.ini:
search for [sendmail]:
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=auto
error_logfile=error.log
debug_logfile=debug.log
auth_username=same as "sendmail_from" in php.ini file
auth_password=generated password for the email account
force_sender= same as "auth_username" in this file
================================================ Restart Xampp Server =====================================================
=================================================== Add table in DB =======================================================
drop table if exists "log";
create table "log"
(
"id" number(20) NOT NULL PRIMARY KEY,
"level" integer,
"category" varchar(255),
"log_time" number,
"prefix" text,
"message" text,
key "idx_log_level" ("level"),
key "idx_log_category" ("category")
);
============================================ Configuration in Yii2 project ================================================
add in "components" array in app\config\console.php and app\config\web.php both files:
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.gmail.com',
'username' => 'your email address (for testing on localhost use same as in ini files)',
'password' => 'generated password',
'port' => 587,
'encryption' => 'tls',
],
], //end of mailer
'log' => [
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning','info'],
],
[
'class' => 'yii\log\DbTarget',
'levels' => ['error', 'warning','info'],
],
[
'class' => 'yii\log\EmailTarget',
'mailer' => 'mailer',
'levels' => ['error', 'warning','info'],
//'categories' => ['yii\db\*'],
'message' => [
'from' => ['your email address(for testing on localhost use same as in ini files)'],
'to' => ['receiptent email address'],
],
],
], // end of targets
'flushInterval' => 1,
], //end of logs
//------------------------ web.php (log configuration setup) -------------------------//
//categories name would be later assgined to messages:
Yii::info($message, 'userNotification');

Mollie applicationfee's

for a customer I need to charge an applicationFee for each order that has been processed on their site from the sub customers. The whole code is working with authentication and everything.
But from the moment I'm adding:
'applicationFee' => $applicationFee
to the call I receive this error:
Error executing API call (422: Unprocessable Entity): Unable to process application request for this account. Documentation: https://docs.mollie.com/guides/handling-errors"
The content of "$applicationFee" is correct, that I was able to check already.
The $shop_mollie_data->profile_id containts the different websiteprofileId's found on the Mollie dashboard.
$provider = new MollieConnectProvider($request, $clientId, $clientSecret, $redirectUrl);
$newAccessToken = $provider->getRefreshTokenResponse($shop_mollie_data->refresh_token);
$mollie = new MollieApiClient();
$mollie->setAccessToken($newAccessToken['access_token']);
$payment = $mollie->payments->create([
'amount' => [
'currency' => 'EUR',
'value' => (string) (sprintf("%.2f", $order_total))
],
'description' => ucfirst($shop->name) . ' - Order #' . $order_nm,
'webhookUrl' => $url_callback,
'redirectUrl' => $url_success,
'method' => 'bancontact',
'locale' => $language_id,
'metadata' => [
"order_id" => $ref,
"shop id" => $shop->id
],
'profileId' => $shop_mollie_data->profile_id,
'testmode' => true,
'applicationFee' => $applicationFee
]);

File not uploading to s3 bucket using yii2tech/file-storage extension

I'm trying to upload file to my amazon s3 bucket.
My config looks like this
'fileStorage' => [
'class' => 'yii2tech\filestorage\amazon\Storage',
'awsKey' => 'dota2',
'awsSecretKey' => 'dota2',
'buckets' => [
'webfiles' => [
'fileSubDirTemplate' => '{ext}/{^name}/{^^name}',
'region' => 'us_e1',
'acl' => 'public',
],
]
],
My upload function looks like this
$bucket = Yii::$app->fileStorage->getBucket('webfiles');
$bucket->copyFileIn('/var/www/html/vasttag/web/', 'samplefinal.mp4');
$result= var_dump($bucket->fileExists('samplefinal.mp4'));
echo $result;
I get result as false. Yes I have double checked my path and my filename. Its perfectly fine. Anyone know where Im going wrong?

eBay API in Perl - can't use SetShipmentTrackingInfoRequest to update tracking information

I'm trying to figure out why I can't seem to update a tracking number using the eBay API. Here is the page I'm referencing:
http://developer.ebay.com/DevZone/merchant-data/CallRef/SetShipmentTrackingInfo.html
Based on that, I've got the following code in Perl:
use Net::eBay;
my $ebay = new Net::eBay( {
SiteLevel => 'prod',
DeveloperKey => 'x',
ApplicationKey => 'xxxx',
CertificateKey => 'xxx',
Token => 'xxxx',
} );
$ebay->setDefaults( { API => 2, compatibility => 900 } );
my $result = $ebay->submitRequest( "SetShipmentTrackingInfoRequest",
{
DetailLevel => "ReturnAll",
ErrorLevel => "1",
SiteId => "1",
OrderID => 1234546, # not the real order ID I'm using :)
ShipmentTrackingDetails => {
ShipmentTrackingNumber => "12345",
ShippingCarrierUsed => "Hermes"
}
});
print $IN->header;
use Data::Dumper;
print Dumper($result);
When running it, I get an error in $result:
$VAR1 = {
'Errors' => {
'ErrorClassification' => 'RequestError',
'SeverityCode' => 'Error',
'ShortMessage' => 'Unsupported API call.',
'ErrorCode' => '2',
'LongMessage' => 'The API call "SetShipmentTrackingInfoRequest" is invalid or not supported in this release.'
},
'xmlns' => 'urn:ebay:apis:eBLBaseComponents',
'Timestamp' => '2016-10-21 07:03:04',
'Build' => '18007281',
'Version' => '900',
'Ack' => 'Failure'
};
I'm a bit confused, as it looks like SetShipmentTrackingInfoRequest is the API call I need to be making? I've not really done much with the eBay API, so it's possible I'm missing something stupid.
UPDATE: As per feedback below, I'm now using the CompleteSale API call:
http://developer.ebay.com/Devzone/XML/docs/Reference/eBay/CompleteSale.html
my $result = $ebay->submitRequest( "CompleteSale ",
{
DetailLevel => "ReturnAll",
ErrorLevel => "1",
SiteId => "1",
OrderID => 1933420817015,
Shipment => {
ShipmentTrackingDetails => {
ShipmentTrackingNumber => "77293124902615",
ShippingCarrierUsed => "Hermes"
}
}
});
When I run it, I now get the error:
'LongMessage' => 'XML Error Text: "; nested exception is:
org.xml.sax.SAXParseException: Attribute name "Request" associated with an element type "CompleteSale" must be followed by the
\' = \' character.".',
Enabling debugging, the XML being sent is:
<?xml version='1.0' encoding='utf-8'?>
<CompleteSale Request xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>xxxx</eBayAuthToken>
</RequesterCredentials>
<DetailLevel>ReturnAll</DetailLevel>
<ErrorLevel>1</ErrorLevel>
<OrderID>xxxxx</OrderID>
<Shipment>
<ShipmentTrackingDetails>
<ShipmentTrackingNumber>xxxx</ShipmentTrackingNumber>
<ShippingCarrierUsed>Hermes</ShippingCarrierUsed>
</ShipmentTrackingDetails>
</Shipment>
<SiteId>1</SiteId>
</CompleteSale Request>
From looking at the eBay API doc link you posted doesn't the second 'Note' entirely explain why it doesn't work as a single API call?
Note: SetShipmentTrackingInfo cannot be issued on its own like an ordinary API call, using an endpoint
It then goes on to say:
In the Trading API, the CompleteSale call provides similar functionality that you can invoke directly
So perhaps looking there should be the next step