API

OVRS API Documentation

Build Status CodeBeat License Stars Issues Forges

Introduction

The OVRS API allows you to perform all the operations that you do with out web client.

OVRS API is built using REST principles which ensure predictable URLs that makes writing applications easy. This API follows HTTP rules, enabling a wide range of HTTP clients can be used to interact with the API.

Every resource is exposed as a URL. The URL of each resource can be obtained by accessing the API Root Endpoint.

Getting Started

API Root Endpoint

https://ovrsystem.com/api/v1

HTTP Methods

OVRS API uses appropriate HTTP verbs for every action.

Method Description
GET Used for retrieving resources.
POST Used for creating resources and performing resource actions.
PUT Used for updating resources.
DELETE Used for deleting resources.

Except GET Method, Other Methods most contains two headers

Content Type : application/json
X-Request-With : XMLHttpRequest

Response

Responses will be in the JSON format.

Node Name Description
Message Message for the invoked API
Resource Name Comprises the invoked API’s Data

Example

JSON Response

{
  "msg": "User With ID 1",
  "Users": {
    "ID": 1,
    "Email": "info@example.com",
    "Mobile_Phone": "+00-000-000-000",
    "First_Name": "Test",
    "Last_Name": "Test"
  }
}

Errors

OVRS API uses HTTP status codes to indicate success or failure of an API call. In general, status codes in the 2xx ranges means success, 4xx ranges means there was an error in the provided information, and those in the 5xx ranges indicates server side errors. Commonly used HTTP status codes are listed below.

Status Code Descriptions
2xx Success
4xx Bad request sent to server
5xx Server side error
Status Code Descriptions
200 Success: The request was successfully completed.
201 Created: The request was a success and one or more resources have been created.
400 Bad Request: The request cannot be performed. Usually because of malformed parameter or missing parameter
401 Unauthorized (Invalid AuthToken): Request was rejected because of invalid AuthToken.
403 Forbidden: The user does not have enough permission or possibly not a user of the respective organization to access the resource.
404 URL Not Found: The URL you’ve sent is wrong. It’s possible that the resource you’ve requested has been moved to another URL.
405 Method Not Allowed: The requested resource does not support the HTTP method used. For example, requesting List of all customers API with PUT as the HTTP method.
406 Not Acceptable: The requested response type is not supported by the client.
500 Server Error: OVRS server encountered an error which prevents it from fulfilling the request. Although this rarely happens, we recommend you to contact us at Support if you receive this error.

Login

If you are a member of OVRS, you can easily login to your dashboard. If you are using another interface to interact with our database and your data you should login.

Logging In

Method : POST Address : /login

Arguments

Argument Requirement
Username Required
Password Required

Request Example

URL and Header

$ curl http://ovrsystem.com/api/v1/login/
-H "Content-Type : application/json"
-H "X-Request-With : XMLHttpRequest"

Request Body

{
  "username" : "username",
  "password" : "password"
}

Response Example

JSON Response

{
  "msg": "User Found Successfully",
  "User": {
    "ID": 999,
    "Email": "info@ovrsystem.com",
    "Mobile_Phone": "+00-000-000-000",
    "First_Name": "TEST",
    "Last_Name": "TEST"
    }
}

User

A user refers to the user who registered him/her self to the OVRS. There can be multiple users with same Name Or Last Name but all users have a unique ID number that helps you speed up your work.

Method: GET | POST | PUT | DELETE URL: /user or /user/{$userID}

Attribute

Attribute Data Type Description
ID Integer Unique ID generated by the server for the product
Username String Unique Username Created by User
Password String Password Created by User
Email String User Email for sending Notifications and Password Rest
Mobile_Phone String User Phone number for Contacting User
First_Name String User First Name
Last_Name String User Last Name

Example:

JSON Response

{
  "msg": "User With ID Number 999",
  "Users": {
    "ID": 1,
    "Email": "info@ovrsystem.com",
    "Mobile_Phone": "+00-000-000-000",
    "First_Name": "TEST",
    "Last_Name": "TEST"
  }
}

Create User

Create New User

Method: POST URL: /user

Attribute

Attribute Data Type Description
ID Integer Auto
Username String Required
Password String Required
Email String Required
Mobile_Phone String Required
First_Name String Required
Last_Name String Required

Request Example

URL and Header

$ curl http://ovrsystem.com/api/v1/user/
-H "Content-Type : application/json"
-H "X-Request-With : XMLHttpRequest"

Request Body

{
  "username" : "username",
  "password" : "password",
  "email" : "info@ovrsystem.com",
  "mobile_phone" : "+00-000-000-000",
  "first_name" : "TEST",
  "last_name" : "TEST"
}

Response Example

JSON Response

{
  "msg": "User has been successfully saved to database",
  "user": {
    "Email": "info@ovrsystem.com",
    "Mobile_Phone": "+00-000-000-000",
    "First_Name": "TEST",
    "Last_Name": "TEST",
    "ID": 999
  }
}

Retrieve User

Details of an existing product.

Method: GET URL: /user/{user_id}

Request Example

URL and Header

$ curl http://ovrsystem.com/api/v1/user/{user_id}
-H "Content-Type : application/json"
-H "X-Request-With : XMLHttpRequest"

Response Example

JSON Response

{
  "msg": "User With ID 999",
  "Users": {
    "ID": 999,
    "Email": "info@ovrsystem.com",
    "Mobile_Phone": "+00-000-000-000",
    "First_Name": "TEST",
    "Last_Name": "TEST"
  }
}

Update User

Update User Details

Method: PUT URL: /user/{user_id}

Attributes

Attribute Data Type Description
ID Integer Auto
Username String Required
Password String Required
Email String Required
Mobile_Phone String Required
First_Name String Required
Last_Name String Required

If you don’t want to change any one of the attribute just send the current data.

Request Example

Request Header

$ curl http://ovrsystem.com/api/v1/user/{user_id}
-H "Content-Type : application/json"
-H "X-Request-With : XMLHttpRequest"

Request Body

{
  "username" : "username",
  "password" : "password",
  "email" : "info@ovrsystem.com",
  "mobile_phone" : "+00-000-000-000",
  "first_name" : "PEST",
  "last_name" : "PEST"
}

Response Example

JSON Response

{
  "msg": "User has been successfully updated",
  "Users": {
    "ID": 999,
    "Email": "info@ovrsystem.com",
    "Mobile_Phone": "+00-000-000-000",
    "First_Name": "PEST",
    "Last_Name": "PEST"
  }
}

Delete User

Delete an existent User.

Method: DELETE URL: /user/{user_id}

Request Example

Request Header

$ curl http://ovrsystem.com/api/v1/user/{user_id}
-H "Content-Type : application/json"
-H "X-Request-With : XMLHttpRequest"

Response Example

JSON Response

{
  "msg": "'User 999 has been successfully deleted'",
  "Users": {
    "ID": 999,
    "Email": "info@ovrsystem.com",
    "Mobile_Phone": "+00-000-000-000",
    "First_Name": "PEST",
    "Last_Name": "PEST"
  }
}

List of All Users

Return A List Of Users Object

Method: GET URL: /user/

Request Example

Request Header

$ curl http://ovrsystem.com/api/v1/user/{user_id}
-H "Content-Type : application/json"
-H "X-Request-With : XMLHttpRequest"

Response Example

JSON Response

{
  "msg": "List of all users",
  "user": {
    "ID": 997,
    "Email": "info@ovrsystem.com",
    "Mobile_Phone": "+00-000-000-000",
    "First_Name": "PEST",
    "Last_Name": "PEST"
  },
  "user": {
    "ID": 998,
    "Email": "info@ovrsystem.com",
    "Mobile_Phone": "+00-000-000-000",
    "First_Name": "PEST",
    "Last_Name": "PEST"
  },
  "user": {
    "ID": 999,
    "Email": "info@ovrsystem.com",
    "Mobile_Phone": "+00-000-000-000",
    "First_Name": "PEST",
    "Last_Name": "PEST"
  }
}

Vehicle

A Vehicle refers to the Vehicle that registered by OVRS user. A user can register multiple vehicles but a vehicle can only and only have one owner.

Method: GET | POST | PUT | DELETE URL: /vehicle or /vehicle/{vehicle_id}

Attributes

