Skip to content

yixing98/tiantian_api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

天天打车 api

乘客注册(乘客端)

参数: name
mobile
lat
lng
password(MD5)
iosDevice
androidDevice

curl -XPOST -d'passenger[name]=wanglei&passenger[mobile]=18600808686&passenger[password]=12345&passenger[iosDevice]=iosDevice&passenger[androidDevice]=androidDevice' http://127.0.0.1:3000/api/passengers/signup
{"passenger":{"androidDevice":"androidDevice","created_at":"2013-01-20T05:05:02Z","id":2,"iosDevice":"iosDevice","lat":null,"lng":null,"mobile":"18600808686","name":"wanglei","password":"12345","updated_at":"2013-01-20T05:05:02Z"}}

乘客获取验证码 (乘客端)

curl -XGET -d'mobile=186008086843' http://localhost:3000/api/passengers/get_verification_code {"code":"0"}

乘客登陆(乘客端)

curl -XPOST -d'passenger[mobile]=18600808684&passenger[password]=12345' http://127.0.0.1:3000/api/passengers/signin
{"created_at":"2013-01-11T16:29:04Z","id":1,"lat":null,"lng":null,"mobile":"18600808684","name":"wanglei","password":"12345","updated_at":"2013-01-11T16:29:04Z"}

乘客signout(乘客端)

curl -XGET -d'passenger[iosDevice]=iosDevice' http://127.0.0.1:3000/api/passengers/signout {"message":"logout success"}

司机注册(司机端)

参数:
name
mobile
lat
lng
password
car_license
car_type
car_service_number
rate
androidDevice

curl -XPOST -d'driver[name]=driver1&driver[mobile]=18600808684&driver[androidDevice]=androidDevice' http://127.0.0.1:3000/api/drivers/signup
{"androidDevice":"androidDevice","car_license":null,"car_service_number":null,"car_type":null,"created_at":"2013-01-20T05:07:02Z","id":2,"lat":null,"lng":null,"mobile":"18600808684","name":"driver1","password":null,"rate":null,"updated_at":"2013-01-20T05:07:02Z"}

司机update

参数: status

curl -XPOST -d'driver[status]=1' http://127.0.0.1:3000/api/drivers/1
{"driver":{"androidDevice":null,"car_license":"111","car_service_number":"111","car_type":"111","created_at":"2013-01-15T05:58:33Z","id":1,"lat":"39.915","lng":"116.405","mobile":"12222222","name":"siji1","online":0,"password":"1111","rate":1,"status":1,"updated_at":"2013-01-23T07:48:47Z"}}

司机登陆(司机端)

参数: mobile password

curl -XPOST -d'driver[mobile]=18600808684&driver[password]=12345' http://127.0.0.1:3000/api/drivers/signin this driver is not exist

司机signout(司机端)

参数: mobile password

curl -XGET -d'driver[iosDevice]=iosDevice' http://127.0.0.1:3000/api/drivers/signout
{"message":"logout success"}

获取我附近得司机(乘客端)

请求参数:

driver[lat] 我的精度

driver[lng] 我的维度

scope 搜索范围(默认是5 可选)

示例:

curl -XGET -d'driver[iosDevice]=1&driver[androidDevice]=1&driver[lat]=39.876757965948&driver[lng]=116.65188108138' http://127.0.0.1:3002/api/drivers
[{"car_license":"1111","car_service_number":"111","car_type":"111","created_at":"2013-01-06T14:34:14Z","distance":0.5449183482818264,"id":1,"lat":"39.875078","lng":"116.641852","mobile":"13660405121","name":"driver1","password":"123456","rate":1,"updated_at":"2013-01-10T07:49:44Z"}, {"car_license":"1111","car_service_number":"1111","car_type":"1111","created_at":"2013-01-06T14:35:12Z","distance":0.5850274591311793,"id":2,"lat":"39.874635","lng":"116.662549","mobile":"18600808684","name":"driver2","password":"1111111","rate":1,"updated_at":"2013-01-10T07:50:00Z"}]

获取我附近得乘客(司机端)

请求参数:

my_location_lat 我的精度

my_location_lng 我的维度

scope 搜索范围(默认是5 可选)

示例:

curl -XGET -d'passenger[id]=1&passenger[lat]=39.876757965948&passenger[lng]=116.65188108138' http://127.0.0.1:3002/api/passengers
[{"created_at":"2013-01-08T02:00:47Z","distance":0.0,"id":1,"lat":"39.876757965948","lng":"116.65188108138","mobile":"18600808684","name":"wanglei","password":"123456","updated_at":"2013-01-10T07:51:19Z"}]

获取我附近得司机信息

请求参数:

示例:

curl -XGET http://127.0.0.1:3000/api/drivers/1
{"car_license":null,"car_service_number":null,"car_type":null,"created_at":"2013-01-12T14:52:21Z","id":1,"lat":null,"lng":null,"mobile":"18600808684","name":"driver1","password":null,"rate":null,"updated_at":"2013-01-12T14:52:21Z"}

路线

请求参数:

示例:

curl -XGET http://127.0.0.1:3000/api/trips/1
{"trip":{"appointment":"10","created_at":"2013-01-15T05:58:47Z","end":"shuangqiao","end_lat":null,"end_lng":null,"id":1,"passenger_id":1,"start":"tongzhou","start_lat":"39.915","start_lng":"116.405","updated_at":"2013-01-15T05:58:47Z"}}

发布路线【呼叫司机(5公里范围内)】

url: /api/trips

请求参数:
trip[passenger_id]
trip[start]
trip[start_lat]
trip[start_lng]
trip[end]
trip[end_lat]

trip[end_lng]

trip[appointment]

trip[price]

示例:

curl -XPOST -d'trip[passenger_id]=1&trip[start]=tongzhou&trip[start_lat]=39.915&trip[start_lng]=116.405&trip[end]=shuangqiao&trip[appointment]=10' http://127.0.0.1:3000/api/trips
{"trip":{"appointment":"10","created_at":"2013-01-16T05:19:32Z","end":"shuangqiao","end_lat":null,"end_lng":null,"id":2,"passenger_id":1,"start":"tongzhou","start_lat":"39.915","start_lng":"116.405","updated_at":"2013-01-16T05:19:32Z"}}

我的会话(发送给我的请求)

请求参数: to_id

示例:

curl -XGET -d'to_id=1' http://127.0.0.1:3000/api/conversations
{"conversations":[{"content":"a passenger want a car","created_at":"2013-01-15T05:58:47Z","from_id":1,"id":1,"status":0,"status_desc":"new","to_id":1,"trip_id":1,"updated_at":"2013-01-15T05:58:47Z"},{"content":"a passenger want a car","created_at":"2013-01-16T05:19:32Z","from_id":1,"id":2,"status":0,"status_desc":"new","to_id":1,"trip_id":2,"updated_at":"2013-01-16T05:19:32Z"}]}

更新会话状态 (接受,拒绝)

请求参数: conversation[status] 0-new 1-accept 2-reject conversation[status_desc] 随便可以自己定义 例如 新请求 接受 拒绝

示例:

curl -XPUT -d'conversation[status]=1&conversation[status_desc]=accept' http://127.0.0.1:3000/api/conversations/1
{"conversation":{"content":"a passenger want a car","created_at":"2013-01-15T05:58:47Z","from_id":1,"id":1,"status":1,"status_desc":"accept","to_id":1,"trip_id":1,"updated_at":"2013-01-16T06:51:14Z"}}

About

tiantian dache api

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published