简体   繁体   English

如何获取Pinterest V3 API-KEY或access_token

[英]How to obtain Pinterest V3 API-KEY or access_token

I am trying to fetch Pinterest data, which would be the public info of the user(follower count etc), and all pins for a user. 我正在尝试获取Pinterest数据,这将是用户的公共信息(跟随者计数等),以及用户的所有引脚。

I know the v3 API are up now and v2 apis have been taken down. 我知道v3 API现在已经启动,v2 apis已被取消。

I found this link which gives me end points for exactly what I want: 我找到了这个链接,它给出了我想要的终点:

http://techslides.com/most-repinned-pinterest-pins-by-website/ http://techslides.com/most-repinned-pinterest-pins-by-website/

But I am unable to get an access_token. 但是我无法获得access_token。 I have asked pinterest for api access but they have not replied. 我已经要求pinirest api访问,但他们没有回复。 And I am unable to sniff app data too. 我也无法嗅探应用数据。

I also tried Pinterest's signature tester tool which is on their website but no luck. 我也尝试过Pinterest的签名测试工具,这个工具在他们的网站上但没有运气。 The link it generates doesn't work either. 它生成的链接也不起作用。 It returns a authorization failure. 它返回授权失败。

https://developers.pinterest.com/tools/signature/ https://developers.pinterest.com/tools/signature/

I have access to APP-ID and Client-Secret. 我可以访问APP-ID和Client-Secret。 I need to know how can I get an access token/ API-KEY to get the following work fine for me: 我需要知道如何获得访问令牌/ API-KEY以使我能够完成以下工作:

https://api.pinterest.com/v3/users/jessicamalba/?access_token=APIKEY https://api.pinterest.com/v3/users/jessicamalba/?access_token=APIKEY

EDIT 编辑

Before I am told that is an duplicate of 在我被告知之前是重复的

How to get access token for access Pinterest Api 如何获取访问令牌以访问Pinterest Api

I would just say that it is not. 我只想说它不是。 This question was asked one year ago and was asked in respect to V2 api. 这个问题是在一年前被问到的,并被问及V2 api。 Which now return a 404 status. 现在返回404状态。 So now here I am asking about the V3 api. 所以现在我在这里询问V3 api。

Okay, so as of today, following are the parts of the api that are public and used by widgets. 好的,从今天开始,以下是api的部分公开并由小部件使用。

Public parts of API (used by widgets) Retrieving the pins on a particular board: API的公共部分(由小部件使用)检索特定板上的引脚:

GET http://widgets.pinterest.com/v3/pidgets/boards/eecolor/test/pins/ 获取http://widgets.pinterest.com/v3/pidgets/boards/eecolor/test/pins/
GET http://api.pinterest.com/v3/pidgets/boards/eecolor/test/pins/ 获取http://api.pinterest.com/v3/pidgets/boards/eecolor/test/pins/

Retrieving the pins of a particular user: 检索特定用户的引脚:

GET http://widgets.pinterest.com/v3/pidgets/users/eecolor/pins/ 获取http://widgets.pinterest.com/v3/pidgets/users/eecolor/pins/

Retrieving the information of (a) particular pin(s): 检索(a)特定引脚的信息:

GET http://widgets.pinterest.com/v3/pidgets/pins/info/?pin_ids=521150988102375972 获取http://widgets.pinterest.com/v3/pidgets/pins/info/?pin_ids=521150988102375972
GET http://widgets.pinterest.com/v3/pidgets/pins/info/?pin_ids=521150988102375972,10133167885969245 获取http://widgets.pinterest.com/v3/pidgets/pins/info/?pin_ids=521150988102375972,10133167885969245

Count the number of pins: 计算引脚数:

http://widgets.pinterest.com/v1/urls/count.json?url= {urlEncodedLink} http://widgets.pinterest.com/v1/urls/count.json?url=http%3A%2F%2Fwww.flickr.com%2Fphotos%2Fssass%2F3436030086%2F http://widgets.pinterest.com/v1/urls/count.json?url= {urlEncodedLink} http://widgets.pinterest.com/v1/urls/count.json?url=http%3A%2F%2Fwww .flickr.com%2Fphotos%2Fssass%2F3436030086%2F

Note that the link is returned in the other API responses 请注意,该链接在其他API响应中返回

You can use ?callback=myJsFunction to use JSONP 你可以使用?callback = myJsFunction来使用JSONP

GET http://widgets.pinterest.com/v3/pidgets/boards/eecolor/test/pins/?callback=myJsFunction 获取http://widgets.pinterest.com/v3/pidgets/boards/eecolor/test/pins/?callback=myJsFunction

You can use api instead of widgets and also https 您可以使用api而不是小部件以及https

GET http://api.pinterest.com/v3/pidgets/boards/eecolor/test/pins/ 获取http://api.pinterest.com/v3/pidgets/boards/eecolor/test/pins/
GET https://api.pinterest.com/v3/pidgets/boards/eecolor/test/pins/ 获取https://api.pinterest.com/v3/pidgets/boards/eecolor/test/pins/

