Weekly Top 8 Tech Stories – 10th October

This weeks top tech stories for the week of the 10th Oct. Amazon, SalesForce, Netflix, Twitter, Samsung, AOL

Another week in the world of tech and here are the stories that caught my attention on this week starting 10th October 2016.

  1. Samsung pull the plug on its flagship Note 7
    chrome_2016-10-08_07-28-02After all of its woes, and for the first time a manufacturer has done such a step, Samsung have finally stopped making and shipping the Note 7.  Too many flames in that smoke.  This whole incident will cost the company $5B in real money and likely a more in customer goodwill and brand damage.   It is a complete nightmare.

    After recalls and units still bursting into flames, the Department of Transport officially ban people from flying with the phone, there is no recovery from this, so Samsung are looking to S8 due out in the 1st quarter of 2017.   You can be rest assured the likes of Apple, Google, HTC and LG are looking into the quality of their supply chain.

  2. Twitter is the house on the block no one wants to buy
    chrome_2016-10-16_10-37-48The last few weeks had a lot of buzz around the potential buy-out of Twitter by the likes of SalesForce, Google or even Disney.  However, all parties have had a deep look at the in’s and out’s and opted to walk away, citing they aren’t the right fit.

    This is seriously bad news for Twitter, because if those big players are out of the picture, who else is left that thinks they can monetize this medium that fits between the cracks of social media.  Stock price depressed upon this news.

  3. Yahoo fighting for survival on a number of fronts
    chrome_2016-10-08_07-32-32Yahoo is trying to close the sale to Verizon, however Verizon are now looking to walk away from the deal due to the huge data security breach of its user base. If that isn’t enough, those people still using @yahoo.com email accounts, discovered this week that Yahoo pulled the feature to auto-forward emails.   This effectively is locking people into Yahoo and not making it easy for them to migrate off.  As you can appreciate this is infuriating its user base.  Yahoo put it back in again at the end of the week, but its excuse was awfully flimsy to why it pulled the feature in the first place.

    Marissa Mayer looks to be blundering here at the very time Yahoo needs a strong and determined CEO.   She can still save this so the next couple of weeks is going to be crucial.

  4. Germany votes to ride the combustion engine by 2030
    chrome_2016-10-16_10-51-37The home of the automobile (BMW, Mercedes, Audi, Porsche) have voted to stop manufacturing and selling traditional gas powered engines by 2030.  A bold step but their hopes is to speed up the innovation around alternative fuels.  Tesla has already set the bar very high as to what electric cars can do, and Mercedes has declared they will over take Tesla’s innovation in 10 years time.

    The reality here is that they looking to have zero-emission engines.  Be interesting to see if other countries will follow suit here, but one upside is that we are going into a phase of extremely clean air in our cities.

  5. Amazon calls bullshit on Oracle’s cloud claims
    chrome_2016-09-24_05-16-50Oracle has never been shy about its boasts on its own technology.  Do you remember the whole ‘Unbreakable Linux’ claim 15 years ago, until it was proven it was indeed breakable?   Well Larry Ellison is at it again, claiming that Amazon is 20 years behind Oracle’s cloud and up to 24 times slower.   Oh dear.

    Well Amazon, who usually do not dignify such claims by getting involved, fired back at Larry.   Oracle is desperately trying to be relevant in the cloud space and the reality is that they are the ones that are years too late with too little services too late.  Gartner noted that Amazon is 10x bigger than its next 14 competitors combined.  There is a reason for this – it works and works very well.

  6. Morgan Stanley updates its yearly 30 top stocks to look for
    Morgan Stanley released the top stocks that they believe will do best when should the economy slow down a little.  We have Amazon, Google, Netflix, Facebook in there from the world of big tech.
  7. Netflix will offer offline viewing by year end
    chrome_2016-10-16_11-16-04Speaking of Netflix, it looks like that they can’t dodge the disconnected offline world we live in and are going to finally allow its content to be downloaded to be viewed later.  Applaud Netflix for listening to its paying customers.

    This could actually lessen the bandwidth load as people can download quicker in short bursts and then enjoy the content at their leisure in the air for the example.

  8. The history of the AOL CD
    This week, we seen the head of sales leave AOL, reminding us all that AOL still exists (part of Verizon if you recall).  You have to wonder just how hard a job that is, when you have a brand that people associate most with is dial-up internet access and their infamous CD ROM.

    Mental Floss published a fascinating look back at the history of the CD ROM this week.

 

and finally, this week’s audible distraction was provided by Nate Ruess and his, Grand Romantic album released last summer.

 

Working with the SalesForce REST API

Quick overview and guide to working with the SalesForce REST API.

Historically anytime I have ever had to interface with SalesForce, I have utilized their SOAP API.   SOAP is a horrible nasty piece of technology that puts way more overhead on communications than is really required.   Handling SOAP within Java is an even more pain in the ass as you wrestle with WSDL’s to create/compile your local representations of objects.  Fortunately there is now a much easier way and for my latest project I got an excuse to take it for a proper spin.

chrome_2016-10-08_08-03-07SalesForce offers an alternative to its SOAP API and that is the lightweight REST API, with JSON packets flying back and forth chewing up the minimal of bandwidth.   I can attest that it is an absolute joy to use.

For anyone that is aspiring to cast aside the chains of SOAP (which I will call the old days) and move to a lighter world I offer the following to help you along the way.  All the source code is available on my Github page.  I have written a small Java wrapper class that makes interacting with the REST API extremely easy, including re authenticating the token if a call fails.

1. Configure SalesForce

In the old days you accessed the SOAP API with a username and password.  In the REST world the initial authentication is a little more complicated.  SalesForce uses OAUTH2.0 to secure incoming requests.  Fortunately they use a number different mechanisms within OAUTH2.0 but I am going to focus on the Username-Password method – which basically involves making a call to a given endpoint and retrieving a token to which all subsequent requests will be validated against.

chrome_2016-10-08_11-06-34However, before you do that, you must first register your application with your SalesForce instance.  When you make your API calls it is this app that the calls will belong to and you can set the various security rights etc at an app level.

Login to your SalesForce account and then navigate to the ‘Setup’ area and look for the ‘Build’ area, and select the ‘Apps’ from the Create menu.

Within the ‘Connected Apps’ panel, click the [New] button and you will be presented with the following form to fill out.  It looks a little frightening at first blush but there isn’t a huge amount of data required here.

chrome_2016-10-08_11-15-22.png

Give your application a name, something you will know, and a Contact Email address.  Now since we are using the Username-Password method, we don’t have a lot of fields to fill out there.  You do want to click the ‘Enable OAuth Settings’ checkbox, and in the ‘Callback URL’ simply add https://login.salesforce.com.   Next you will choose the security roles to which your app will belong to.   This can change at a later date, but select ‘Full access’ to begin with, which gives your app the same level of access your traditional SOAP API had.

Then save out the form and you are nearly done.  There is a couple of pieces of information you need to grab.   Once saved, it will be displayed in your list of connected apps, click the [Manage] button.

For retrieving the API session token, you need additional information, which is the ‘Consumer Key‘ and the ‘Consumer Secret‘.  Take a note of these two values as you will need them later.

2. Retrieving your session token

To retrieve your session token you need to make an HTTP POST to the https://login.salesforce.com/services/oauth2/token endpoint.  Good news, this is the only time you will hard code a URL to SalesForce – from here on in, all the URL’s that required will be told to you over the wire.  You need 5 pieces of information:

  1. grant_type
    password
  2. username
    <one of your salesforce users>
  3. password
    <their password><their access token>
  4. client_id
    <the consumer key from the connected app>
  5. client_secret
    <the consumer secret from the connected app>

Assuming you have setup everything correctly then you should get the following JSON block back.  If you are not successful then SalesForce is very good with its error and status responses so you should be able to quickly resolve any issue.

notepad_2016-10-08_11-29-25

This block has everything you need in it to interact with their API endpoints.   The session will time out (response code 401) so you just have to call this login process again to retrieve a new token.

An important piece here is the host name for your company described in the ‘instance_url‘ key.  This will be the root URL of all your REST calls.

You can see the Java code, doSessionExecution(), for this here at my Github repository.

3. Authenticating requests

Once you have your token you need to add in the ‘Authorization’ header to all HTTP calls with the token_type and the access_token.  Using the session block retrieved in the previous section we would create our authorization as follows:

notepad++_2016-10-08_11-36-25.png

In my Java code, getAuthorization(),  I simply pull out the two keys from my HashMap and concatenate them together.

We are nearly ready to start making calls to the API.  However, there is one small step that will make life a lot easier – a quick introspection of your company’s objects to determine all their endpoints.

4. Introspecting your objects

SalesForce will return a list of all your objects and their corresponding high-level properties including the REST URL’s to which you can perform operations with.  This callback does not include all the field properties for the object, there is another call for that, SObject Describe.

A JSON packet is returned with all your objects listed.   Here is a snippet from that return block highlighting the standard ‘Account‘ object.  Notice the ‘urls‘ inner object detailing all the endpoints we will use for interacting with our object.

notepad++_2016-10-08_11-46-23.png

In my Java code, doDescribeObjects(), I pull these objects out from their original JSON array and put them in a HashMap keyed on the object name for faster retrieval at a later date.

Now we have everything we need to interact with the API minimizing the amount of hard coded URL’s we have in our application to a single one; the initial login one.

5. Retrieving an object

Retrieving the value of an object, we just need its 15 character Id (yes only the short version of the Id, not the previous quirk of the 18 character Id) and the endpoint for that given object.  We perform an HTTP GET on that URL appending the Id.  So the raw HTTP header call to https://na30.salesforce.com would be:

notepad_2016-10-08_11-56-30

This returns back a JSON object representing the current value of that SalesForce object.   If you look at my Java code, get( String object, String id ), you can see where I create the URL from the instance_url from our original login request, and then using the URI from the describe objects call earlier.

6. Updating, Creating and Deleting objects

To update, create or delete an object you can use the same URL you created in section 5 but change the HTTP method type.

  1. PATCH
    For updating an existing object
  2. POST
    For creating a brand new object
  3. DELETE
    For deleting a previous object

A small tip, if your underlying HTTP library does not offer convenient access to a given HTTP method you can use the POST method and add the query parameter ‘?_HttpMethod=PATCH‘ to the end of it.   Nice touch SalesForce!

7. Misc. endpoints

There are many different endpoints you can choose to interact with, that will span across multiple objects.  For example you have query objects, get the last updated objects, the latest objects deleted.   The API is extremely well covered and more importantly documented very extensively.

Each API call needs to be authorized, which you do the exact same thing as detailed here.  All you need to know now, is which API endpoint to call and how to interact with the data returned.

8. API Limits

SalesForce limits its use of the API (which interestingly enough you can determine what your limits are through an API call – assuming you have credit left!).   You can read about the limits here, but the key to remember is to not hit the API too quickly in quick succession.  That will result in you getting denied for a little while.

However, there is an easy way to determine how much you are currently using within your allocated daily limit.  Each API request, returns the Sforce-Limit-Info header that details just how much you have chewed up thus far as an organization.

 

I hope this has helped you with the SalesForce REST API, especially if you are coming from the SOAP world.

SalesForce has its place in the corporate landscape and given its size and reach, the company isn’t going away anytime soon.  Working and integrating SalesForce into your applications is significantly easier than it was in the SOAP days with their REST API.

Weekly Top 8 Tech Stories – 3rd October

The top stories from the week of the 3rd Oct; Samsung, Amazon, SalesForce, VMware, Yahoo, security and candles!

