REST API Documentation

This is REST API documentation for HOME STYLIST APPLICATION.  You’ll need to authenticate via BASIC. You can obtain key from admin.

http://homestylist.adnanakhtar.net/

SALONS

The salons table parameters.

Property

Description

salon_id

Unique Identifier (auto generate)

name

The name of Salon, defined by the user

description

Description of Salon defined by the user

mobile

Mobile number defined by the user

password

Define by the user

email

Unique email address defined by user

discount

Discount defined by user

token

Token used for Push Notification

device

Identification of user’s device (android, ios) while Login/Register

service_id

Choose from list of services

membership_id

Membership of the Salon, defined by user

city

City of salon defined by user

address

Address of user

latitude

Latitude - from current location

longitude

Longitude from current location

available_for_order

String: Yes or No

status

String: Active or Disable

membership_expiry_date

In Date format (dd/mm/YYYY). Pre defined by device

created_time

Salon created time.. Defined by Database (DATETIME)

updated_time

Updated time defined by Database (CURRENT TIMESTAMP)

GET ALL SALONS

GET /salons/all/{limit}

SALON REGISTRATION

POST /salons.php/register


Parameters: name, description, mobile, password, email, discount, token, device, service_id, membership_id, city, address, latitude, longitude, membership_expiry_date

Success:

{

  "status": 1,

  "message": "Registration successfully",

  "data": {

    "name": "Adnan Salon",

    "description": "Hair Styles Salon",

    "mobile": "05965841565s",

    "password": "12345",

    "email": "adnanakhtar50@gmail.com5s",

    "discount": "19",

    "token": "android-token-here",

    "device": "android",

    "service_id": "1",

    "membership_id": "2",

    "city": "Riyadh",

    "address": "Ali Bin Abhi Talib Road",

    "latitude": "24.672682",

    "longitude": "46.745058",

    "membership_expiry_date": "12/12/2017",

    "salon_id": "3"

  }

}

Failure:

{

  "status": 0,

  "message": "Mobile Or Email is already registered!"

}

SALON LOGIN

POST /salons.php/login


Parameters are: mobile, password, token, device

Success:

{

  "status": 1,

  "message": "Login Successfully",

  "data": {

    "salon_id": "3",

    "name": "Adnan Salon",

    "description": "Hair Styles Salon",

    "mobile": "05965841565s",

    "password": "$2y$10$jUOubEdMvuKJsqpBAp9ObeZ.FjWEn4ZTrGHVcY.qb.ew5uLka7hJe",

    "email": "adnanakhtar50@gmail.com5s",

    "discount": "19",

    "token": "tokan",

    "device": "hybird",

    "service_id": "1",

    "membership_id": "2",

    "city": "Riyadh",

    "address": "Ali Bin Abhi Talib Road",

    "latitude": "24.672682",

    "longitude": "46.745056",

    "available_for_order": "Yes",

    "status": "Disable",

    "membership_expiry_date": "12/12/2017",

    "created_time": "2017-02-21 18:05:04"

  }

}

Failure

{

  "status": 0,

  "message": "Mobile or Password is Incorrect, Try again"

}

GET SALON WITH SERVICE ID AND CURRENT LOCATION

GET /salons.php/coordinate/{service_id}/{latitude}/{longitude}


{

  "status": 1,

  "message": "Nearby Salons",

  "data": [

    {

      "salon_id": "1",

      "name": "Adnan Salon",

      "description": "Hair Styles Salon",

      "mobile": "0596584155",

      "password": "$2y$10$E6n7Zp6kT2thZSosA6VDrOC6IqHkiEtrx9sa3uE2nzNxnzuokE5I6",

      "email": "adnanakhtar50@gmail.com",

      "discount": "19",

      "token": "android-token-here",

      "device": "android",

      "service_id": "1",

      "membership_id": "2",

      "city": "Riyadh",

      "address": "Ali Bin Abhi Talib Road",

      "latitude": "24.672682",

      "longitude": "46.745056",

      "available_for_order": "Yes",

      "status": "Disable",

      "membership_expiry_date": "12/12/2017",

      "created_time": "2017-02-21 18:03:12",

      "distance": "0"

    },

    {

      "salon_id": "2",

      "name": "Adnan Salon",

      "description": "Hair Styles Salon",

      "mobile": "05965841565",

      "password": "$2y$10$AsFc.Ap93iOpja3HP6ba7.rAeN21Db7JommUpo23glK5FWMBncozW",

      "email": "adnanakhtar50@gmail.com5",

      "discount": "19",

      "token": "android-token-here",

      "device": "android",

      "service_id": "1",

      "membership_id": "2",

      "city": "Riyadh",

      "address": "Ali Bin Abhi Talib Road",

      "latitude": "24.670176",

      "longitude": "46.737759",

      "available_for_order": "Yes",

      "status": "Disable",

      "membership_expiry_date": "12/12/2017",

      "created_time": "2017-02-21 18:03:52",

      "distance": "0.788273585302828"

    }

  ]

}

