尝试实现“pin it”按钮,但它会为每个图像返回以下问题。我们在整个网站上使用SSL,我想知道这是否相关。
有什么想法吗?
{"route_pattern": "^/resource/:name/:method/$", "error": {"api_error_code": 1, "message": "Sorry we could not fetch the image.", "code": "API_ERROR", "target": "<webapp.resources.pin_resource.PinResource object at 0xb851c50>", "http_status": 400}, "resource": {"name": "PinResource", "options": {"board_id": "393150311159619967", "description": "Kokeshi - Samoura\u00ef Bento", "link": "https://bentooo.com/products/kokeshi-samourai-bento", "image_url": "https://bentooo.com/upload/pictures/884/thumb/IMG_0704.jpg", "bookmarks": ["-end-"], "is_video": null, "method": "button"}}, "client_context": {"app_version": "5bdef68"}, "resource_response": {"data": null, "error": {"api_error_code": 1, "message": "Sorry we could not fetch the image.", "code": "API_ERROR", "target": "<webapp.resources.pin_resource.PinResource object at 0xb851c50>", "http_status": 400}}}
答案 0 :(得分:0)
我们每次都遇到完全相同的问题。还怀疑我们的.htaccess文件有问题将非SSL重写为SSL流量。
"resource_response": {
"data": null,
"error": {
"api_error_code": 1,
"message": "Sorry! Something went wrong on our end. Please try again.",
"code": "API_ERROR",
"target": "<webapp.resources.pin_resource.PinResource object at 0x7f0c9b421e50>",
"http_status": 400
}
}
这对我们有用;不确定它是否有助于其他人?我们只是更新.htaccess以在Rewrite中包含一个排除,其中HTTP referer与* .pinterest.com匹配,然后确保&amp; media =值使用非SSL模式引用媒体资源。
示例:
RewriteCond %{ENV:siteENV} PROD
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_REFERER} !(?:pinterest.com)
RewriteRule (.*) https://www.somedomain.com%{REQUEST_URI} [L,R=301]
和密码。请注意非SSL&amp; media =值。
<a href="//pinterest.com/pin/create/button/?url=https://www.somedomain.com/mypage&media=http://www.somedomain.com/assets/images/myimage.jpg&description=Some%20urlencoded%20description" data-pin-do="buttonPin" data-pin-config="beside">
<img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" />
<img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_28.png" />
</a>