Rest : What is Idempotent request ?

From a RESTful service standpoint, for an operation (or service call) to be idempotent, clients can make that same call repeatedly while producing the same result. In other words, making multiple identical requests has the same effect as making a single request. Note that while idempotent operations produce the same result on the server (no side effects), the response itself may not be the same (e.g. a resource’s state may change between requests).

The PUT and DELETE methods are defined to be idempotent. However, there is a caveat on DELETE. The problem with DELETE, which if successful would normally return a 200 (OK) or 204 (No Content), will often return a 404 (Not Found) on subsequent calls, unless the service is configured to “mark” resources for deletion without actually deleting them. However, when the service actually deletes the resource, the next call will not find the resource to delete it and return a 404. However, the state on the server is the same after each DELETE call, but the response is different.

GET, HEAD, OPTIONS and TRACE methods are defined as safe, meaning they are only intended for retrieving data.

API : Put Vs Patch

PUT = replace the ENTIRE RESOURCE with the new representation provided (no mention of related resources in the spec from what i can see)

PATCH = replace parts of the source resource with the values provided AND|OR other parts of the resource are updated that you havenot provided (timestamps) AND|OR updating the resource effects other resources (relationships)


PATCH was introduced for partial resource updating. Let’s take the following JSON object example for a user:

{ “first_name”: “Claude”, “last_name”: “Elements”, “email”: “”, “favorite_color”: “blue” }

If I wanted to update the favorite_color attribute via a PUT I would have to send an entire representation of the resource and just change the favorite_color. For our example object this is no big deal, but for larger more complicated objects or resources this can be tedious. With a PATCH I can merely send the following JSON:

{ “favorite_color”: “red” }


API : What is REPOSE and how it secures restful apis

Repose provides solutions to API processing tasks such as authentication, rate limiting, API validation, HTTP Request logging, and much more. It is an open-source RESTful middleware platform that is highly scalable and extensible.It takes incoming requests and adjusts them to be ready for consumption by passing requests through a series of extensible filters.



Repose enables downstream services to trust incoming requests as validated and well formed.
Here is link of Repose framework  :-

API : Swagger API documentation tool

A good interactive API documentation for your restful api is essential  for the success and adaptation of the service / product. If apis are good and documentation sucks then no one would be able to consume apis easily.

Swagger is one of the best api documentation tool. Usually apis tools are read only monotonous api documentation, however swagger is much more interactive. Its try out feature is awesome and allows the actual call to apis with payload and query parameters and responds back in the real time.

Click this link and try doing CRUD operation on user –

Swagger also has a WYSIWYG  (what you see what you get ) editor for  API documentation tool. It allows you to write and review and execute all at the same time. I loved it. So cool, simple and effective.



what is Web Mashup (web application hybrid)

A mashup, in web development, is a web page, or web application, that uses content from more than one source to create a single new service displayed in a single graphical interface. For example, a user could combine the addresses and photographs of their library branches with a Google map to create a map mashup.[1] The term implies easy, fast integration, frequently using open application programming interfaces (open API) and data sources to produce enriched results that were not necessarily the original reason for producing the raw source data.


The main characteristics of a mashup are combination, visualization, and aggregation. It is important to make existing data more useful, for personal and professional use. To be able to permanently access the data of other services, mashups are generally client applications or hosted online.

In the past years, more and more Web applications have published APIs that enable software developers to easily integrate data and functions the SOA way, instead of building them by themselves. Mashups can be considered to have an active role in the evolution of social software and Web 2.0.

The architecture of a mashup is divided into three layers:

Architecturally, there are two styles of mashups: Web-based and server-based. Whereas Web-based mashups typically use the user’s web browser to combine and reformat the data, server-based mashups analyze and reformat the data on a remote server and transmit the data to the user’s browser in its final form.[9]

Mashups appear to be a variation of a façade pattern.[10] That is: a software engineering design pattern that provides a simplified interface to a larger body of code (in this case the code to aggregate the different feeds with different APIs).

Mashups can be used with software provided as a service (SaaS).

After several years of standards development, mainstream businesses are starting to adopt service-oriented architectures (SOA) to integrate disparate data by making them available as discrete Web services. Web services provide open, standardized protocols to provide a unified means of accessing information from a diverse set of platforms (operating systems, programming languages, applications). These Web services can be reused to provide completely new services and applications within and across organizations, providing business flexibility.

API : Foursquare APIs to find places and restaurants at a point

This apis can be called with request of coordinates ie latitude and longitudes and the item you are looking, ?client_id=CLIENT_ID &client_secret=CLIENT_SECRET &v=20130815 &ll=40.7,-74 &query=pizza

This api would return all the near by please / restaurants which can be consumed and drawn on google maps for easy navigation. They have a database with 65 million points.

API Documentation link :

Before you get started, you should create an app on Foursquare. This will give you a client ID and client secret which are needed for using the API. The documentation in this guide is meant to give a high-level conceptual overview of the Foursquare platform, help you grok its different parts and capabilities, and get started using the API’s most popular features. See our detailed documentation for a more in-depth reference.

There is also an UI or App exposed by four square.



API : Google Maps Geo Location APIs

Most important thing is life is heading towards right directions. Now a days getting direction from google is super easy. Some times complex and difficult looking things are super simple and google Maps APIs are one of them. It is very easy to consume.

Google Maps Geocoding API web service link :

A Google Maps Geocoding API request must be of the following format:

where output may be either of the following values:

  • json (recommended) indicates output in JavaScript Object Notation (JSON)
  • xml indicates output as XML


Sample get request to find location information related to Pune city in India

Sample Response :

   "results" : [
         "address_components" : [
               "long_name" : "Pune",
               "short_name" : "Pune",
               "types" : [ "locality", "political" ]
               "long_name" : "Pune",
               "short_name" : "Pune",
               "types" : [ "administrative_area_level_2", "political" ]
               "long_name" : "Maharashtra",
               "short_name" : "MH",
               "types" : [ "administrative_area_level_1", "political" ]
               "long_name" : "India",
               "short_name" : "IN",
               "types" : [ "country", "political" ]
               "long_name" : "411001",
               "short_name" : "411001",
               "types" : [ "postal_code" ]


API : Profanity alert api by google –

This is a cool api to check the profane words in contents. It could be used to scan emails, documents and even public comments on your blog 🙂

A simple and sweet sample program to understand and consume it.

__author__ = 'premaseem'
import urllib

# file reader functions
def read_file():
    doc= open('/Users/asee2278/gitRepo/petProjects/python_mini_projects/Profinity_alert/document.txt')
    contents =
    print contents
    return contents

# function with google api to check profanity in contents
def check_contenct_profanity(contents):
    connection = urllib.urlopen(''+contents)
    output =
    print output
    if 'true' in output :
        print " Profanity Alert !! "
    elif 'false' in output :
        print " This document has not curse words :-)"
    else :
        print "sorry could not scan the doc "

# read the file and grab contents
contents = read_file()

# check for profanity

API : Text messages from

If you need text / sms notification or alerts to be triggered by your program when is the best option. You can consume it in any language like java, python, node etc. Simple to use and very effective.

Here is its code base in python :

Use case :

  1. Bank account it going through some suspicious activities and need text alert.
  2. Text appointment reminder to customers.
  3. Text status of services etc.

Sample code of usage.

__author__ = ‘asee2278’
import twilio

from import TwilioRestClient

# put your own credentials here
ACCOUNT_SID = “AC72b94808df4448e5923b27258493df48”

client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)

message = client.messages.create(
body=”Test message “,

print message.sid