GET SINGLE SALON

GET /salons.php/id/{salon_id}


{

  "status": 1,

  "message": "Salon Found",

  "data": {

    "salon_id": "1",

    "name": "Adnan Salon",

    "description": "Hair Styles Salon",

    "mobile": "0596584155",

    "password": "$2y$10$E6n7Zp6kT2thZSosA6VDrOC6IqHkiEtrx9sa3uE2nzNxnzuokE5I6",

    "email": "adnanakhtar50@gmail.com",

    "discount": "19",

    "token": "android-token-here",

    "device": "android",

    "service_id": "1",

    "membership_id": "2",

    "city": "Riyadh",

    "address": "Ali Bin Abhi Talib Road",

    "latitude": "24.672682",

    "longitude": "46.745056",

    "available_for_order": "Yes",

    "status": "Disable",

    "membership_expiry_date": "12/12/2017",

    "created_time": "2017-02-21 18:03:12"

  }

}

On Failure:

{

  "status": 0,

  "message": "Salon not found"

}

UPDATE SALON

PUT /salons.php/update/{salon_id}


Parameters are: salon_id, name, description, city, service_id, discount, address, latitude, longitude

{

  "status": 1,

  "message": "Salon updated",

  "data": {

    "name": "adasda",

    "description": "new description",

    "discount": "50",

    "city": "Damman",

    "address": "new address",

    "latitude": "12.22522",

    "longitude": "12.22225",

    "salon_id": "1"

  }

}

UPDATE SALON STATUS

PUT /salons.php/status/{salon_id}


Parameters are:  salon_id, status (“Active”, “Disable”).

{

  "status": 1,

  "message": "Status has been changed",

  "data": {

    "status": "Active",

    "salon_id": "1"

  }

}

UPDATE SALON AVAILABILITY

PUT /salons.php/update/available_for_order/{salon_id}


Parameters are:  salon_id,  available_for_order (“Yes”, “No”)

{

  "statis": 1,

  "message": "Availability has been changed",

  "data": {

    "available_for_order": "No",

    "salon_id": "1"

  }

}

UPDATE SALON PASSWORD

PUT /salons.php/password/{salon_id}


Parameters are:  salon_id,  password

{

  "status": 1,

  "message": "Password has been changed",

  "data": {

    "password": "12345",

    "salon_id": "1"

  }

}

CUSTOMERS

The customers table parameters.

Property

Description

customer_id

Unique Identifier (auto generate)

name

The name of Customer, defined by the user

mobile

Mobile number defined by the user

password

Define by the user

token

Token used for authentication defined by device

device

Identification of user’s device (android, ios) while Login

status

Default status is “Active”

(Active, Disable).

created_time

Salon created time.. Defined by Database (DATETIME)

CUSTOMER REGISTRATION

POST /customers.php/register


Parameters are: name, mobile,, password, token, device

{

  "status": 1,

  "message": "Registration successfully",

  "data": {

    "name": "Adnan",

    "mobile": "0596584155",

    "password": "12345",

    "token": "dasdasd",

    "device": "dsds",

    "customer_id": "1"

  }

}

On Failure

{

  "status": 0,

  "message": "Mobile number is already registered!"

}

CUSTOMER LOGIN

POST /customers.php/login


Parameters are: mobile, password, token, device

{

  "status": 1,

  "message": "Login Successfully",

  "data": {

    "customer_id": "1",

    "name": "Adnan",

    "mobile": "0596584155",

    "password": "$2y$10$GRSsvRnzDXm9PMH8fG2zPejN3PqVPuPoqUNNtUh0491j97MMH32wu",

    "token": "aaa",

    "device": "aaa",

    "created_time": "2017-02-21 19:47:35"

  }

}

On Failure

{

  "status": 0,

  "message": "Mobile or Password is Incorrect, Try again"

}

ORDERS

The orders table parameters.

Property

Description

order_id

Unique Identifier (auto generate)

salon_id

Salon ID

customer_id

Customer ID

service_id

Service ID from salon profile

booking_date

Booking date (Calendar) YYYY-MM-DD

booking_time

Booking time hh:mm:ss

latitude

Customer’s current latitude

longitude

Customer’s current longitude

status

(Review, Accept, Reject) default value is “Review”

created_time

Created Time (DATETIME)

NEW ORDER

This option is available for customer only.. Where customer_id is for current  logged in customer and salon_id for the salon profile.

POST /orders.php/new


Parameters are:  salon_id, customer_id, service_id, booking_date, booking_time, latitude, longitude

Success:

{

  "status": 1,

  "message": "Booking has been sent",

  "data": {

    "salon_id": "1",

    "customer_id": "1",

    "service_id": "1",

    "booking_date": "2017-06-28",

    "booking_time": "10:12:22",

    "latitude": "21.2252",

    "longitude": "22.32325"

  }

}

