LinkedIn新版Creatives API不支持指定Projection参数,寻求解决方案
如何通过LinkedIn新版Creatives API获取旧版Projection参数对应的字段
问题背景
LinkedIn API版本化后,Creatives API(/rest/creatives)不再支持旧版adCreativesV2中的以下Projection参数:
com.linkedin.ads.SponsoredVideoCreativeVariablescom.linkedin.ads.SponsoredUpdateCarouselCreativeVariablescom.linkedin.ads.SpotlightCreativeVariablesV2com.linkedin.ads.SponsoredUpdateCreativeVariablescom.linkedin.ads.JobsCreativeVariablesV2com.linkedin.ads.SponsoredInMailCreativeVariables
这导致无法直接获取旧版中的特定字段(比如SpotlightCreativeVariablesV2的showMemberProfilePhoto、forumName等),已按迁移文档添加请求头:
X-Restli-Protocol-Version: 2.0.0LinkedIn-Version: 202210
旧版API调用与响应
旧版请求:
GET /v2/adCreativesV2?ids=List({$creative_id})&projection=(results(*(variables(*,data(*,com.linkedin.ads.SpotlightCreativeVariablesV2(*,share~(*))))))
旧版响应:
{ "results": { "46524875": { "variables": { "clickUri": "$clickUri", "data": { "com.linkedin.ads.SpotlightCreativeVariablesV2": { "showMemberProfilePhoto": true, "forumName": "$forumName", "description": "$description", "logo": "$logo", "headline": "$headline", "callToAction": "$callToAction" } } } } } }
新版API调用与响应
新版请求:
GET /rest/creatives?ids=List(urn%3Ali%3AsponsoredCreative%3A{$creative_id})
新版响应:
{ "results": { "urn:li:sponsoredCreative:$creative_id": { "servingHoldReasons": ["$servingHoldReasons"], "lastModifiedAt": 12345678000, "lastModifiedBy": "", "content": { "reference": "urn:li:ugcPost:$ugc_post" }, "createdAt": 1234562340000, "isTest": false, "createdBy": "$createdBy", "review": { "status": "APPROVED" }, "isServing": false, "campaign": "urn:li:sponsoredCampaign:$campaign_id", "id": "urn:li:sponsoredCreative:$creative_id", "intendedStatus": "ACTIVE", "account": "urn:li:sponsoredAccount:$account_id" } }, "statuses": { "urn:li:sponsoredCreative:creative_id": 200 }, "errors": {} }
解决方案
新版API采用关联资源查询+字段选择的方式替代旧版的Projection参数,具体步骤如下:
1. 从新版Creatives API获取关联资源URN
新版响应中的content.reference字段对应创意关联的底层资源URN(比如Spotlight创意对应UGC Post的URN),这是获取详细字段的关键入口。
2. 调用对应资源API获取目标字段
针对不同创意类型,调用对应的LinkedIn API并通过fields参数指定需要的字段:
针对SpotlightCreativeVariablesV2(示例)
拿到urn:li:ugcPost:$ugc_post后,调用UGC Posts API:
GET /rest/ugcPosts/urn:li:ugcPost:$ugc_post?fields=specificContent.linkedinFeedShare.showMemberProfilePhoto,specificContent.linkedinFeedShare.forumName,specificContent.linkedinFeedShare.description,specificContent.linkedinFeedShare.logo,specificContent.linkedinFeedShare.headline,specificContent.linkedinFeedShare.callToAction
返回的响应会包含所需字段:
{ "specificContent": { "linkedinFeedShare": { "showMemberProfilePhoto": true, "forumName": "$forumName", "description": "$description", "logo": "$logo", "headline": "$headline", "callToAction": "$callToAction" } } }
其他创意类型的对应API
- SponsoredVideoCreativeVariables:调用Videos API(
/rest/videos/{urn})获取视频相关字段 - SponsoredUpdateCarouselCreativeVariables:通过UGC Post API获取carousel结构中的内容字段
- JobsCreativeVariablesV2:调用Job Post API(
/rest/jobPosts/{urn})获取职位相关字段 - SponsoredInMailCreativeVariables:调用InMail相关API获取邮件内容字段
3. 注意事项
- 建议使用最新稳定版本的
LinkedIn-Version(比如202402)以获得完整的字段支持 - 部分字段需要额外的API权限,需检查应用权限配置是否符合要求
内容的提问来源于stack exchange,提问作者kalyani suryawanshi
相关产品推荐
相关产品推荐

