admin管理员组文章数量:1410712
Having trouble creating an ad with linkedin API (v2025-02)
I'm doing the following:
BASE_API_URL = ";
headers.Add("LinkedIn-Version", "202502");
headers.Add("X-Restli-Protocol-Version", "2.0.0");
Uploading an image to the account (I've tried set the owner the anization or the account)
var uploadUrl = $"{BASE_API_URL}/images?action=initializeUpload"; var request = new { initializeUploadRequest = new { //owner = $"urn:li:sponsoredAccount:{accountId}" owner = $"urn:... {anizationId}" } };
The image uploads fine - the imageId is stored under imageId.
Afterwards I am creating content (linkedin post):
var postUrl = $"{BASE_API_URL}/posts"; var request = new { adContext = new { dscAdAccount = $"urn:li:sponsoredAccount:{accountId}", dscStatus = "ACTIVE", dscName = ad.externalAdName }, author = {anizationId}, commentary = "Commentery goes here", visibility = "PUBLIC", distribution = new { feedDistribution = "NONE", thirdPartyDistributionChannels = new object[] { } }, content = new { //Also tried this - didn't work //media = new //{ // title = "Title of the Image", // id = $"urn:li:image:{imageId}" //} article = new { title = ad.externalAdName, thumbnail = $"urn:li:image:{imageId}", source = ad.landingPage } }, contentCallToActionLabel = ad.externalAdCTA, contentLandingPage = ad.landingPage, lifecycleState = "PUBLISHED", isReshareDisabledByAuthor = true };
Up to here everything works. id is saved under postId. Now is the problem - creating the ad:
Create a new creative
var createCreativeUrl = $"{BASE_API_URL}/adAccounts/{asset.extId}/creatives"; var newCreative = new { campaign = $"urn:li:sponsoredCampaign:{campaignId}", intendedStatus = "PAUSED", name = ad.externalAdName, content = new { reference = postId } };
This failed with the response:
{"code":"CREATIVE_CREATE_FORBIDDEN","message":"Not permitted to create the creative. Please check your permissions and that account and campaign details are correct.","status":403}
I've checked permission issue: I'm billing admin (this is my account I am testing), the token has ads_rw (and many more permissions).
What am I missing?
Having trouble creating an ad with linkedin API (v2025-02)
I'm doing the following:
BASE_API_URL = "https://api.linkedin/rest"
headers.Add("LinkedIn-Version", "202502");
headers.Add("X-Restli-Protocol-Version", "2.0.0");
Uploading an image to the account (I've tried set the owner the anization or the account)
var uploadUrl = $"{BASE_API_URL}/images?action=initializeUpload"; var request = new { initializeUploadRequest = new { //owner = $"urn:li:sponsoredAccount:{accountId}" owner = $"urn:... {anizationId}" } };
The image uploads fine - the imageId is stored under imageId.
Afterwards I am creating content (linkedin post):
var postUrl = $"{BASE_API_URL}/posts"; var request = new { adContext = new { dscAdAccount = $"urn:li:sponsoredAccount:{accountId}", dscStatus = "ACTIVE", dscName = ad.externalAdName }, author = {anizationId}, commentary = "Commentery goes here", visibility = "PUBLIC", distribution = new { feedDistribution = "NONE", thirdPartyDistributionChannels = new object[] { } }, content = new { //Also tried this - didn't work //media = new //{ // title = "Title of the Image", // id = $"urn:li:image:{imageId}" //} article = new { title = ad.externalAdName, thumbnail = $"urn:li:image:{imageId}", source = ad.landingPage } }, contentCallToActionLabel = ad.externalAdCTA, contentLandingPage = ad.landingPage, lifecycleState = "PUBLISHED", isReshareDisabledByAuthor = true };
Up to here everything works. id is saved under postId. Now is the problem - creating the ad:
Create a new creative
var createCreativeUrl = $"{BASE_API_URL}/adAccounts/{asset.extId}/creatives"; var newCreative = new { campaign = $"urn:li:sponsoredCampaign:{campaignId}", intendedStatus = "PAUSED", name = ad.externalAdName, content = new { reference = postId } };
This failed with the response:
{"code":"CREATIVE_CREATE_FORBIDDEN","message":"Not permitted to create the creative. Please check your permissions and that account and campaign details are correct.","status":403}
I've checked permission issue: I'm billing admin (this is my account I am testing), the token has ads_rw (and many more permissions).
What am I missing?
Share Improve this question edited Mar 10 at 12:36 Ziv Weissman asked Mar 10 at 12:29 Ziv WeissmanZiv Weissman 4,5564 gold badges30 silver badges63 bronze badges1 Answer
Reset to default 0Apparently if the app is in development mode you need to manually insert the ad accounts it can affect (although I managed to upload an image to the account and create a post)
You can do it by visiting:
https://www.linkedin/developers/apps/{appId}/settings
When you go into your application, you'll want to navigate to the "Products" tab, then you will want to click on "View Ad Accounts" next to the Advertising API. From there, you can add the ad accounts that your app manages.
本文标签: cFailed to create ads with linkedin APICREATIVECREATEFORBIDDENStack Overflow
版权声明:本文标题:c# - Failed to create ads with linkedin API - CREATIVE_CREATE_FORBIDDEN - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744847003a2628268.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论