On Failure:

{

  "status": 0,

  "message": "There is some problem, please try again"

}

GET SALON’S ORDERS

Get the list of all salon’s orders with status and customer informations.

(For Logged In Salon only)

GET /orders.php/salon/{salon_id}


Parameters are:  salon_id

{

  "status": 1,

  "message": "List of salon orders",

  "data": [

    {

      "customer_id": "2",

      "service_id": "1",

      "latitude": "12.22",

      "longitude": "12.225",

      "booking_date": "0000-00-00",

      "booking_time": "00:00:00",

      "status": "Review",

      "customer_name": null,

      "customer_mobile": null,

      "service_name": "Mackup"

    },

    {

      "customer_id": "1",

      "service_id": "1",

      "latitude": "12.2255",

      "longitude": "13.2252",

      "booking_date": "2017-02-28",

      "booking_time": "10:00:00",

      "status": "Review",

      "customer_name": "Adnan",

      "customer_mobile": "0596584155",

      "service_name": "Mackup"

    }

  ]

}

Failure:

{

  "status": 0,

  "message": "No Orders Found"

}

UPDATE ORDER

For Logged In Salon only

PUT /orders.php/update/{order_id}


Parameters are:  order_id, status

status values are “Accept, Reject”

Success:

{

  "status": 1,

  "message": "Status has been changed",

  "date": {

    "status": "Accept",

    "order_id": "12"

  }

}

Failure:

{

  "status": 0,

  "message": "There is some problem, Please try again"

}

SALONS MEMBERSHIP

The membership table parameters.

Property

Description

membership_id

Unique Identifier (auto generate)

membership_name

Predefined Membership name

membership_description

Predefined Membership Description

GET LIST OF MEMBERSHIP

GET /membership.php/all


{

  "status": 1,

  "message": "List of membership",

  "data": [

    {

      "membership_id": "1",

      "name": "Silver",

      "description": "dsadasdasdasdsadasda"

    },

    {

      "membership_id": "2",

      "name": "Golden",

      "description": "asdasdasdasdasdasdas"

    },

    {

      "membership_id": "3",

      "name": "Diamond",

      "description": "adsadasdasdasdas"

    }

  ]

}

MEMBERSHIP PACKAGES

The membership_packages table parameters.

Property

Description

package_id

Unique Identifier (auto generate)

membership_id

Membership Id

duration

Number of days

price

string

GET MEMBERSHIP’S PACKAGE

GET /membership.php/package/{membership_id}


Parameters are:  membership_id

{

  "status": 1,

  "message": "List of Packages",

  "data": [

    {

      "pacakge_id": "1",

      "membership_id": "1",

      "duration": "1 Month",

      "price": "100"

    },

    {

      "pacakge_id": "2",

      "membership_id": "1",

      "duration": "6 Month",

      "price": "600"

    },

    {

      "pacakge_id": "3",

      "membership_id": "1",

      "duration": "1 Year",

      "price": "100"

    }

  ]

}

BELOW UNDER WRITING...

TRANSACTIONS

The transactions table parameters.

Property

Description

transaction_id

Unique Identifier (auto generate)

salon_id

ID OF SALON

membership_id

Membership ID

amount

Amount according to membership

payment_method

{Bank, Paypal, Visa}

status

Default status is “UNPAID”

(PAID, UNPAID)

created_time

DATETIME on transaction created.

updated_time

On status Change

NEW TRANSACTION

POST /api/transactions/new


Parameters are: salon_id, membership_id, amount, payment_method, status

{

“salon_id” : 5,

“membership_id”: 2,

“amount” 250,

“payment_method”: “bank”,

“status”: “UNPAID”

}

Default status value is “UNPAID”

GET ALL SALON’S TRANSACTIONS

GET /api/transactions/salon/{salon_id}


Parameters are: salon_id,

{

{

“transaction_id”: 4

“salon_id” : 5,

“membership_id”: 2,

“amount” 250,

“payment_method”: “bank”,

“status”: “UNPAID”

},

{

“transaction_id”:474

…..

}

}

UPDATE TRANSACTION’S STATUS

PUT /api/transactions/update/{transaction_id}


Parameters are: salon_id,

{

“transaction_id”: 4

“status”: “PAID”

},

On successful transaction through VISA / PAYPAL need to change transaction status and salon status as well.

PAGES

The pagestable parameters.

Property

Description

page_id

Unique Identifier (auto generate)

name

Unique Name for page

title_en

Title for English language

title_ar

Title for Arabic language

content_en

HTML Content in English

content_ar

HTML Content in Arabic

GET PAGE

GET /api/pages/{name}


{

“page_id”: 1,

“Name”: “about”,

“title_en”: “About Us”,

“title_ar”: “معلومات عنا”,

“content_en”: “We are Home stylist”,

“content_ar”: “نحن الرئيسية المصمم”,

}