Here are the stories that caught my attention in the week starting 3rd October 2016.

  1. Samsung’s Note 7 replacement catches fire; plane is evacuated
    chrome_2016-10-08_07-28-02Samsung’s woes just got worse when its flagship Galaxy Note 7 burst into flames, when it was already turned off, onboard a Southwest flight.  The irony here was that this was a replacement phone from the first batch of faulty phones.  Network carriers are now offering free replacements to other handsets.

    Such a shame to see this, as I love my Note 5 and I was looking for to upgrading to the Note 7.  My reason is because the phone is waterproof – though I will need it to be flame proof too!

  2. Yahoo caught spying on its users emails for the NSA
    chrome_2016-10-08_07-32-32This is the first major email provider that has been caught with its fingers in their user’s inbox.   They not only gave data to the NSA, but actually helped the NSA do their job by building filtering software to track for certain keywords. This is not good for Yahoo as they try to close the deal with Verizon, who are seeking a $1B discount off the sale price because of the stolen 500M users details.

    Email is still our primary link to our digital world – we have to trust our email providers safeguard our precious data.  This is 2 major strikes against one of the oldest domains.

  3. Saving babies lives thanks to IoT
    chrome_2016-10-08_07-54-21Internet of Things is creating buzz all over the industry at the moment as we look to track everything, and one company, Owlet Baby Care has taken it to your baby.   They have developed a sock ($250) that monitors the wee ones heart rate and oxygen levels alerting the parents when things significantly change.

    This gives me such joy to see technology coming together so beautifully to save lives in a space where there is much research being done on infant premature death.

  4. Save yourself – how to avoid being scammed online
    chrome_2016-10-08_07-56-35The vast majority of security hacks are down to the infallibility of the human – we’re so easily seduced and tricked into doing things we really shouldn’t.  A very handy info-graphic was released this week to show all the ways scammers try to seduce you and the very simply steps you can do to present.

    Covers all forms of online scams in a very easy digestible format.  Do yourself a favor and take a look, and then either feel educated, or smug you already knew it all.

  5. SalesForce announces an improved IoT offering
    chrome_2016-10-08_08-03-07The big cloud providers are desperate for your IoT data – Amazon, Google, Microsoft and SalesForce have extremely rich offerings to make it real easy to pump your device data to their cloud.   This week was DreamForce in San Francisco, the annual SalesForce love fest, where they announced a number of updates to their Thunder IoT cloud.  The main one is marrying up the device data with core data stored in SalesForce.

    This is a huge step considering how many companies run exclusively inside of SalesForce.  Though price is their achilles heel – running inside SalesForce is not a cheap experience when compared to Amazon.

  6. Dongle technology finally comes to ordinary credit cards
    chrome_2016-10-08_08-17-06.pngI am sure you have seen the security dongles that many banks issue for online access to your account.  They are small devices that continually generate numbers that you read off and type in to gain access.   This technology has now come to credit cards, with France trialing the card that updates the 3 digit number on the back every hour.

    While this will complicate our lives a little more, not being able to save the card online for fast purchasers as we will be forced to look at the card and type in the ever-changing 3 digits, it is a small price to pay to be immune from hacks and data dumps.

  7. VMware throws in the towel; joins Amazon’s cloud
    chrome_2016-09-24_05-16-50VMware, recently part of Dell, was the early pioneer of virtualization technology that allowed the cloud world to even exist.  Like the Yahoo’s of its era, VMware has struggled to compete with the mammoth Amazon offering and this week, we learned that they have finally decided to stop fighting it and now offer their software to run within the Amazon cloud.

    This is a huge admission that their own cloud offering is failing to take off and instead of losing out on the customer relationship altogether they have wisely decided to give their clients what they want.

  8. Keep that new Apple Mac feeling going longer with the Mac candle
    chrome_2016-10-08_08-24-52Nothing better than that new smell that comes with a car or even a house, but what about the smell from a newly booted Apple Mac?   Well for those diehard Apple fanboys they can keep that smell going longer, thanks to a new candle that burns the scent of a new Mac.

    Naturally, special order at the moment, until such times that Yankee Candle decides they need a whole range of ‘new unboxing scents’.

 

and finally, this week’s soundtrack was Passenger’s new album.