广告定位-通过URN API ClassCastException查找实体错误消息 [英] Ad Targeting - Find Entities by URNs API ClassCastException error message
问题描述
通过URN查找实体" API,以便检索URN集合的元数据和值信息.
I have some problem with the "Find Entities by URNs" API in order to retrieve the metadata and value information for a collection of URNs.
If I use the URL described in the doc (Sample request) with a valid access token:
https://api.linkedin.com/v2/adTargetingEntities?q=urns&urns=List(urn%3Ali%3AfieldOfStudy%3A100990,urn%3Ali%3Aorganization%3A1035,urn%3Ali%3Aseniority%3A9)&locale=(language:en,country:US)&oauth2_access_token=<a-valid-token>
我收到消息:
{
"serviceErrorCode": 0,
"message": "java.lang.ClassCastException",
"status": 500
}
有人遇到过同样的问题吗?知道如何解决吗?
Anyone have experience the same issue? Any idea how to fix it?
还:在这种情况下,我如何联系以获得技术支持?
Also: how can i contact for technical support as in this case?
更新:
我做了一些尝试,并使用以下版本进行了修复:
I made some try and I fix using the following version:
https://api.linkedin.com/v2/adTargetingEntities?q=urns&urns=urn%3Ali%3AfieldOfStudy%3A100990&urns=urn%3Ali%3Aorganization%3A1035&urns=urn%3Ali%3Aseniority%3A9&locale.language=it&locale.country=IT&oauth2_access_token=<a-valid-token>
但是语言环境/语言翻译不起作用.这可能是可行的解决方案吗?
BUT the locale/language translation is not working. Could be this a working solutions?
推荐答案
来自支持团队:
我们的文档缺少1条重要信息.每当使用 URL中的LIST和编码的URN,我们希望有一个附加的标头
'x-restli-protocol-version: 2.0.0'
Our docs are missing 1 critical piece of information. Whenever using LIST and encoded URNs in the URL, we expect an additional header
'x-restli-protocol-version: 2.0.0'
正确的API调用应为请求":
The correct API call would be Request:
curl -X GET \
'https://api.linkedin.com/v2/adTargetingEntities?q=urns&urns=List(urn%3Ali%3Aindustry%3A1,urn%3Ali%3Aseniority%3A9)&locale=(language:it,country:IT)'
\
-H 'x-restli-protocol-version: 2.0.0' \
-H 'Authorization: Bearer <Token>'
响应:
{
"elements": [
{
"facetUrn": "urn:li:adTargetingFacet:industries",
"name": "Difesa e spazio",
"urn": "urn:li:industry:1"
},
{
"facetUrn": "urn:li:adTargetingFacet:seniorities",
"name": "Partner",
"urn": "urn:li:seniority:9"
}
],
"paging": {
"count": 2147483647,
"links": [],
"start": 0
}
}
是的,它确实提供了语言环境的响应.
Yes, it does provide a response in locale.
希望这可以在将来帮助其他人
Hope this can help other guys in the future
这篇关于广告定位-通过URN API ClassCastException查找实体错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!