Friday, February 26, 2016

API Building and Testing Made Easier with Postman

Postman logo

An API (application programming interface) is a medium of interaction between applications. APIs that use HTTP or HTTPS are called Web APIs.

If you look around on the Internet, a large number of services use APIs. Anything with a social login uses an API; the mobile application of an ecommerce site uses an API; even the ads that you see on the Internet use APIs!

By creating an API for your service, you enable third-party developers to create applications based on your service. For instance, the social newspaper Frrole uses the Twitter API to generate contextual insights by analyzing a large volume of tweets.

Assuming you have assessed the pros and cons of creating an API, let’s talk briefly about the process of creating and testing APIs.

Creating APIs

Although there are many ways of creating an API, a Web API is created using the REST (Representational State Transfer) framework. The REST framework states a set of guidelines that one must follow while creating an API. With the large number of APIs being created daily, it serves as a standard for Web-based APIs.

The four most common actions performed through APIs are view, create, edit and delete objects. The REST framework maps four HTTP verbs to these actions: GET, POST, PUT and DELETE. There are many verbs that have been added to this list like PURGE and PATCH, but in this article, we’ll talk about only the four basic ones. This article on the best practices for a pragmatic RESTful API, by Vinay Sahni, founder at Enchant.com, may be useful for a first-time developer.

Nowadays, there are many frameworks that provide wrappers over the basic HTTP layers, thus making your life as a developer easier. All you need to do is invoke the required commands or functions and focus on the functionality. Popular examples include Slim and Toro, two PHP-based micro frameworks that help you create REST APIs quickly.

Testing APIs through the CLI

The prime motive of creating an API is to enable other applications (which may be yours or developed by third parties) to use the services. Therefore, at every stage of the API development process, a critical part is testing the API for functionality, exception handling and security.

Using an API involves a request to the required resource (usually a URL) using one of the verbs (or methods). You may have to add headers depending on the requirements of the API you’re using. One way to request such a resource is through the command line.

In this post, we’ll concentrate on four parts of an API call – the URL, the HTTP verb, the headers and parameters. We’ll use the cURL library to send requests to the API resources through the CLI. cURL is a command line tool that helps in transferring data with URL syntax – supporting FTP, FTPS, HTTP, HTTPS.

Let’s look at the following command:

curl -i -X POST -H "Content-Type:application/json" http://www.my-api-example.com:port/ -d '{"Name":"Something"}'

The -i command stands for include, which tells the command that headers are present in the request. The -X option is immediately followed by the HTTP verb or method. -H specifies custom headers that are added to the request. Finally, the -d option specifies custom form data to be passed along with the request.

The result of an API call is an HTTP response, usually encoded in the JSON format. The response is coupled with an HTTP response code, which gives information about the status of the request (like 200 for OK, 404 if the resource does not exist, 500 if there’s a server error and 403 if the resource is forbidden). For instance, the following response could be sent as a result of the earlier request, along with a 200 status code:

[code language="javascript"]{"message":"success","id":"4"}[/code]

Testing such responses within the command line poses a challenge too, especially if the responses have a large number of options.

A list of CLI options while testing APIs are listed in this detailed guide by Codingpedia.

Continue reading %API Building and Testing Made Easier with Postman%


by Shaumik Daityari via SitePoint

Build Cross-Platform Android and iOS UIs with Xamarin Forms

Xamarin aims to provide a solution to allow companies and developers develop natively and cross-platform. Using Xamarin, developers can target Android, iOS and Windows (Mobile) 10, using a single industry standard language, C#. Certain aspects of the code base are platform specific, for example the UI layer, forcing programmers to develop them repeatedly for each platform.

In 2014, Xamarin introduced Xamarin Forms (XF). XF introduces an abstraction layer which allows developers to declare the UI using XAML (Extensible Application Markup Language) declarations and/or code.

Xamarin vs Xamarin Forms

Using XF, programmers are now able to define and create mobile applications targeting multiple platforms with the same code and definitions. XF renders those instructions into platform-specific code and user experiences. Using this approach, applications get a native user experience, controls and patterns familiar to their users.

Example of the same UI rendered on different platforms

XAML makes the creation of the UI declarative and succinct in comparison to creating the UI by code, but it’s not required to get started. Developers with a background in XAML related technologies, such as WPF (used to develop Windows desktop applications) or Windows Phone / Windows Store applications, will feel at home, since many of the concepts are similar.

Continue reading %Build Cross-Platform Android and iOS UIs with Xamarin Forms%


by Ariel Ariel Ben Horesh via SitePoint

Sourcehunt #4 – Reflection, Authorization, Crons, and more

We skipped January’s Sourcehunt, but we’re back now, ready to boost the stardom of more projects!

Sourcehunt logo

mult1mate/cron-manager [125 ★]

mult1mate/cron-manager is a flexible tasks manager designed for MVC-type applications. It’s used instead of crontab and its purpose is to provide an easy way to manipulate repetitive tasks.

In some ways, it’s similar to Laravel’s scheduler but framework-agnostic and comes with added interactive features which you can explore in the demo.

Continue reading %Sourcehunt #4 – Reflection, Authorization, Crons, and more%


by Bruno Skvorc via SitePoint

Introducing Brillo and Weave

Though they were announced at the 2015 Google I/O conference, Brillo and Weave are two new technologies from Google that are still a bit of a mystery to the general developer community. Luckily, Google shed a bit more light on both of these technologies during the Ubiquity conference in January of 2016. In this article, I give an overview of Brillo and Weave to help you become familiar with Google's newest Internet of Things projects.

What Are Brillo and Weave?

Before we can dive into Brillo and Weave, you probably have one very important question "What exactly are Brillo and Weave?"

Brillo is a new operating system from Google that is designed to run on Internet of Things (IoT) devices and embedded systems. Brillo is based on the Android software stack, but it is important to note that Brillo is not Android. Essentially Google took the lower components of the Android operating system, as well as some parts of Chrome OS, to build a new lightweight operating system for IoT devices.

Weave is a new device-to-device communication protocol. Weave is enabled by default in the Brillo operating system and it is available as a library for other microcontrollers or platforms (Android, iOS, web). In the context of IoT devices, Weave is used for sending commands, updating devices, and performing initial setup of new devices.

Getting Started With Brillo

Although Brillo is based on the Android software stack, it is not Android. In order to keep the operating system lightweight, there are no core applications or application frameworks (like Java support). Runtime and native services that only exist on Android to support applications were also removed.

Brillo does provide a set of core services to help developers improve their devices, including built-in Weave support, metrics, crash reporting, and over-the-air updates. Brillo also includes multiple features centered around security, as this is one of the most important considerations when designing and building for the Internet of Things.

You may be wondering how you can get started using Brillo. At the moment, Brillo is buildable from the Android Open Source Project (AOSP) or you can request an invite for the currently closed beta to view documentation and download the pre-built Brillo Development Kit (BDK).

Once you have the BDK, you can start developing from a computer running Ubuntu 14.04 or higher. Since Brillo doesn't support the JVM, all development is done in the C and C++ languages.

You also need hardware that supports Brillo. The two prototyping boards that were mentioned and used at the Ubiquity conference are the Dragon Board 410 and the Intel Edison board.

Once you have an image for your device built, it can be flashed onto the hardware through fastboot and the adb tools. Specifics can be found in the official Brillo documentation, which you can find on the Brillo beta website.

Getting Started With Weave

The other addition to Google's IoT offerings is the Weave protocol. As mentioned above, while Brillo supports Weave, Weave is not exclusive to the Brillo operating system. Even though Weave is able to handle many different tasks, the common theme is that the protocol is used to communicate between devices.

Weave can be used to discover new devices and set them up on a network, associate them with a Google account for authentication, or simply send commands to control a device.

Although Weave is enabled by default in Brillo, developers will want to use it in other applications. To support this, Google has already created Weave libraries for iOS, Android, Java, and Python to allow your web or mobile apps to easily communicate between devices. You can request access to these libraries, as well as related documentation, through Google's Weave beta program.

Conclusion

With the Internet of Things still in its infancy, the Brillo operating system and Weave protocol are two welcomed tools that will make developing for the connected world faster and easier. While both are still new and in development, what is available seems promising and will only improve with time. Given the high projected growth of the IoT industry, it is a great time to start adding these two cutting edge technologies to your repertoire.


by Paul Trebilcox-Ruiz via Envato Tuts+ Code

Launch Your Project Management Career with Two Certifications

Launch your project management career with two essential certifications

The project management industry has been growing fast for the past decade, and it shows no signs of slowing down. We’ll likely see 15.7 million new project management roles created from 2010 to 2010—and one of those could be yours, with the right certifications. Pick up the Project Management Institute PMP & CAPM Training Bundle. It’s just $49—98% off for SitePoint readers.

Learn how to build a project team, estimate the time, money, and human resources required, control costs, reduce project creep, and manage risk. By the time you wrap up the two courses, you’ll be ready to ace your PMP and CAPM certification exams. Whether you’re a consultant who wants to wow new clients, a manager who’s ready for a promotion, or a total beginner looking to get your foot in the door in the industry ASAP, these courses will have something for you.

Get the Project Management Institute PMP & CAPM Training Bundle for just $49!

Continue reading %Launch Your Project Management Career with Two Certifications%


by SitePoint Offers via SitePoint

Get 2TB of Cloud Backup for Life from SkyHub for $50

Get 2TB of cloud backup for life from SkyHub for $50

Shrugging and hoping for the best doesn’t count as a secure data storage solution. SkyHub cloud storage, on the other hand…well, we think the Wall Street Journal said it best when they called SkyHub “online file storage excellence.” Get 2TB of cloud backup for life for just $49.99 at SitePoint Shop.

This SkyHub deal gets you 2TB of automatic backup for your data on up to four devices, including your Mac, PC, iPhone and Android phones, and NAS or DAS external devices. Data stays super secure while still being available to you through the SkyHub dashboard, where you can view image previews, share files, and search for easy lookup. And if you’re wondering how secure SkyHub is, Canon, Epson, Harvard Library, Caldwell Banker, and Acer are just some of the companies that trust their servers.

Get 2TB of cloud backup for life from SkyHub for $49.99 at SitePoint Shop!

Continue reading %Get 2TB of Cloud Backup for Life from SkyHub for $50%


by SitePoint Offers via SitePoint

This week's JavaScript news, issue 272

This week's JavaScript news
Read this e-mail on the Web
JavaScript Weekly
Issue 272 — February 26, 2016
Highly customizable & built by Facebook, Draft makes it easy to build rich text inputs. Uses an immutable model and abstracts cross-browser differences.
Facebook

Lets you debug client-side JavaScript code running inside Google Chrome directly from Visual Studio Code.
Microsoft

It only took place earlier this week but videos from React.js Conf are already out. Perhaps start with Nick Schrock’s keynote.
YouTube

Learn to build your own JavaScript chat app with real-time messages and more in no time. Join this developer training webinar now. (Limited seating. Seats fill fast.)
PubNub   Sponsored
PubNub

One of the key roles of frameworks like Angular and React is to externally represent internal changes in state and data. This is an in-depth look at how Angular 2 deals with this task.
Pascal Precht

If you can be in SF March 9-10, come enjoy Fluent's hallway track, meetups (including one run by the Angular core team), Ignite, and more, for free (pick the ‘Exhibit Hall Plus pass’ and use code EH16SP). I’ll be there - come say hi.
O'Reilly Media

Ember gets a new LTS release channel - 2.4 will be the first version.
Matthew Beale

The current version of React is 0.14.7, but the next will be 15.0.0 to reflect React’s stability and to make the ‘15’ the major version component.
Sebastian Markbåge

The key takeaway is to “layer tools and functionality as you get more comfortable” but don’t jump in at the deep end.
Jack Franklin

Automatically creates API documentation for every tag and selected branches in your repo, supporting JSDoc comments and Markdown articles.
Doclets

Jobs

  • Full Stack Developer in NYC (RoR + AngularJS)Want to work with small team tackling a big industry? We’re a group of 20 dedicated designers, engineers and PMs trying to change the way a $12 trillion business operates. If you're interested let's talk. Hightower
  • Pluralsight Author - JavaScript Instructor (Freelance, Part-time)We seek skilled instructors to share their JavaScript expertise with learners worldwide. Authors work from home on their own schedule, are recognized experts, and earn completion payments and royalties. If you have a flair for helping others learn, please apply. Pluralsight
  • Stop Applying to Jobs - Let Companies Apply to YouOn Hired, sign up in 10 minutes and get offers from top companies like Facebook, Uber, & Stripe. Engineers get an average of 5 offers on the platform in 1 week. Try it today. Hired.com

In brief

Curated by Peter Cooper and published by Cooper Press.

Stop getting JavaScript Weekly : Change email address : Read this issue on the Web

© Cooper Press Ltd. Office 30, Lincoln Way, Louth, LN11 0LS, UK


by via JavaScript Weekly