英文:
Pinterest API V5 Create Pins With Local Images
问题
我正在尝试使用官方的Pinterest API 创建一个釘圖应用程序。我完成了大部分功能,但在创建釘圖方面遇到了困难。
我无法使用我的本地文件创建釘圖,如下所示:
MEDIA_SOURCE =
{
"source_type": "image_url",
"content_type": "image/jpeg",
"data": "string",
'url':'C:/Users/USER/Images/Cat/3D62226C-A2F9-4171-BF04-B03AF416CD46.jpg'
}
HTTP 响应体: {"code":1,"message":"参数 'image url' 的值 'C:/Users/USER/Images/Cat/3D62226C-A2F9-4171-BF04-B03AF416CD46.jpg' 不是有效的 URL 格式。"}
Pinterest 给我返回了这个错误。
我尝试使用了这个 media_source 模板。它像预期的那样工作。所以,我可以在这个字典中使用 https URL,但不能使用本地文件的 URL。我认为我应该更改字典中的 source_type 值,但我找不到适用于这个 source_type 值的参数。
MEDIA_SOURCE =
{
"source_type": "image_url",
"content_type": "image/jpeg",
"data": "string",
'url':'https://URL-TO-IMAGE.jpg'
}
英文:
I'm trying to make a pinner app with official Pinterest API. I completed most of the features,
but I'm struggling with creating pins.
I can't create a pin with my local files like:
MEDIA_SOURCE =
{
"source_type": "image_url",
"content_type": "image/jpeg",
"data": "string",
'url':'C:/Users/USER/Images/Cat/3D62226C-A2F9-4171-BF04-B03AF416CD46.jpg'
}
HTTP response body: {"code":1,"message":"Parameter 'image url' with the value 'C:/Users/USER/Images/Cat/3D62226C-A2F9-4171-BF04-B03AF416CD46.jpg' is not a valid URL format."}
Pinterest gives me this error.
I tried with this media_source template. It works like expected. So, I can use https url's in this dictionary but not local file url's. I think I should change source_type value in the dictionary but I couldn't find the parameters that can be usable for this source_type value.
MEDIA_SOURCE =
{
"source_type": "image_url",
"content_type": "image/jpeg",
"data": "string",
'url':'https://URL-TO-IMAGE.jpg'
}
答案1
得分: 1
我联系了Pinterest开发者支持。目前(2023年6月),本地图片分享不可用。因此,我们必须将图片托管在服务器上。然后,我们可以使用以下媒体来源字典分享一个Pin:
MEDIA_SOURCE = {
"source_type": "image_url",
"content_type": "image/jpeg",
"data": "string",
'url':'https://URL-TO-IMAGE.jpg'
}
英文:
I contacted with Pinterest developer support. Currently (June, 2023) local image sharing is not available. So we have to host image in a server. Than we can share a pin with this media source dictionary:
MEDIA_SOURCE =
{
"source_type": "image_url",
"content_type": "image/jpeg",
"data": "string",
'url':'https://URL-TO-IMAGE.jpg'
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论