Fixed urlshortener example.

In the new version we should specify the resource object containing the long url.
Removed the variable that was not defined.

Use `const` keyword for creating constants. Pass `SEARCH` variable value instead of `query` (that was not defined).
Check if there are items in response to avoid unexpected errors (e.g. `cannot read length of undefined`)
Merge pull request #265 from IonicaBizau/example-fix

Fixed two examples