Skip to content

Instantly share code, notes, and snippets.

@suras
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suras/95e1a4c618d318efe228 to your computer and use it in GitHub Desktop.
Save suras/95e1a4c618d318efe228 to your computer and use it in GitHub Desktop.
lovocal api
create user
POST api/v1/users
input params:
user{
mobile_number*:
}
output:
{
"id": "53c7a4bf73757212770f0000",
"mobile_number": "98676778485345",
"first_name": "",
"last_name": ,
"image_url": "http://localhost:3000//fallback/v1_default.png",
"description": null
share_token: "6576hjjhjh"
}
---------------------------------------------------------------------------------
http authenticaion
Authorization Token token="Yayzny5NFzQr-N-oYBES", phone_id="12345678"
------------------------------------------------------------------------------------------
update user
PATCH api/v1/users/:id
input params:
user{
mobile_number*:
first_name*:
last_name:
email:
description:
image:
}
output:
{
"id": "53c7a4bf73757212770f0000",
"mobile_number": "98676778485345",
"first_name": "raj",
"last_name": null,
"email": "",
"image_url": "http://localhost:3000//fallback/v1_default.png",
"description": null
"share_token": ""
}
----------------------------------------------------------------------
GET user profile
get /api/v1/users/53c79e5273757212770c0000
output:
{
"id": "53c79e5273757212770c0000",
"mobile_number": "966778485345",
"first_name": "raj",
"last_name": null,
"image_url": "http://localhost:3000//fallback/v1_default.png",
}
--------------------------------------------------------------------
get current user profile(http authorization needed)
GET /api/v1/current_user_profile
{
"id": "53c7a4bf73757212770f0000",
"mobile_number": "98676778485345",
"first_name": "bala",
"last_name": null,
"email": "",
"image_url": "http://localhost:3000//fallback/v1_default.png",,
"description": null
}
delete user
delete /api/v1/users/53c79e5273757212770c0000
output:
{
}
----------------------------------------------------------------------------
sms verification
POST /api/v1/verify_sms_key
input params:
user {
mobile_number:
sms_serial_key:
phone_id:
}
output
{
"user": {
"id": "53c7a4bf73757212770f0000",
"mobile_number": "98676778485345",
"first_name": "bala",
"last_name": null,
"auth_token": "chsd41WqtrpN4rgx3Pxu",
"email": "",
"image_url": "http://localhost:3000//fallback/v1_default.png",
"description": null
}
}
-----------------------------------------------------------------------
create category:
POST "/listing_categories"
input params:
listing_category: {
name: "cat"
image: ""
}
output
{
"listing_category": {
"id": "53c8f7777375721430060000",
"name": "bikes1245"
"image_url": "http://localhost:3000//fallback/v1_default.png",
}
}
----------------------------------------------------------------------
list parent or top level categories
GET /api/v1/listing_categories
output params:
{
"listing_categories": [
{
"id": "53c8e5d273757220b6000000",
"name": "par",
"image_url": "http://localhost:3000//fallback/v1_default.png"
},
{
"id": "53c8e86d7375721430010000",
"name": "bikes",
"image_url": "http://localhost:3000//fallback/v1_default.png"
},
{
"id": "53c8e8b57375721430020000",
"name": "bikes123",
"image_url": "http://localhost:3000//fallback/v1_default.png"
},
]
}
--------------------------------------------
update Category
PATCH/PUT "/listing_categories/:id"
input params:
listing_category: {
name: "cat"
"image_url": "http://localhost:3000//fallback/v1_default.png",
}
output
{
"listing_category": {
"id": "53c8f7777375721430060000",
"name": "cat"
}
}
-------------------------------------------------------------------------------
create sub category
POST api/v1/listing_categories/53c8e8c17375721430030000/children
input params:
listing_category: {
"id": "53c8e9ba7375721430040000",
name: child3,
"image_url": "http://localhost:3000//fallback/v1_default.png",
}
----------------------------------------------------------------------------------------
list subcategories of a category
GET api/v1/listing_categories/53c8e8c17375721430030000/children
output params:
{
"listing_category": [
{
"id": "53c8e9ba7375721430040000",
"name": "child"
"image_url": "http://localhost:3000//fallback/v1_default.png",
},
{
"id": "53c8eb597375721430050000",
"name": "child2"
"image_url": "http://localhost:3000//fallback/v1_default.png",
}
]
}
-----------------------------------------------------------------------------
delete a category
DELETE api/v1/listing_category_children/53c8e8c17375721430030000
output:
{
}
-------------------------------------------------------------------------------
create service
POST "/api/v1/services"
inputparams:
"service": {
"business_name"*: "test",
"mobile_number"*: "12345678909",
"city"*: ""
country*:""
"address"*:""
"latitude"*: "12.345",
"longitude"*: "23.456",
"listing_cat_ids": ["42424jn44435nkjn345", "kjn43n43nk34nkj3n45n34"]
"service_images_attributes"=>[{"image"=>IMAGEFILE}]
}
output params:
{
"service": {
"id": "53c971457375724b780b0000",
"business_name": "test",
"mobile_number": "12345678909",
"listing_categories": [
"par"
],
"latitude": "12.345",
"longitude": "23.456",
"country": "india",
"city": "chennai",
"state": null,
"zip_code": null,
"description": "test desc",
"customer_care_number": null,
"landline_number": null,
"address": "454546456",
"website": null,
"rating": 0
"twitter_link": null,
"facebook_link": null,
"linkedin_link": null,
"service_images": [
{
"id": "53c971457375724b780c0000",
"image": "www",
"is_main": false
}
],
"service_timing": null
}
}
-------------------
create service timing
POST /api/v1/services/:service_id/service_timings
input_params:
service_timing:{
timings: {"mon": ["99:30pm", "400:30am"], "tue": ["5:30pm", "6:40pm"]}
holidays: ["2001-1-12", 2001-2-1]
}
output_params:
{
"service_timing": {
"id": "53c9704e7375724b78090000",
"timings": {
"mon": [
"99:30pm",
"400:30am"
],
"tue": [
"5:30pm",
"6:40pm"
]
},
"holidays": [
"20-11-2003",
"4-11-2003"
]
}
}
----------------------------------------------------------
create service images
post localhost:3000/api/v1/services/53ca1de17375720d02040000/service_images
inputparams:
serivice_image:{
image: []
}
output params:
{
"services": [
{
"id": "53ca1de17375720d02050000",
"image": "www",
"is_main": false
},
{
"id": "53ca1df67375720d02060000",
"image": "123",
"is_main": false
},
{
"id": "53ca1f307375720d02070000",
"image": "123",
"is_main": false
}
]
}
--------------------------------
destroy service images
delete /api/v1/services/53ca1de17375720d02040000/service_images
inputparams:
service_image{
ids: ["".""]
}
outputparams
{}
----------------------------
serach by service name
GET /api/v1/search
input params:
search:
{
latitude:
longitude:
service_name:
distance:
page:
per:
}
output params:
{
"search": [
{
"id": "53ca658c73757276b21d0000",
"business_name": "geo123",
"mobile_number": "12345678909",
"listing_categories": [
"par"
],
"latitude": "12.9667",
"longitude": "77.5667",
"country": "india",
"city": "chennai",
"state": null,
"zip_code": null,
"description": "test desc",
"customer_care_number": null,
"landline_number": null,
"address": "12def",
"website": null,
"twitter_link": null,
"facebook_link": null,
"linkedin_link": null,
"service_images": [
{
"id": "53ca658c73757276b21e0000",
"image_url": "http://localhost:3000/fallback/v1_default.png",
"is_main": false
}
],
"service_timing": null
},
{
"id": "53ca658973757276b21b0000",
"business_name": "geo",
"mobile_number": "12345678909",
"listing_categories": [
"par"
],
"latitude": "12.9667",
"longitude": "77.5667",
"country": "india",
"city": "chennai",
"state": null,
"zip_code": null,
"description": "test desc",
"customer_care_number": null,
"landline_number": null,
"address": "12def",
"website": null,
"twitter_link": null,
"facebook_link": null,
"linkedin_link": null,
"service_images": [
{
"id": "53ca658973757276b21c0000",
"image_url": "http://localhost:3000/fallback/v1_default.png",
"is_main": false
}
],
"service_timing": null
}
]
}
----------------
serach by service name
GET /api/v1/search
input params:
search:
{
latitude:
longitude:
listing_category:
distance:
page:
per:
}
output params:
{
"search": [
{
"id": "53ca658c73757276b21d0000",
"business_name": "geo123",
"mobile_number": "12345678909",
"listing_categories": [
"par"
],
"latitude": "12.9667",
"longitude": "77.5667",
"country": "india",
"city": "chennai",
"state": null,
"zip_code": null,
"description": "test desc",
"customer_care_number": null,
"landline_number": null,
"address": "12def",
"website": null,
"twitter_link": null,
"facebook_link": null,
"linkedin_link": null,
"service_images": [
{
"id": "53ca658c73757276b21e0000",
"image_url": "http://localhost:3000/fallback/v1_default.png",
"is_main": false
}
],
"service_timing": null
},
{
"id": "53ca658973757276b21b0000",
"business_name": "geo",
"mobile_number": "12345678909",
"listing_categories": [
"par"
],
"latitude": "12.9667",
"longitude": "77.5667",
"country": "india",
"city": "chennai",
"state": null,
"zip_code": null,
"description": "test desc",
"customer_care_number": null,
"landline_number": null,
"address": "12def",
"website": null,
"twitter_link": null,
"facebook_link": null,
"linkedin_link": null,
"service_images": [
{
"id": "53ca658973757276b21c0000",
"image_url": "http://localhost:3000/fallback/v1_default.png",
"is_main": false
}
],
"service_timing": null
}
]
}
---------------------
current user services
GET /api/v1/users/current_user_services
output params:
{
"services": [
{
"id": "53ca658573757276b2190000",
"business_name": "max",
"mobile_number": "12345678909",
"listing_categories": [
"par"
],
"latitude": "12.9667",
"longitude": "77.5667",
"country": "india",
"city": "chennai",
"state": null,
"zip_code": null,
"description": "test desc",
"customer_care_number": null,
"landline_number": null,
"address": "12def",
"website": null,
"twitter_link": null,
"facebook_link": null,
"linkedin_link": null,
"service_images": [
{
"id": "53ca658573757276b21a0000",
"image_url": "http://localhost:3000/fallback/v1_default.png",
"is_main": false
}
],
"service_timing": null
},
{
"id": "53ca658973757276b21b0000",
"business_name": "geo",
"mobile_number": "12345678909",
"listing_categories": [
"par"
],
"latitude": "12.9667",
"longitude": "77.5667",
"country": "india",
"city": "chennai",
"state": null,
"zip_code": null,
"description": "test desc",
"customer_care_number": null,
"landline_number": null,
"address": "12def",
"website": null,
"twitter_link": null,
"facebook_link": null,
"linkedin_link": null,
"service_images": [
{
"id": "53ca658973757276b21c0000",
"image_url": "http://localhost:3000/fallback/v1_default.png",
"is_main": false
}
],
"service_timing": null
},]
----------------------------------------
current services of a particular user
GET /api/v1/users/53c7a4bf73757212770f0000/services
output params:
{
"services": [
{
"id": "53ca658573757276b2190000",
"business_name": "max",
"mobile_number": "12345678909",
"listing_categories": [
"par"
],
"latitude": "12.9667",
"longitude": "77.5667",
"country": "india",
"city": "chennai",
"state": null,
"zip_code": null,
"description": "test desc",
"customer_care_number": null,
"landline_number": null,
"address": "12def",
"website": null,
"twitter_link": null,
"facebook_link": null,
"linkedin_link": null,
"service_images": [
{
"id": "53ca658573757276b21a0000",
"image_url": "http://localhost:3000/fallback/v1_default.png",
"is_main": false
}
],
"service_timing": null
},
{
"id": "53ca658973757276b21b0000",
"business_name": "geo",
"mobile_number": "12345678909",
"listing_categories": [
"par"
],
"latitude": "12.9667",
"longitude": "77.5667",
"country": "india",
"city": "chennai",
"state": null,
"zip_code": null,
"description": "test desc",
"customer_care_number": null,
"landline_number": null,
"address": "12def",
"website": null,
"twitter_link": null,
"facebook_link": null,
"linkedin_link": null,
"service_images": [
{
"id": "53ca658973757276b21c0000",
"image_url": "http://localhost:3000/fallback/v1_default.png",
"is_main": false
}
],
"service_timing": null
},]
------------------------
chat
POST /api/v1/chat
inputparams:
chat: {
sender_id:
sender_type:
receiver_id:
receiver_type:
message:
sent_time
reply_id:
list_cat_id:
}
output
{
}
but in chat rabbitmq socket:
{"message":"\"test\"","chat_id":"53cd115e73757279d9290000","sent_time":"12:30","sender_type":"user","sender_id":"53c7a4bf73757212770f0000","receiver_id":"53cc0ae07375727a210a0000","receiver_type":"Service","listing_category":null}
----------------------------------------------
create rating and reviews
http headers required
POST /services/:service_id/service_ratings
input params:
service_rating: {
comment:
rating: (only 1 to 5)(either comment or rating should be present)
}
output params:
{
"service_rating": {
"id": "53ce281b737572124c460000",
"comment": "good",
"rating": "5",
"user_id": "53ce281b737572124c460000"
"service_id": "435654657567678"
}
}
---------------------------------------------------
update service and ratings
http headers required
PUT/PATCH /services/:service_id/service_ratings/:id
input params:
service_rating: {
comment:
rating: (only 1 to 5)(either comment or rating should be present)
}
output params:
{
"service_rating": {
"id": "53ce281b737572124c460000",
"comment": "good",
"rating": "5",
"user_id": "53ce281b737572124c460000"
"service_id": "435654657567678"
}
}
------------------------------------
delete service or rating
DELETE /services/:service_id/service_ratings/:id(service_rating_id)
http headers required
out_put: {
}
-----------------------------------------
get service ratings of a service
/api/v1/services/:service_id/service_ratings/
{
"service_ratings": [
{
"id": "53ce20a1737572124c0b0000",
"comment": "",
"rating": "3",
"user_id": "53c7a4bf73757212770f0000",
"service_id": "53ce1ff0737572124c000000"
},
{
"id": "53ce2102737572124c120000",
"comment": "",
"rating": "3",
"user_id": "53c7a4bf73757212770f0000",
"service_id": "53ce1ff0737572124c000000"
}
]
}
-------------------------------------
send multiple chats
POST /api/v1/multiple_chats
input_params:
chat :{
latitude:
longitude:
user_id
message:
list_cat_id:
}
output:
{
}
message output in socket
{"message":"this is a test","chat_id":"53cf7c587375727929000000","sent_time":null,"sender_type":"user","sender_id":"53c7a4bf73757212770f0000","receiver_id":"53cf6c4a7375722a06080000","receiver_type":"service","list_cat_id":"53c95c187375724e78000000"}
Note: only unique services are sent. if use had sent to all services then u get "error_message": "no services or u have messaged all the existing services"
---------------------------------------------------------------
chat block user
POST /api/v1/chat/user_chat_block
http headers required
input params:chat: {
service_id
}
output params:
{
}
-------------------------
Create Referral
post "/referral"
input_params:
{
referral_id:
device_id:
}
output params:
{
}
----------------------------------------------
banners
GET "/banners"
output params:
{[
image_url:"",
image_url:""
]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment