Tuesday, January 21, 2014

How do I: Create a LinkedIn post using the Share API


bodyRequest = JSON.stringify({

   "comment": "Check out the LinkedIn Share API!",

   "content": {

      "title": "LinkedIn Developers Documentation On Using the Share API",

      "description": "Leverage the Share API to maximize engagement on user-generated content on LinkedIn",

      "submittedUrl": "https://developer.linkedin.com/documents/share-api",

      "submittedImageUrl": "http://m3.licdn.com/media/p/3/000/124/1a6/089a29a.png"

   },

    "visibility": {
"code": "anyone"
  }

})

IN.API.Raw("people/~/shares")
           .method("POST")
           .body(bodyRequest)
           .result(function(result) { console.log("Success") }).
           error(function(result) {
              console.log(JSON.stringify(result));
           });

Helpful LinkedIn Documentation

Tuesday, January 14, 2014

How do I: Add related articles to my Blogger blog post

<script>

$( document ).ready(function() { //xxx

   gapi.client.setApiKey('yourAPIkeyHere');


gapi.client.load('blogger', 'v3', function() { //xx
var request = gapi.client.blogger.posts.get({
  'blogId': 'yourBlogIdHere',
  'postId': 'yourPostIdhere''
  });
  request.execute(function(resp) { //x

console.log(resp.labels);
labelArray = resp.labels;
console.log(labelArray);
PostTitle = resp.title;
var count = 0;
(function loop() {
setTimeout(function() {
var request = gapi.client.blogger.posts.list({
  'blogId': 'yourBlogIdHere',
  'labels': ""+labelArray[count]+"",
  'fields': 'items(title,url)'
  });

console.log(labelArray[count]);

request.execute(function(resp) { 

for (var i=0; i<resp.items.length; i++)
 { 

if (PostTitle != resp.items[i].title) {  
        $varUrl = resp.items[i].url;
        $varTitle = resp.items[i].title;
        $('#yourPostIdHere-RelatedLinks').append("<a href='"+$varUrl+"'>"+$varTitle+"</a><br />"); };
 }
 });
  count ++
  if (count < labelArray.length) {
            loop();
        }
    }, 2000);
})();


}); //x

}); //xx

}); //xxx

</script>

<!---------- Page Head ------------->

<div id="yourPostId-RelatedLinks">
<br />
Related posts:<br /></div>


Saturday, January 11, 2014

How do I: Delete a Google map?

The maps designated at "Public" can be deleted using the chevron.The map designated as "Created by me" must be clicked on and then the folder clicked.

Friday, January 10, 2014

How do I: Add a Blogger API request to a blogger post

<script>
$( document ).ready(function() {
   gapi.client.setApiKey('AIzaSyDr_88wJPOuLxAxIZ0x6-PyatKQlAPUJbQ');
gapi.client.load('blogger', 'v3', function() { 
var request = gapi.client.blogger.posts.search({
  'blogId': '2890424799132823363',
  'q': 'database'
  });
  request.execute(function(resp) {console.log(resp);});
});
});
</script>


Wednesday, January 8, 2014

YouTube Data API: Getting all uploaded videos from a channel

 var request = gapi.client.youtube.channels.list({
  'part': 'contentDetails',
  'mine': 'true'
  });

request.execute(function(resp) {uploadsVar = resp.items[0].contentDetails.relatedPlaylists.uploads});

  var request = gapi.client.youtube.playlistItems.list({
  'part': 'snippet',
  'playlistId': ""+uploadsVar+""
  });


Tuesday, January 7, 2014

403 Access Not Configured: Google YouTube Data v3 API

Recently while running this YouTube Data API code:

 var request = gapi.client.youtube.channels.list({
  'part': 'contentDetails',
  'mine': 'true'
  });
request.execute(function(resp) {console.log(resp)});

I received a "403 Access not configured" and I couldn't figure out exactly what was going on. I did go to the Google app console and switch on the YouTube Data API v3 which I was sure was already switched on. But even after the YouTube Data API was switched on the still got the "403 Access not configured". But then about 15 min later I to was no longer getting the 403 and the code was working. I'm still not sure what was causing the problem.