Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Mobile API Design Overview

islands edited this page Jun 5, 2011 · 9 revisions

API Overview

Our api is a json envelope

Response Structure

{"status":$status, "data":$data}

Where $status is "success" or "fail" and $data is either: In case of "success": data package (object, described below), In case of "fail": failure message (string, describing error message).

API Functions

/api/trucks

  • Input: none

  • Output: Returns json list of all food trucks

  • Example:

{
    "data": [
        {
            "id": "2", 
            "info": "test", 
            "lat": "21.2927", 
            "lng": "-157.793", 
            "name": "Jason Axelson"
        }, 
        {
            "id": "1", 
            "info": "test", 
            "lat": "21.292", 
            "lng": "-157.85", 
            "name": "austenito"
        }
    ], 
    "status": "success"
}

/api/truck/id/[id]

  • Use: Get details about a truck by id, including their current location.
  • Input: none (besides the id in the url)
  • Output: json information about a single food truck

/api/raiseException

  • Use: to test client side error handling
  • Input: none
  • Output: Returns failed command ('status':'fail')

Details

Truck info

  • id: a unique id for the truck, this the Primary Key in the trucks table.
  • lat: Latitude of the most recent tweet that has a non-null value
  • long: Longitude of the most recent tweet that has a non-null-value
  • name: full name of food truck (currently shows twitter account name, TO BE REVISED)
  • logo: food truck logo (get from Poni? NOT YET IMPLEMENTED)
  • info: twitter account info (NOT YET IMPLEMENTED, just shows 'test' for now)

Assumptions

  • We do not store or return trucks previous locations.
  • Currently don't support anything about menus or specials.