GithubHelp home page GithubHelp logo

location_api's Introduction

Install Steps:

In Root of project directory:

  1. Git Pull
  2. Composer Install
  3. Bower Install

Now Set up Database in app->config-> database.php w/ your local database info

Migration/Seeding: Migration & seeds should be ready to go, just run:

php artisan migrate php artisan db:seed

If Migration throws an error run this command php artisan migrate:make create_users --create --table=user php artisan migrate:make create_locations --create --table=location

Then replace those newly created files in app->database->migrations w/ the ones provided. Then rerun migration/seeding commands

APPS: LARAVEL APP = app folder ANGULARJS APP = public folder

AUTH: use the following authentication information username: firstuser password: first_password

API DOCUMENTATION All APIS expect & return JSON

DATA FIELDS. Can UPDATE or CREATE any of these fields data: { country_name, state_name, city_name, street_name, street_number, room_number }

RETURN FORMAT data { locations : "", location : "", ancestors : "", ancestor : "", }

IF ERROR OCCURS or on DELETE: data { error : true if error occurred message : error_message (or success msg for DELETE) }

*METHODS

API ROOT /api/v1/location

GET ALL url : /api/v1/location method: GET

	--doesnt expect data

	RETURNS data.locations

GET ONE (SHOW) url : /api/v1/location/{location_id} method: GET

	--doesnt expect data

	RETURNS data.location

GET ALL ANCESTORS url : /api/v1/location/{location_id} method: GET params: 1: "ancestor" = "all"

	--doesnt expect data

	RETURNS data.ancestors & data.location

GET COMMON ANCESTOR url : /api/v1/location/{location_id} method: GET params: 1: "ancestor" = "all" 2: "id" = location2_id

		param.2 = the 2nd location to find the common ancestor for
		--doesnt expect data

	RETURNS data.ancestor & data.location

CREATE url : /api/v1/location method: POST data : data

	RETURNS data.locatioin

UPDATE url : /api/v1/location/{location_id} method: PUT, data : data

	RETURNS data.location

DELETE url : /api/v1/locations/{location_id}, method : DELETE

		returns error data object 

TESTING Already pretty late on the project (FRIDAY) and havn't had a chance to do unit testing. Planning on turning in like this and do testing over weekend if needed

TESTING W/ CURL EXAMPLE:
CREATE
	curl -i --user firstuser:first_password -d 'state_name=1' -d 'city_name=San Francisco'  -d 'country_name=1' -d 'street_ name=Hello World Lane' localhost:8888/challenge_api/public/index.php/api/v1/location

READ
	curl -i --user firstuser:first_password localhost:8888/challenge_api/public/index.php/api/v1/location/{{loc_id}}

DELETE
	curl -i -X DELETE --user firstuser:first_password localhost:8888/challenge_api/public/index.php/api/v1/location/39

location_api's People

Watchers

James Cloos avatar Justin Kazemi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.