Attribute Data Type Description
ID Integer Auto Generated By Database
Type_ID Integer Select From Type List (ID)
Model String Exact Vehicle Model (Name + Number)
Brand String The Vehicle Brand Name
Pallet_ID String The Vehicle Pallet ID
Owner_ID Integer Owner User ID
Info String More Info About The Vehicle
P1 String(URL) Picture 1
P2 String(URL) Picture 2
P3 String(URL) Picture 3
P4 String(URL) Picture 4
P5 String(URL) Picture 5

Example

{
  "msg": "Vehicle 1",
  "vehicle": {
    "ID": 1,
    "Type_ID": 1,
    "Model": "B-3345A",
    "Brand": "BMW",
    "Pallet_ID": "B4346",
    "Owner_ID": 999,
    "Info": "N/A",
    "P1": "1.jpeg",
    "P2": "2.jpeg",
    "P3": "3.jpeg",
    "P4": "5.jpeg",
    "P5": "6.jpeg"
  }
}

Create Vehicle

Upload a new vehicle.

Method: POST URL:/vehicle

Attributes

Attribute Data Type Description
ID Integer Auto
Type_ID Integer Required
Model String Required
Brand String Required
Pallet_ID String Required
Owner_ID Integer Auto
Info String Required
P1 String(URL) Required
P2 String(URL) Required
P3 String(URL) Required
P4 String(URL) Required
P5 String(URL) Required

Request Example

URL and Header

$ curl http://ovrsystem.com/api/v1/vehicle/
-H "Content-Type : application/json"
-H "X-Request-With : XMLHttpRequest"

Request Body

{
  "Type_ID": 1,
  "Model": "B-3345A",
  "Brand": "BMW",
  "Pallet_ID": "4346",
  "Owner_ID": 1,
  "Info": "N/A",
  "P1": "1.jpeg",
  "P2": "2.jpeg",
  "P3": "3.jpeg",
  "P4": "5.jpeg",
  "P5": "6.jpeg"
}

Response Example

JSON Response

{
  "msg": "Vehicle has been successfully saved to database",
  "vehicle": {
    "Type_ID": 1,
    "Model": "B-3345A",
    "Brand": "BMW",
    "Pallet_ID": "4346",
    "Owner_ID": 999,
    "Info": "N/A",
    "P1": "1.jpeg",
    "P2": "2.jpeg",
    "P3": "3.jpeg",
    "P4": "5.jpeg",
    "P5": "6.jpeg",
    "ID": 3
  }
}

Retrieve Vehicle

Details of an existing vehicle.

Method: GET URL: /vehicle/{vehicle_id}

Request Example

URL and Header

$ curl http://ovrsystem.com/api/v1/vehicle/
-H "Content-Type : application/json"
-H "X-Request-With : XMLHttpRequest"

Response Example

JSON Response

{
  "msg": "Vehicle has been successfully saved to database",
  "vehicle": {
    "Type_ID": 1,
    "Model": "B-3345A",
    "Brand": "BMW",
    "Pallet_ID": "4346",
    "Owner_ID": 999,
    "Info": "N/A",
    "P1": "1.jpeg",
    "P2": "2.jpeg",
    "P3": "3.jpeg",
    "P4": "5.jpeg",
    "P5": "6.jpeg",
    "ID": 3
  }
}

Update Vehicle

Update Vehicle Details

Method: PUT URL:/vehicle/{vehicle_id}

Attributes

Attribute Data Type Description
ID Integer Auto
Type_ID Integer Required
Model String Required
Brand String Required
Pallet_ID String Required
Owner_ID Integer Auto
Info String Required
P1 String(URL) Required
P2 String(URL) Required
P3 String(URL) Required
P4 String(URL) Required
P5 String(URL) Required

If you don’t want to change any one of the attribute just send the current data.

Request Example

Request Header

$ curl http://ovrsystem.com/api/v1/vehicle/{vehicle_id}
-H "Content-Type : application/json"
-H "X-Request-With : XMLHttpRequest"

Request Body

{
  "Type_ID": 1,
  "Model": "B-3345A",
  "Brand": "BMW",
  "Pallet_ID": "4346",
  "Owner_ID": 999,
  "Info": "We Just Add This Info By Updating! :) ",
  "P1": "1.jpeg",
  "P2": "2.jpeg",
  "P3": "3.jpeg",
  "P4": "5.jpeg",
  "P5": "6.jpeg",
  "ID": 3
 }

