Web API – Design and best pratice – Client-Side vs Server-Side



Web API – Design and best pratice – Client-Side vs Server-Side

0 0


web-api-design-bestpratice

This is a short presentation of Web API Design best practice

On Github ferbass / web-api-design-bestpratice

Web API

Design and best pratice

Created by Fernando Bass / @fer_bass

Introduction

TODO - short and simple description :P

Client-Side vs Server-Side

We have two ways when we talk about API, theses ways are called Client-Side and Server-Side

Client-Side

Client side API is basically a JavaScript binding to functionality within a web browser

Eg. Google Maps API

Goole Maps API, provide a JavaScript binding to using maps on your web site
<script src="http://maps.googleapis.com/maps/api/js?client=YOUR_CLIENT_ID&sensor=true_or_false&v=3.12"></script>

Server-Side

A server-side web API is a programmatic interface to a defined request-response message system, typically expressed in:

  • JSON
  • XML

When we talk about server side api or web services, we have two types most used

  • SOAP
  • REST

REST

Talks about REST, you can do it :D

Assuming REST a pattern for this presentation

lets stop the bullshitting and start to talk about API Design

  • nouns and verbs
  • associations
  • errors
  • versioning
  • pagination
  • formats
  • subdomain

Nouns and Verbs

Keep your base URL simple and intuitive

DON'T USE VERBS IN YOUR BASE URL

Associations

Errors

Versioning

Pagination

Formats

Subdomain