Fast Secure Usable APIs:

BUILD APIs that people use WITH NODE.JS AND HACKS THAT WIN WITH OPEN DATA

#nodejs #api #opendata #hackthenorth

codx.ca/hackthenorth

ahmadnassri.com

Hello!

Ahmad Nassri

GET /who HTTP/1.1
Host: www.ahmadnassri.com
Accept: application/json

HTTP/1.1 200 OK
Date: Sat, 17 Sep 2016 12:00:00 GMT
Content-Type: application/json

{
  "name": "Ahmad Nassri",
  "website": "http://www.ahmadnassri.com/",
  "twitter": "@AhmadNassri",
  "email": "ahmad@ahmadnassri.com",
  "bio": "Technologist, Entrepreneur, Dog Lover"
}

Joseph Bou Younes

GET /who HTTP/1.1
Host: joseph.by
Accept: application/json

HTTP/1.1 200 OK
Date: Sat, 17 Sep 2016 12:00:00 GMT
Content-Type: application/json

{
  "name": "Joseph Bou-Younes",
  "website": "http://joseph.by/",
  "twitter": "@josephby",
  "email": "joseph.bouyounes@codx.ca",
  "bio": "Business, Tech, Data, Diapers"
}

What EXACTLY is an "API" ?

In Egyptian mythology, Apis, is a bull-deity that was worshipped in the Memphis region. Apis served as an intermediary between humans and an all-powerful god.

Egyptology?!

an application programming interface (API) is a set of routines, protocols, and tools for building software applications.

Computer Programming

Web Services

A Web service is a method of communication between two electronic devices over a network. It is a software function provided at a network address over the web with the service always on.

RESTful Web APIs

REST (REpresentational State Transfer) is a simple stateless architecture style that generally runs over HTTP.

Best Practices

BE FRIENDLY TO THE DEVELOPER AND BE EXPLORABLE VIA A BROWSER ADDRESS BAR

KEEP IT SIMPLE, INTUITIVE AND CONSISTENT TO MAKE ADOPTION EASY & PLEASANT

PROVIDE ENOUGH FLEXIBILITY TO POWER The MAJORITY OF Use cases

Use web standards where they make sense

Standards

Hypermedia Hype

Collection+JSON

Hypertext Application Language (HAL)

ATOM

GET /player/1234567890 HTTP/1.1

{
    "@context": {
        "@vocab": "https://schema.org/",
        "image": { "@type": "@id" },
        "friends": { "@type": "@id" }
    },
    "@id": "https://api.example.com/player/1234567890",
    "playerId": "1234567890",
    "name": "Kevin Sookocheff",
    "alternateName": "soofaloofa",
    "image": "https://api.example.com/player/1234567890/avatar.png",
    "friends": "https://api.example.com/player/1234567890/friends"
}

JSON-LD

Authentication

RFC 2617

# URL Versioning:

GET /api/v2/foo HTTP/1.1

# Custom Header:

GET /api/foo
X-VERSION: 2

# Content Type

GET: /api/foo
Accept: application/vnd.github.v3.raw+json

Versioning

Nodejs

starter kit

Your API is a product!

flexible
intuitive consistent
pleasant
explorable
standards

#OPENDATA

Open Data?

"Open [data] means anyone can freely access, use, modify, and share the data for any purpose (subject, at most, to requirements that preserve provenance and openness)." - the Open Definition project

 

It's the fastest and easiest way to bring the outside world into your hack.

codx.ca/hackthenorth

What can you get?

Useful Examples!

  • Building Permits
  • Car Travel Speed
  • Corporate Registration Information
    (Company Names, Addresses & Director Names)
  • Parking Tickets
  • Weather Forecasts

codx.ca/hackthenorth

What can you get?

Level of Gov't Responsibilities Example Data
Federal Agriculture, Financial Services, Economic Data, Natural Resources, CRA, Census, Weather
Agriculture, Financial Services, Economic Data, Natural Resources, CRA, Census, Weather
Criminal Code
Weather
GIS and Imagery
Economic Data
Tax Code
Provincial Courts, Education, Environment, Energy, Health Care
K-12 Curriculum
Court Rulings
Municipal Water, Traffic, Parking, Property Tax Property Tax
Traffic Flows

codx.ca/hackthenorth

What can you get?

WARNING:

 

Data is often old, out of date, or inconsistent.

LOOK FIRST

codx.ca/hackthenorth

FINDING OPEN DATA

codx.ca/hackthenorth

FINDING OPEN DATA

2. Google

codx.ca/hackthenorth

FINDING OPEN DATA

3. Portals

codx.ca/hackthenorth

FINDING OPEN DATA

4. Check Usability

Text

Text

Text

NO!

codx.ca/hackthenorth

FINDING OPEN DATA

5. Download!

codx.ca/hackthenorth

Thank you

Twitter
@AhmadNassri

Slack
@AhmadNassri

Website / Blog
AhmadNassri.com

Twitter
@josephby

Slack
@josephby

RFTM
codx.ca/hackthenorth

How to build a successful API

By Ahmad Nassri

How to build a successful API

To be a successful platform you don’t just need an API – you need an API that’s fast, usable, and easy to consume by humans and machines.

  • 1,056