Response Example

JSON Response

{
  "msg": "Vehicle has been successfully updated",
  "vehicle": {
    "Type_ID": 1,
    "Model": "B-3345A",
    "Brand": "BMW",
    "Pallet_ID": "4346",
    "Owner_ID": 999,
    "Info": "We Just Add This Info By Updating! :) ",
    "P1": "1.jpeg",
    "P2": "2.jpeg",
    "P3": "3.jpeg",
    "P4": "5.jpeg",
    "P5": "6.jpeg",
    "ID": 3
  }
}

Delete Vehicle

Delete an existent Vehicle, You are only allow to delete the vehicle that not rented by any one and you most be the owner of the vehicle.

Method: DELETE URL:/vehicle/{vehicle_id}

Request Example

Request Header

$ curl http://ovrsystem.com/api/v1/user/{user_id}
-H "Content-Type : application/json"
-H "X-Request-With : XMLHttpRequest"

Response Example

JSON Response

{
  "msg": "Vehicle 3 has been successfully deleted",
  "vehicle": {
    "Type_ID": 1,
    "Model": "B-3345A",
    "Brand": "BMW",
    "Pallet_ID": "4346",
    "Owner_ID": 999,
    "Info": "We Just Add This Info By Updating! :) ",
    "P1": "1.jpeg",
    "P2": "2.jpeg",
    "P3": "3.jpeg",
    "P4": "5.jpeg",
    "P5": "6.jpeg",
    "ID": 3
  }
}

List of All Vehicles

List Of All Vehicles

Method: GET URL:/vehicle

Request Example

Request Header

$ curl http://ovrsystem.com/api/v1/user/{user_id}
-H "Content-Type : application/json"
-H "X-Request-With : XMLHttpRequest"

Response Example

JSON Response

{
  "msg": "List of all vehicles",
  "vehicles": [
    {
      "ID": 1,
      "Type_ID": 1,
      "Model": "D-76875",
      "Brand": "BENZ",
      "Pallet_ID": "558865",
      "Owner_ID": 999,
      "Info": "N/A",
      "P1": "1.png",
      "P2": "2.png",
      "P3": "3.jpeg",
      "P4": "5.jpeg",
      "P5": "6.jpeg"
    },
    {
      "ID": 2,
      "Type_ID": 1,
      "Model": "B-3345A",
      "Brand": "BMW",
      "Pallet_ID": "4346",
      "Owner_ID": 999,
      "Info": "N/A",
      "P1": "1.jpeg",
      "P2": "2.jpeg",
      "P3": "3.jpeg",
      "P4": "5.jpeg",
      "P5": "6.jpeg"
    }
  ]
}

Rent

A rent refers to the vehicle rented by user. A vehicle can be rented only once at a time and the vehicle can’t be rented by it’s owner.

Method: GET | POST | PUT | DELETE URL: /rent or /rent/{rent_id}

Attribute

Attribute Data Type Description
ID Integer Auto Increment
Vehicle_ID Integer Auto Select from Selected Vehicle
Renter_ID Integer Auto Select from User ID
Rent_Time_Start Big Integer When the rent time start
Rent_Time_End Big Integer When the rent time end
Requested_Date Big Integer When the renter(user) send request for rent
Accepted_Date Big Integer When the owner accept the rent request
Rent_Status Integer(0|1) The vehicle is rented or not
Delivery_Date Big Integer When the owner deliver the vehicle to renter
Receive_Date Big Integer When the owner receive the vehicle back

Example

JSON Response

{
  "msg": "Rent 3",
  "Rent": {
    "ID": 3,
    "Vehicle_ID": 1,
    "Rentor_ID": 1,
    "Rent_Time_Start": ,
    "Rent_Time_End": 1234,
    "Requested_Date": 12345,
    "Accepted_Date": null,
    "Rent_Status": null,
    "Delivery_Date": null,
    "Receive_Date": null
  }
}

Create Rent

Retrieve Rent

Update Rent

Delete Rent

List of All Rents