Parsing Instagram JSON on Apex

Last week I had a challenge of making a API callout to Instagram from Salesforce and then parse the returned JSON content and the mapped the values to become a record for a custom object. Basically each media post and comments becomes a record in Salesforce.

First off you can start by reading this article

According to http://www.json.org:

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. … JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others.

To begin, what I have here is an API request for comments for a particular media or picture I have in Instagram.

Read the rest of this entry »

Javascript Page Redirect on a VF Page

Stumbled upon this issue and found an easy fix.

You have a VF page that you want to redirect a user to a different website, say for OAuth2 authenticate.

window.location.href='https://api.instagram.com/oauth';

This will not work as the browser will complain about Iframe security or Security sandbox violation.

This is because VF page are iframed, to get around this simply use below to redirect, this will redirect the actual page the VF page is iframed into.

window.top.location = 'https://api.instagram.com/oauth';

Welcome 2014

Welcome 2014. 2013 went by so fast. It was so busy, fun, stressful yet productive. I want 2014 this time to be different I want to work smarter and not harder. Be effective vs being efficient, I was efficient but was not that effective meaning I was working more.

I have set some goals in the past and most of them I have accomplished. We got our new house, furnished it, started my woodworking hobby, got better in Salesforce and AWS, I got more healthy as I’m doing daily exercise with P90x and now Body Beast.

This time I would be more effective and be my “Super Self”. I’m going to reach new heights on goals I want to accomplished.

So bring it on 2014. Let’s all be rich!