Last active
August 29, 2015 13:56
-
-
Save suras/9089279 to your computer and use it in GitHub Desktop.
barter.li api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get book information | |
get '/api/v1/book_info' | |
output: goodreads object | |
get book suggestions | |
get '/api/v1/book_suggestions' | |
output: array of book names | |
get nearby locations | |
get '/api/v1/hangouts' | |
input_params: latitude, longitude, meters | |
output: forsquare object | |
{ | |
"locations": [ | |
{ | |
"address": "Gandhi Bazaar", | |
"lat": 12.950526575402915, | |
"lng": 77.56764831687944, | |
"distance": 1803, | |
"cc": "IN", | |
"country": "India", | |
"name": "Coffee Day" | |
}, | |
} | |
create user or get user details if present | |
post '/api/v1/create_user' | |
Input Params: provider(facebook ), access_token, share_token(if present) or | |
Input Params: provider(manual ), email, password, share_token(if present) | |
output: status, auth_token, location | |
{ | |
"auth_token": "-W61UNx63Q7wsLGXwKfo", | |
"status": "success", | |
"location": "" | |
} | |
get current user preferred location (requires login) | |
get /api/v1/user_preferred_location | |
output: location:{....} | |
{ | |
"location": { | |
"id": 6, | |
"latitude": "12.334", | |
"longitude": "12.445", | |
"country": "34535", | |
"city": null, | |
"state": null, | |
"address": null, | |
"name": null | |
} | |
} | |
set current user preferred location (requires login) | |
post /api/v1/user_preferred_location | |
input params: location:{city:'', country:'', latitude:'', longitude: "", state:"", name: "", address: ""} | |
output: location:{....} | |
{ | |
"location": { | |
"id": 6, | |
"latitude": "12.334", | |
"longitude": "12.445", | |
"country": "34535", | |
"city": null, | |
"state": null, | |
"address": null, | |
"name": null | |
} | |
} | |
get current user profile (requires login) | |
post '/api/v1/current_user_profile' | |
output: user{...}, preferred_location:{...}, books{[..]} | |
get others user profile | |
post '/api/v1/user_profile' | |
input params: id | |
output: user{...}, preferred_location:{...}, books{[..]} | |
create book (requires login) | |
post '/api/v1/books' | |
input params: book{title(only required):'', isbn_10:'', isbn_13:'', description:'', author:'', publication_year:'', | |
publication_month:'', image_url:'url', barter_type:'', condition:'', edition:'', value:'', location:{latitude:'', longitude:''}, tag_names:["free", "barter"] } | |
output: book{....} | |
{ | |
"status": "success", | |
"book": { | |
"id": 2, | |
"title": "rails", | |
"author": null, | |
"isbn_10": null, | |
"isbn_13": null, | |
"edition": null, | |
"print": null, | |
"publication_year": null, | |
"publication_month": null, | |
"condition": null, | |
"value": null, | |
"status": null, | |
"stage": null, | |
"description": null, | |
"visits": null, | |
"user_id": 14, | |
"prefered_place": null, | |
"prefered_time": null, | |
"created_at": "2014-03-24T12:13:13.120Z", | |
"updated_at": "2014-03-24T12:13:13.120Z", | |
"rating": null, | |
"image": { | |
"url": "/fallback/1_default.png" | |
}, | |
"publisher": null, | |
"goodreads_id": null, | |
"image_url": "/fallback/1_default.png", | |
"pages": null, | |
"language_code": null, | |
"barter_type": null, | |
"location_id": 1, | |
"location": { | |
"id": 1, | |
"country": null, | |
"state": null, | |
"city": null, | |
"address": null, | |
"postal_code": null, | |
"locality": null, | |
"name": null, | |
"latitude": "12.453454", | |
"longitude": "12.3445", | |
"created_at": "2014-03-24T12:12:12.000Z", | |
"updated_at": "2014-03-24T12:12:12.000Z" | |
}, | |
"tags": [ | |
{ | |
"id": 1, | |
"name": "free", | |
"created_at": "2014-03-24T11:38:36.000Z", | |
"updated_at": "2014-03-24T11:38:36.000Z" | |
} | |
] | |
} | |
} | |
create book (requires login) | |
put/patch '/api/v1/books' | |
input params: book{title:'', isbn_10:'', isbn_13:'', description:'', author:'', publication_year:'', | |
publication_month:'', image_url:'url', barter_type:'', condition:'', edition:'', value:''} | |
output: book{....} | |
create an issue in github | |
post /api/v1/feedback | |
input params: title, body, label(bugs or features) | |
output: status | |
add wishlist | |
post '/api/v1/wish_list' | |
input params wish_list{title:'' or author:''} | |
output: wish_list{...} | |
change ownership | |
POST 'api/v1/change_owner' | |
input params {book_id:'' or user_id:''} | |
output: status | |
get share_token | |
GET '/api/v1/share_token' | |
output: share_token | |
register or volunteer | |
post '/register' | |
input_params: email, reguster_type(send the string of register type) | |
output_paramd: status | |
search books | |
get /search | |
input_params search, longitude(optional), longitude(optional) | |
output_params: books json object array | |
{ | |
"books": [ | |
{ | |
"id": 1, | |
"title": "ddddd", | |
"author": "gghf", | |
"isbn_10": "667867867", | |
"isbn_13": "675675", | |
"edition": "5", | |
"print": 4, | |
"publication_year": 2004, | |
"publication_month": "january", | |
"condition": "", | |
"value": 11, | |
"status": true, | |
"stage": null, | |
"description": "", | |
"visits": 11, | |
"user_id": 5, | |
"prefered_place": "", | |
"prefered_time": "", | |
"created_at": "2013-12-28T13:19:13.000Z", | |
"updated_at": "2014-01-01T09:04:38.000Z", | |
"rating": null, | |
"image": { | |
"url": null | |
}, | |
"publisher": null, | |
"goodreads_id": null, | |
"image_url": null, | |
"pages": null, | |
"language_code": null, | |
"barter_type": null, | |
"location_id": 1 | |
}, | |
{ | |
"id": 2, | |
"title": "fffff", | |
"author": "", | |
"isbn_10": "", | |
"isbn_13": "", | |
"edition": null, | |
"print": null, | |
"publication_year": null, | |
"publication_month": "", | |
"condition": "", | |
"value": null, | |
"status": false, | |
"stage": null, | |
"description": "", | |
"visits": 14, | |
"user_id": 5, | |
"prefered_place": "", | |
"prefered_time": "", | |
"created_at": "2013-12-28T16:39:09.000Z", | |
"updated_at": "2013-12-30T08:48:33.000Z", | |
"rating": null, | |
"image": { | |
"url": null | |
}, | |
"publisher": null, | |
"goodreads_id": null, | |
"image_url": null, | |
"pages": null, | |
"language_code": null, | |
"barter_type": null, | |
"location_id": 1 | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment