Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I have a google document with several named versions that were added using the UI, I need the ability to
Get a link to a document that will point to a specific version, using API
Add a new version, using API.
The idea behind that is to use this link to connect a document to a specific commit in the git repository
Can't find any reference in docs, I found some issues in Stack overflow but no one gives a proper solution.
Answer for Question 1:
Get a link to a document that will point to a specific version, using API
Unfortunately, in the current stage, it seems that there are no methods for retrieving the URL for directly opening Google Document for each revision. Ref As a workaround, when the Google Document is opened for each revision as the export, this can be used.
In this case, you can use the following sample request.
curl \
-H 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
'https://www.googleapis.com/drive/v3/files/{documentId}/revisions?fields=*'
When this request is run, the following result is obtained.
{
"kind": "drive#revisionList",
"revisions": [
{
"kind": "drive#revision",
"id": "1",
"mimeType": "application/vnd.google-apps.document",
"modifiedTime": "###",
"published": false,
"lastModifyingUser": {
"kind": "drive#user",
"displayName": "###",
"photoLink": "###",
"me": true,
"permissionId": "###",
"emailAddress": "###"
},
"exportLinks": {
"application/rtf": "###",
"application/vnd.oasis.opendocument.text": "###",
"text/html": "###",
"application/pdf": "###",
"application/epub+zip": "###",
"application/zip": "###",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "###",
"text/plain": "###"
}
},
,
,
,
]
}
For above returned value, for example, when application/vnd.openxmlformats-officedocument.wordprocessingml.document of exportLinks at the 1st index is retrieved, that is the URL of DOCX data for the revision number 1.
In this case, the URL is not publicly shared. So please be careful this. When you want to access to it, it is required to login. And when you want to make users access to it, please share it with the users.
Answer for Question 2:
Add a new version, using API.
In this case, unfortunately, there is not method for creating the revision in "Revisions" of Drive API. But, when the Document is updated using Google Docs API and Google Apps Script, new revision number is added. I thought that this might be used for your situation.
References:
Download and publish file revisions
Revisions: list
Revisions
Related
Via the BIM360 API, I am able to create Quality Issues and upload files (to be used as attachments). However, even though I am calling Post Attachments (https://forge.autodesk.com/en/docs/bim360/v1/reference/http/field-issues-attachments-POST/) (and all responses are good), nothing appears on the Issue screen.
Issue screen with manually added file. How can I make my attached file appear under the References->Files section?
(Note, I saw a mention elsewhere of the relationships API, but I get a random error just calling the first "asset" API [{"title":"Forbidden","detail":"Forbidden","errorCode":"GENERAL_ERROR","type":"https://developer.api.autodesk.com/bim360/assets/v1/error-codes/GENERAL_ERROR"}])
firstly, the screenshot shows you are working with Issues in Autodesk Construction Cloud (ACC), while the API you are using is for BIM360 Issue. This API is NOT compatible with ACC.
To work with ACC Issue, the API is available at the category of ACC:
https://forge.autodesk.com/en/docs/acc/v1/reference/http/issues-issues-GET/
this blog tells more.
https://forge.autodesk.com/blog/acc-issues-api-available-preview
In the context of ACC, the attachment(references) is managed by the general API (Relationship API). In Additional Tests of Postman collection of ACC Issue API, I demoed how to add Photo with the Issue. The logic is similar.
https://github.com/Autodesk-Forge/forge-acc.issues.api-postman.collection
Firstly, use Data Management API to get the document urn. Then, use ACC Issue API to get id of one issue. finally, use Relationship API to bind them.
PUT https://developer.api.autodesk.com/bim360/relationship/v2/containers/{{project_id_without_b}}/relationships
P.s. -bim360- in the domains is just because of legacy design of the terminologies. It can work for the contexts of both BIM360 and ACC (note it is Relationship API can work within both of the contexts)
Payload:
[
{
"entities": [
{
"domain": "autodesk-bim360-issue",
"type": "issue",
"id": "{{one_issue_id}}"
},
{
"domain": "autodesk-bim360-documentmanagement",
"type": "documentlineage",
"id": "{{one_document_urn}}"
}
]
}
]
Is there a reliable way, short of comparing full contents, of checking if a file was updated/change in Drive?
I have been struggling with this for a bit. Here's the two things I have tried:
1. File version number
I upload a plain text file to Google Drive (simple upload, update endpoint), and save the version from the file metadata returned after a successful upload.
Then I poll the Drive API (get endpoint) occasionally to check if the version has changed.
The trouble is that within a second or two of uploading the file, the version gets bumped up again.
There are no changes to the file content. The file has not been opened, viewed, or even downloaded anywhere else. Still, the version number increases from what it was after the upload.
To my code this version number change indicates that the remote file has been changed in Drive, so it downloads the new version. Every time!
2. The Changes endpoints
As an alternative I tried using the Changes api.
After I upload the file, I get a page token using changes.getStartPageToken or changes.list.
Later I use this page token to poll the Changes API for changes, and filter the changes for the fileId of uploaded file. I use these options when polling for changes:
{
"includeRemoved": false
"restrictToMyDrive": true
"spaces": "drive"
}
Here again, there is the same problem as with the version number. The page token returned immediately after uploading the file changes again within a second or two. The new page token shows the uploaded file having been changed.
Again, there is no change to the content of the file. It hasn't been opened, updated, downloaded anywhere else. It isn't shared with anyone else.
Yet, a few seconds after uploading, the file reappears in the changes list.
As a result, the local code redownloads the file from Drive, assuming remote changes.
Possible workaround
As a hacky hook, I could wait a few seconds after the file upload before getting the new file-version/changes-page-token. This may take care of the delayed version increment issue.
However, there is no documentation of what is causing this phantom change in version number (or changes.list). So, I have no sure way of knowing:
How long a wait is safe enough to get a 'settled' version number without losing possible changes by other users/apps?
Whether the new (delayed) version number will be stable, or may change again at any time for no reason?
Is there a reliable way, short of comparing full contents, of checking if a file was updated/change in Drive?
You can try using the md5Checksum property of the File resource object, if your file is not a Google Doc file (ie. binary). You should be able to use that to track changes to the contents of your binary files.
You might also be able to use the Revisions API.
The Revisions resource object also has a md5Checksum property.
As a workaround, how about using Drive Activity API? I think that there are several answers for your situation. So please think of this as just one of them.
When Drive Activity API is used, the activity information about the target file can be retrieved. For example, from ActionDetail, you can see whether the target file was edited, renamed, deleted and so on.
The sample endpoint and request body are as follows.
Endpoint:
POST https://driveactivity.googleapis.com/v2/activity:query?fields=activities%2CnextPageToken
Request body:
{"itemName": "items/### fileId of target file ###"}
Response:
Sample response is as follows. You can see the information from this. The file with the fileId and filename was edited at the timestamp.
{
"activities": [
{
"primaryActionDetail": {
"edit": {} <--- If the target file was edited, this property is added.
},
"actors": [
{
"user": {
"knownUser": {
"personName": "people/### userId who edited the target file ###",
"isCurrentUser": true
}
}
}
],
"actions": [
{
"detail": {
"edit": {}
}
}
],
"targets": [
{
"driveItem": {
"name": "items/### fileId of target file ###",
"title": "### filename of target file ###",
"file": {},
"mimeType": "### mimeType of target file ###",
"owner": {
"user": {
"knownUser": {
"personName": "people/### owner's userId ###",
"isCurrentUser": true
}
}
}
}
}
],
"timestamp": "2000-01-01T00:00:0.000Z"
},
],
"nextPageToken": "###"
}
Note:
When you use this API in my environment, please enable Drive Activity API at API console and include https://www.googleapis.com/auth/drive.activity.readonly in the scopes.
Although when I used this API, I felt that the response was fast, if the response was slow when you use this, I apologize.
References:
Google Drive Activity API
ActionDetail
If this was not what you want, I apologize.
What you are seeing is the eventual consistency feature of the Google Drive filesystem. If you think about search, it doesn't matter how quickly a search index is updated, only that it is eventually updated and is very efficient for reading. Google Drive works on the same premise.
Drive acknowledges your updates as quickly as possible. Long before those updates have propagated to all worldwide copies of your file. Derived data (eg. timestamps and I think I recall, md5sums) are also calculated after the update has "completed".
The solution largely depends on how problematic the redundant syncs are to your app.
The delay of a few seconds is enough to deal with the vast majority of phantom updates.
You could switch to the v2 API and use etags.
You could implement your own version number using custom properties. So every time you sync up, you increment your own version number. You only sync down if the application version number has changed.
There is a folder shared with everyone (shared set of "Anyone with the link can view").
I want to get all spreadsheets in the folder by using the Drive API.
I tried to get them by using the Files list of Drive API.
Then q parameter is the following.;
https://www.googleapis.com/drive/v2/files?q='{publishFolderId}' in parents and mimeType = 'application/vnd.google-apps.spreadsheet' and trashed = false
But I could not get them. many tmes.
// response
{
"kind": "drive#fileList",
"etag": "\"xxxxxxxxxxxxx\"",
"selfLink": "xxxxxxxxxxx",
"items": [
]
}
Could I realize the above requirements by using the API of the Files list?
Remarks
In my guess...
Once I open the folder from the web browser, I can get them from the folder.
Althogh I could not get them many times in eary August 2015, the phenomnon seems to be reolved at this moment.
I'm currently triggering my Jenkins builds through a GitHub webhook. How would I parse the JSON payload? If I try to parameterize my build and use the $payload variable, the GitHub webhook fails with the following error:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 400 This page expects a form submission</title>
</head>
<body><h2>HTTP ERROR 400</h2>
<p>Problem accessing /job/Jumph-CycleTest/build. Reason:
<pre> This page expects a form submission</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
</body>
</html>
How can I get my GitHub webhook to work with a parameterized Jenkins build, and how could I then parse the webhook payload to use certain lines, such as the username of the committer, as conditionals in the build?
There are a few tricks to get this to work, and I found the (now defunct) chloky.com blog post to be helpful for most of it. Since it sounds like you've gotten the webhook communicating with your Jenkins instance at least, I'll skip over those steps for now. But, if you want more detail, just scroll past the end of my answer to see the content I was able to salvage from chloky.com - I do not know the original author and the information might be out of date but I did find it helpful.
So to summarize, you can do the following to deal with the payload:
Set up a string parameter called "payload" in your Jenkins job. If you are planning on manually running the build, it might be a good idea to give it a default JSON document at some point but you don't need one right now. This parameter name appears to be case-sensitive (I'm using Linux so that's no surprise...)
Set up the webhook in github to use the buildWithParameters endpoint instead of the build endpoint, i.e.
http://<<yourserver>>/job/<<yourjob>>/buildWithParameters?token=<<yourtoken>>
Configure your webhook to use application/x-www-form-encoded instead of application/json. The former approach packs the JSON data in a form variable called "payload", which is presumably how Jenkins can assign it to an environment variable. The application/json approach just POSTs raw JSON which does not seem to be mappable to anything (I couldn't get it to work). You can see the difference by pointing your webhook to something like requestbin and inspecting the results.
At this point, you should get your $payload variable when you kick off the build. To parse the JSON, I highly recommend installing jq on your Jenkins server and try out some of the parsing syntax here. JQ is especially nice because it's cross-platform.
From here, just parse what you need from the JSON into other environment variables. Combined with conditional build steps, this could give you a lot of flexibility.
Hope this helps!
EDIT here's what I could grab from the original blog posts at http://chloky.com/tag/jenkins/, which has been dead for a while.
Hopefully this content is also useful for someone.
Post #1 - July 2012
Github provides a nice way to fire off notifications to a CI system like jenkins whenever a commit is made against a repository. This is really useful for kicking off build jobs in jenkins to test the commits that were just made on the repo. You simply need to go to the administration section of the repository, click on service hooks on the left, click ‘webhook URLs’ at the top of the list, and then enter the URL of the webhook that jenkins is expecting (look at this jenkins plugin for setting up jenkins to receive these hooks from github).
Recently though, I was looking for a way to make a webhook fire when a pull request is made against a repo, rather than when a commit is made to the repo. This is so that we could have jenkins run a bunch of tests on the pull request, before deciding whether to merge the pull request in – useful for when you have a lot of developers working on their own forks and regularly submitting pull requests to the main repo.
It turns out that this is not as obvious as one would hope, and requires a bit of messing about with the github API.
By default, when you configure a github webhook, it is configured to only fire when a commit is made against a repo. There is no easy way to see, or change, this in the github web interface when you set up the webhook. In order to manipulate the webhook in any way, you need to use the API.
To make changes on a repo via the github API, we need to authorize ourselves. We’re going to use curl, so if we wanted to we could pass our username and password each time, like this:
# curl https://api.github.com/users/mancdaz --user 'mancdaz'
Enter host password for user 'mancdaz':
Or, and this is a much better option if you want to script any of this stuff, we can grab an oauth token and use it in subsequent requests to save having to keep entering our password. This is what we’re going to do in our example. First we need to create an oauth authorization and grab the token:
curl https://api.github.com/authorizations --user "mancdaz" \
--data '{"scopes":["repo"]}' -X POST
You will be returned something like the following:
{
"app":{
"name":"GitHub API",
"url":"http://developer.github.com/v3/oauth/#oauth-authorizations-api"
},
"token":"b2067d190ab94698a592878075d59bb13e4f5e96",
"scopes":[
"repo"
],
"created_at":"2012-07-12T12:55:26Z",
"updated_at":"2012-07-12T12:55:26Z",
"note_url":null,
"note":null,
"id":498182,
"url":"https://api.github.com/authorizations/498182"
}
Now we can use this token in subsequent requests for manipulating our github account via the API. So let’s query our repo and find the webhook we set up in the web interface earlier:
# curl https://api.github.com/repos/mancdaz/mygithubrepo/hooks?access_token=b2067d190ab94698592878075d59bb13e4f5e96
[
{
"created_at": "2012-07-12T11:18:16Z",
"updated_at": "2012-07-12T11:18:16Z",
"events": [
"push"
],
"last_response": {
"status": "unused",
"message": null,
"code": null
},
"name": "web",
"config": {
"insecure_ssl": "1",
"content_type": "form",
"url": "http://jenkins-server.chloky.com/post-hook"
},
"id": 341673,
"active": true,
"url": "https://api.github.com/repos/mancdaz/mygithubrepo/hooks/341673"
}
]
Note the important bit from that json output:
"events": [
"push"
]
This basically says that this webhook will only trigger when a commit (push) is made to the repo. The github API documentation describes numerous different event types that can be added to this list – for our purposes we want to add pull_request, and this is how we do it (note that we get the id of the webhook from the json output above. If you have multiple hooks defined, your output will contain all these hooks so be sure to get the right ID):
# curl https://api.github.com/repos/mancdaz/mygithubrepo/hooks/341673?access_token=b2067d190ab94698592878075d59bb13e4f5e96 -X PATCH --data '{"events": ["push", "pull_request"]}'
{
"created_at": "2012-07-12T11:18:16Z",
"updated_at": "2012-07-12T16:03:21Z",
"last_response": {
"status": "unused",
"message": null,
"code": null
},
"events": [
"push",
"pull_request"
],
"name": "web",
"config": {
"insecure_ssl": "1",
"content_type": "form",
"url": "http://jenkins-server.chloky.com/post-hook"
},
"id": 341673,
"active": true,
"url": "https://api.github.com/repos/mancdaz/mygithubrepo/hooks/341673"
}
See!
"events": [
"push",
"pull_request"
],
This webhook will now trigger whenever either a commit OR a pull request is made against our repo. Exactly what you do in your jenkins/with this webhook is up to you. We use it to kick off a bunch of integration tests in jenkins to test the proposed patch, and then actually merge and close (again using the API) the pull request automatically. Pretty sweet.
Post #2 - September 2012
In an earlier post, I talked about configuring the github webhook to fire on a pull request, rather than just a commit. As mentioned, there are many events that happen on a github repo, and as per the github documentation, a lot of these can be used to trigger the webhook.
Regardless of what event you decide to trigger on, when the webhook fires from github, it essentially makes a POST to the URL configured in the webhook, including a json payload in the body. The json payload contains various details about the event that caused the webhook to fire. An example payload that fired on a simple commit can be seen here:
payload
{
"after":"c04a2b2af96a5331bbee0f11fe12965902f5f571",
"before":"78d414a69db29cdd790659924eb9b27baac67f60",
"commits":[
{
"added":[
"afile"
],
"author":{
"email":"myemailaddress#mydomain.com",
"name":"Darren Birkett",
"username":"mancdaz"
},
"committer":{
"email":"myemailaddress#mydomain.com",
"name":"Darren Birkett",
"username":"mancdaz"
},
"distinct":true,
"id":"c04a2b2af96a5331bbee0f11fe12965902f5f571",
"message":"adding afile",
"modified":[
],
"removed":[
],
"timestamp":"2012-09-03T02:35:59-07:00",
"url":"https://github.com/mancdaz/mygithubrepo/commit/c04a2b2af96a5331bbee0f11fe12965902f5f571"
}
],
"compare":"https://github.com/mancdaz/mygithubrepo/compare/78d414a69db2...c04a2b2af96a",
"created":false,
"deleted":false,
"forced":false,
"head_commit":{
"added":[
"afile"
],
"author":{
"email":"myemailaddress#mydomain.com",
"name":"Darren Birkett",
"username":"mancdaz"
},
"committer":{
"email":"myemailaddress#mydomain.com",
"name":"Darren Birkett",
"username":"mancdaz"
},
"distinct":true,
"id":"c04a2b2af96a5331bbee0f11fe12965902f5f571",
"message":"adding afile",
"modified":[
],
"removed":[
],
"timestamp":"2012-09-03T02:35:59-07:00",
"url":"https://github.com/mancdaz/mygithubrepo/commit/c04a2b2af96a5331bbee0f11fe12965902f5f571"
},
"pusher":{
"email":"myemailaddress#mydomain.com",
"name":"mancdaz"
},
"ref":"refs/heads/master",
"repository":{
"created_at":"2012-07-12T04:17:51-07:00",
"description":"",
"fork":false,
"forks":1,
"has_downloads":true,
"has_issues":true,
"has_wiki":true,
"name":"mygithubrepo",
"open_issues":0,
"owner":{
"email":"myemailaddress#mydomain.com",
"name":"mancdaz"
},
"private":false,
"pushed_at":"2012-09-03T02:36:06-07:00",
"size":124,
"stargazers":1,
"url":"https://github.com/mancdaz/mygithubrepo",
"watchers":1
}
}
This entire payload gets passed in the POST requests as a single parameter, with the imaginative title payload. It contains a ton of information about the event that just happened, all or any of which can be used by jenkins when we build jobs after the trigger. In order to use this payload in Jenkins, we have a couple of options. I discuss one below.
Getting the $payload
In jenkins, when creating a new build job, we have the option of specifying the names of parameters that we expect to pass to the job in the POST that triggers the build. In this case, we would pass a single parameter payload, as seen here:
Passing parameters to a jenkins build job
Further down in the job configuration, we can specify that we would like to be able to trigger the build remotely (ie. that we want to allow github to trigger the build by posting to our URL with the payload):
Then, when we set up the webhook in our github repo (as described in the first post), we give it the URL that jenkins tells us to:
You can’t see it all in the screencap, but the URL I specified for the webhook was the one that jenkins told me to:
http://jenkins-server.chloky.com:8080/job/mytestbuild//buildWithParameters?token=asecuretoken
Now, when I built my new job in jenkins, for the purposes of this test I simply told it to echo out the contents of the ‘payload’ parameter (which is available in paramterized builds as a shell variable of the same name), using a simple script:
#!/bin/bash
echo "the build worked! The payload is $payload"
Now to test the whole thing we simply have to make a commit to our repo, and then pop over to jenkins to look at the job that was triggered:
mancdaz#chloky$ (git::master)$ touch myfile
mancdaz#chloky$ (git::master) git add myfile
mancdaz#chloky$ (git::master) git commit -m 'added my file'
[master 4810490] added my file
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 myfile
mancdaz#chloky$ (git::master) git push
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 232 bytes, done.
Total 2 (delta 1), reused 0 (delta 0)
To git#github.com:mancdaz/mygithubrepo.git
c7ecafa..4810490 master -> master
And over in our jenkins server, we can look at the console output of the job that was triggered, and lo and behold there is our ‘payload’ contained in the $payload variable and available for us to consume:
So great, all the info about our github event is here. and fully available in our jenkins job! True enough, it’s in a big json blob, but with a bit of crafty bash you should be good to go.
Of course, this example used a simple commit to demonstrate the principles of getting at the payload inside jenkins. As we discussed in the earlier post, a commit is one of many events on a repo that can trigger a webhook. What you do inside jenkins once you’ve triggered is up to you, but the real fun comes when you start interacting with github to take further actions on the repo (post comments, merge pull requests, reject commits etc) based on the results of your build jobs that got triggered by the initial event.
Look out for a subsequent post where I tie it all together and show you how to process, run tests for, and finally merge a pull request if successful – all automatically inside jenkins. Automation is fun!
There is a Generic Webhook Trigger plugin that can contribute values from the post content to the build.
If the post content is:
{
"app":{
"name":"GitHub API",
"url":"http://developer.github.com/v3/oauth/#oauth-authorizations-api"
}
}
You can configure it like this:
And when triggering with some post content:
curl -v -H "Content-Type: application/json" -X POST -d '{ "app":{ "name":"GitHub API", "url":"http://developer.github.com/v3/oauth/" }}' http://localhost:8080/jenkins/generic-webhook-trigger/invoke?token=sometoken
It will resolv variables and make them available in the build job.
{
"status":"ok",
"data":{
"triggerResults":{
"free":{
"id":2,
"regexpFilterExpression":"",
"regexpFilterText":"",
"resolvedVariables":{
"app_name":"GitHub API",
"everything_app_url":"http://developer.github.com/v3/oauth/",
"everything":"{\"app\":{\"name\":\"GitHub API\",\"url\":\"http://developer.github.com/v3/oauth/\"}}",
"everything_app_name":"GitHub API"
},
"searchName":"",
"searchUrl":"",
"triggered":true,
"url":"queue/item/2/"
}
}
}
}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Update Aug 2015: Pinterest provides it here now https://dev.pinterest.com/
Is there official or unofficial documentation on the v2 Pinterest API?
Things I know:
JSON api is in version 2. https://api.pinterest.com/v2 gives you a json response
People are programming against it because there is a mobile app and beta dev
Pintrest authentication question on SO
PHP wrapper for v1 with updates for v2 on Github by Kellan with methods: upload, pin, repin, boards, activity, popular - reading Kellan's code is the best information I could find
More info on Kellan's work with responses from Pinterest team
Private unofficial Facebook Pinterest Dev group
Here are some of the stars behind Pinterest
Update Mar 4 2014
Pinterest has unveiled a beta v3 API which you can request access to. Scroll down the page and you'll see the endpoints listed in the left column.
https://developers.pinterest.com/api_docs/
Update Jan 9 2013
Since https://api.pinterest.com/v2 gives a 404, it seems to have been moved to v3.
https://api.pinterest.com/v3
{ "status": "failure", "code": 11, "host": "053", "generated_at": "Wed, 09 Jan 2013 10:25:27 +0000", "message": "API method not found.", "data": null }
Update Nov 19, 2012
The unofficial api documentation at http://tijn.bo.lt/pinterest-api is gone, along with their entire website. I'm leaving the link in this post because it may come back online. Still no word from Pinterest to developers on their api status.
Update May 22, 2012
Pinterest has still not provided a public api. People are connecting to the api endpoints as the iPhone user agent, which is available to the iOS app
Update Apr 17, 2012
Thanks to tijn, we have unofficial version 1(now v2) Pinterest api docs, and reports that only read endpoints are currently available so RSS style feeds are possible within rate limits.
Update Apr 3, 2012
The unofficial Facebook group has some quality info on it and several people asking questions and posting fairly useful responses
I want to offer an update on the current status of the Pinterest API.
There is still no public API available. Pinterest also does not seem to be approving anyone who applies for access on their site.
As of right now, the endpoints of the Pinterest v3 API are almost complete although there is no official documentation. Below is a brief list of the types of endpoints that are available:
https://api.pinterest.com/v3/users/
https://api.pinterest.com/v3/search/
https://api.pinterest.com/v3/domains/
https://api.pinterest.com/v3/categories/
https://api.pinterest.com/v3/oauth/
https://api.pinterest.com/v3/boards/
https://api.pinterest.com/v3/pins/
https://api.pinterest.com/v3/batch/
https://api.pinterest.com/v3/login/
You may discover many sub-endpoints to each of the endpoint above. I do have a list of many available endpoints, but since they're not public, I'm not going to post them here (Hint: Most of them are easy to guess). All of the above endpoints require an access_token parameter except for the login endpoint.
To generate a valid access_token, the developer will need to be granted access to the API by Pinterest which we all know is currently almost impossible.
Another option is to write a script to simulate a log in action to the /v3/login endpoint with your Pinterest username and password. It will return an access_token if request is successful. I'm not going into details about how this is done, as this is never meant to be part of the public API and is meant only for users logging into Pinterest on their mobile app.
However, you can generate access token for your Pinterest account for existing apps that have been approved by Pinterest such as the Pinterest for iPhone:
https://www.pinterest.com/oauth/?consumer_id=1431594&response_type=token
You will see that the access_token is returned in the hash of the URL. You can now use this access_token to play with the endpoints and it is valid for one month. Have fun discovering them!
Endpoints that are public and do not require access_token:
Pins with a known username and known board name:
https://api.pinterest.com/v3/pidgets/boards/[username]/[board_name]/pins/
Pins with a known username:
https://api.pinterest.com/v3/pidgets/users/[username]/pins/
Retrieving the information of (a) particular pin(s):
http://api.pinterest.com/v3/pidgets/pins/info/?pin_ids=521150988102375972,10133167885969245
Count the number of pins:
http://api.pinterest.com/v1/urls/count.json?url=[urlEncodedLink]
There is no Official API Docs available for Pinterest as of today.
But there is the unofficial documentation for v2 here: http://tijn.bo.lt/pinterest-api
As of June 11, 2012 there is no officially released or documentation API for Pinterest. A Pinterest support page has a link to a form to be notified when it is officially released.
Check Pinterest API for a scraper for the time being.
If anyone's still interested, apparently URLs in the format
https://widgets.pinterest.com/v3/pidgets/users/{{ USER }}/pins
will return a nice payload of information, including user info.
There's an unofficial Pinterest API in Mashape - https://www.mashape.com/ismaelc/pinterest-1#!documentation
Screenshot below:
And here's another one that might be worth looking at (uses PhantomJSCloud API) - https://www.mashape.com/novaleaf/pinterest-to-json#!documentation
Sample response looks like this:
{
"pinterest_parser": {
"boards": [
{
"boardCover": {
"alt": "Stuff We Love / by Etsy",
"src": "http://media-cache-ak0.pinimg.com/custom_covers/216x146/155303955839058075_1385935738.jpg"
},
"boardThumbs": [
{
"alt": "",
"src": "http://media-cache-ec0.pinimg.com/45x45/eb/90/3d/eb903ddac82981f34f2071753ec2d9ac.jpg"
},
{
"alt": "",
"src": "http://media-cache-ec0.pinimg.com/45x45/01/54/79/015479f7d193838cab29334953416cf2.jpg"
},
{
"alt": "",
"src": "http://media-cache-ec0.pinimg.com/45x45/79/11/36/7911362bd2fb73a2b2edf8427e944c69.jpg"
},
{
"alt": "",
"src": "http://media-cache-ak0.pinimg.com/45x45/1b/a8/66/1ba866bdc7a4e4ee0d99fc838be1b2bb.jpg"
}
],
"href": "/etsy/products-i-love/",
"pins": "690",
"title": "Stuff We Love\n Etsy"
},
...
The question is quite old, but if anyone is still interested in an up-to-date answer: Pinterest has finally launched an official API, including an SDK for Javascript, Android and iOS.
I've been working on a PHP wrapper for it and noticed that not every endpoint in the documentation is working properly, but most of the things are working.
iv got a simple and quick way to post to Pinterest but unfortunately at this time it will only post a pin to a board and give the user the option to view their profile.
Im a iOS developer using Titanium Studio, build: 3.0.1.20.
var webView = Ti.UI.createWebView({
url : 'http://pinterest.com/pin/create/button/?url='ADD WEBSITE URL HERE '&media='ADD PICTURE URL HERE'&description=ADD DESCRIPTION HERE',
top : offset,
right : offset,
bottom : offset,
left : offset,
autoDetect : [Ti.UI.iOS.AUTODETECT_NONE]
});
It seems that
https://api.pinterest.com/v3/pins/jphellemons/
gives this message:
{
"status": "failure",
"code": 2,
"host": "ngapi-10430284",
"generated_at": "Wed, 26 Jun 2013 14:56:44 +0000",
"message": "Authentication failed.",
"data": null
}
and url https://api.pinterest.com/v3/pins/ gives
{
"status": "failure",
"code": 5,
"host": "ngapi-70bcb1cc",
"generated_at": "Wed, 26 Jun 2013 15:01:07 +0000",
"message": "Method not allowed",
"data": "405 Method Not Allowed"
}
So the upcoming API will be at that url I guess. Just authenticate with oAuth I guess.
Because they hired John Yi recently
http://allthingsd.com/20130612/the-pinterest-api-is-coming-head-of-marketing-developer-partnerships-joins-up/
http://www.businessinsider.com/pinterest-hires-john-yi-to-launch-api-2013-6
if you cannot wait for the official api: http://pinterestapi.co.uk/
update 18 june http://readwrite.com/2013/06/18/the-disappointing-tale-of-pinterests-long-awaited-api#awesm=~oeF8IxscKLvPhN
update 31 july http://allthingsd.com/20130731/about-that-pinterest-api-its-not-ready-yet/
This is the official documentation for pinterest i found, And it helps may i hope it will help u also
Official documentation
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