To preface, I saw some discussion that even though you can get the token, it may not work unless you are an approved developer. 作为前言,我看到一些讨论,即使您可以获得令牌,除非您是经过批准的开发人员,否则它可能无效。 So you might consider applying to be an API developer while you wait to try to work all this out. 因此,您可以考虑申请成为API开发人员,同时等待尝试完成所有这些工作。 Also V3 is beta, so.. This answer might work for now however, it may not work later if it ends up not being the official way to get the token when it comes out of beta. V3也是测试版,所以..这个答案现在可能有用了,但是如果最终不能成为获得令牌的官方方式,它可能无法运行。

Step one : Log into pinterest then you need to create an application on the https://developers.pinterest.com/manage/ link which you can also get from the main developers page on pinterest. 第一步 :登录pinterest然后你需要在https://developers.pinterest.com/manage/链接上创建一个应用程序,你也可以从pinterest的主开发者页面获得。 I chose to create IOS application, even though I don't plan to use this with IOS, just so I could get an application created to try to make the API work. 我之所以选择创建IOS应用程序,即使我不打算在IOS上使用它,也只是因为我可以创建一个应用程序来尝试使API工作。

Part of the creation of the app, asks you to specify a callback url, this is the url on your website that is going to receive the token & token related data in a hash tag {I presume they did this so that only javascript can get at it rather than php directly} however you could modify the hashtag in javascript to drop the hash and redirect it to another url which can collect it as get or post params. 创建应用程序的一部分,要求您指定一个回调网址,这是您的网站上将在哈希标记中接收令牌和令牌相关数据的网址{我认为他们这样做是为了只有javascript才能获得然而你可以修改javascript中的hashtag以删除哈希并将其重定向到另一个url,它可以将其作为get或post params收集。

Once created replace the application id "1412345" (ie consumer_id, also sometimes called client_id) into the url below. 创建后,将应用程序ID“1412345”(即consumer_id,有时也称为client_id)替换为下面的URL。

What I have seen is this number starts with 14...... at present 我所看到的是这个数字从14开始......目前

https://www.pinterest.com/oauth/?consumer_id=1412345&response_type=token https://www.pinterest.com/oauth/?consumer_id=1412345&response_type=token

Step two : The executed url above will bring you to a page asking you to authorize the application to access your user account. 第二步 :上面执行的URL将带您进入一个页面,要求您授权应用程序访问您的用户帐户。 Once you authorize it it will send the token back to your website. 授权后,它会将令牌发回您的网站。 in the hash tag and you can use javascript to read the hashtag 在哈希标记中,您可以使用javascript来读取主题标签

window.location.hash.substr(1, window.location.hash.length) will get you the get params string from the hash tag containing access_token, expires_at (duration in seconds which equals 30 days) and token_type which will equal "bearer" window.location.hash.substr(1,window.location.hash.length)将从包含access_token的hash标记中获取get params字符串,expires_at(以秒为单位的持续时间,等于30天)和token_type将等于“bearer”

Note the token will be base_64 encoded, I don't know if it's supposed to stay that way to be used but I presume so. 请注意,令牌将是base_64编码,我不知道它是否应该保持这种方式使用,但我猜是这样。

this is a official Pinterest Documentation every thing you find it here, I did same for my requirement. 这是一个正式的Pinterest文档,你在这里找到的每一件事,我都按照我的要求做了同样的事情。 Access token 访问令牌

how to use it 如何使用它

But it for V1 api 但它适用于V1 api

examples: 例子:

https://api.pinterest.com/v1/pins/431430839282408407/?access_token=aaa
https://api.pinterest.com/v1/boards/lorihiney/quotes/pins/?access_token=aa&limit=20&fields=id,link,counts
https://api.pinterest.com/v1/boards/mother1086/test-title/pins/?access_token=aaa&limit=2&fields=id,link,counts

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用授权标头在java中使用来自box.com的access_token向API V2发送请求 - Sending Request to API V2 using access_token from box.com in java with Authorization Header 谷歌androidpublish api access_token - Google androidpublish api access_token 如何在rest控制器spring boot中为邮递员生成api-key - how to generate api-key for postman in rest controller spring boot access_token无效 - The access_token invalid 如何使用 Java 访问 Google Calendar REST API v3 - How to Access Google Calendar REST API v3 with Java 如何从Java服务器将Google api access_token传递给gapi javascript客户端? - How can I pass a google api access_token from java server to gapi javascript client? 使用Azure AD Graph API时如何获取用于获取access_token的“代码” - how to get 'code' for getting access_token when using Azure AD Graph API Salesforce REST API在每个线程中创建新的access_token - Salesforce REST API create new access_token in every thread 如何从v2和v3的Openstack4j Java API中的令牌获取正确的OSClient? - How to get right OSClient from token in Openstack4j java api for v2 and v3? 获取 pinterest 访问令牌的代码 - Code to get access token for pinterest
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM