Get Started
we are going to help you to start and configure petroapp intigration by creating a copy of our documentntation and reports. Make sure you've read our directory structure articles before continuing.
simply this is our main modules you need to make an awesome integration
Generate Api Key
you have to use your main company user data [username , password] to get your api key to start with our web service configuration
As you might see in the get_apiKey directory;
- URL : https://app-stg.petroapp.app/webservice/get_apiKey
- Header Request parameters: none
- Method : POST
- Paramaters/body :
username*: your_company_username
password*: your_company_password - description : to return your api key .
- Notes:
expires_in return in seconds - success return:
{ "success": true, "message": "بترو اب يرحب بك", "data": { "api_key": "123123123123", "token_type": "bearer", "expires_in": 31536000 } } - failure return:
{ "success": false, "message": "بيانات المستخدم غير صحيحة", "data": "" }
Refresh Token
As you might see in the refresh_token directory;
- URL : https://app-stg.petroapp.app/webservice/refresh_token
- Header Request parameters:
Authorization :
Bearer your_api_token - Method : POST
- Paramaters/body : None
- description : to refresh your token.
- success return:
{ "success": true, "message": "بترو اب يرحب بك", "data": { "api_key": "123123123123", "token_type": "bearer", "expires_in": 31536000 } } - failure return:
{ "success": false, "message": "بيانات المستخدم غير صحيحة", "data": "" }
GET vehicles
List all vehicles (paginated).
- URL : https://app-stg.petroapp.app/webservice/vehicles?page=
page_number - Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- Paramaters/body :
plate : ( String, optional )
Vehicle plate or structure number to filter
- success return:
{ "success": true, "data": { "current_page": 1, "data": [ { "branch_name": "Branch name", "arabic_plate_letter": "س س س", "english_plate_letter": "S S S", "english_plate_number": "9 0 9 6", "arabic_plate_number": "٩ ٠ ٩ ٦", "trip_number": "trip-123", "consumption_method": "Has A Trip", "consumption_type": "limited", "max_consumption_by_rial": 500, "max_consumption_by_liters": 0, "current_consumption_by_rial": 100, "current_consumption_by_liters": null, "photo": null, "vehicle_available_days": "Sun,Mon,Tue,Wed,Thu,Fri,Sat", "brand": "Toyota", "model": "Camry", "type": "سيارة خفيفة", "year": 2020, "active": 1, "other_one": null, "other_two": null, "other_three": null, "odometer": "120000", "chassis_number": "A1234567", "internal_number": null } ], "from": 1, "last_page": 5, "next_page_url": "https://app-stg.petroapp.app/webservice/vehicles?page=2", "path": "https://app-stg.petroapp.app/webservice/vehicles", "per_page": 10, "prev_page_url": null, "to": 10, "total": 52 } } - failure return:
{ "success": false, "message": "Unauthenticated.", "data": null }
POST vehicles
Create a new vehicle.
- URL : https://app-stg.petroapp.app/webservice/vehicles
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
plate_letters : ( array )
e.g. ["X", "Y", "Z"]
plate_numbers : ( array )e.g. ["2", "0", "2", "0"]
fueltype_id : ( integer )required, exists in fuel_types
cartype_id : ( integer )required, exists in car_types
carbrand_id : ( integer )required, exists in car_brands
carmodel_id : ( integer )required, exists in car_models
consumption_rate : ( numeric )required, 1-100
company_branch_id : ( integer )required, exists in company_branches
tank_capacity : ( numeric )required
max_limit : ( numeric )required
year_industry : ( numeric )required, e.g. 2020
chassis_no : ( string, optional )
internal_id : ( string, optional )
structure_no : ( string, optional )
installation_type : ( string )required, "Installation" or "Delivery" - Plate validation (plate_letters / plate_numbers) :
plate_letters: required array, 1–3 elements. Each letter must exist in the system (valid Arabic or English plate letters). Saudi Arabia: certain letter combinations are banned (e.g. S-E-X, A-S-S, B-A-R, B-A-D and their Arabic equivalents).
plate_numbers: required array, 1–4 elements. Each element must be a single digit (0–9). Arabic or Persian digits are accepted and normalized. The plate number cannot be all zeros.
Heavy / structure-only: For car type "heavy" or when configuration uses structure only,plate_lettersandplate_numbersare not used;structure_nois required (allowed: letters, Thai script, digits, hyphen, spaces).
Motor (Saudi): For car type "motor",plate_lettersallows at most 2 elements;carbrand_idandcarmodel_idare not required. - Example bodies (Create) :
1. Standard light vehicle (plate):
2. Heavy vehicle (structure_no only):{ "plate_letters": ["X", "Y", "Z"], "plate_numbers": ["2", "0", "2", "0"], "fueltype_id": 1, "cartype_id": 1, "carbrand_id": 1, "carmodel_id": 5, "consumption_rate": 50, "company_branch_id": 10, "tank_capacity": 60, "max_limit": 500, "year_industry": 2023, "chassis_no": "A1234567", "installation_type": "Installation" }
3. Motor (max 2 letters, no brand/model):{ "structure_no": "TRK-1001", "fueltype_id": 2, "cartype_id": 2, "consumption_rate": 80, "company_branch_id": 10, "tank_capacity": 200, "max_limit": 2000, "year_industry": 2022, "installation_type": "Delivery" }{ "plate_letters": ["A", "B"], "plate_numbers": ["1", "2", "3", "4"], "fueltype_id": 1, "cartype_id": 3, "consumption_rate": 20, "company_branch_id": 10, "tank_capacity": 10, "max_limit": 100, "year_industry": 2024, "installation_type": "Installation" } - success return:
{ "status": true, "message": "added_successfully", "need_nfc": false, "id": 123 } - failure return:
{ "status": false, "message": "This_plate_number_is_already_exist" }
PUT vehicles
Update an existing vehicle.
- URL : https://app-stg.petroapp.app/webservice/vehicles
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: PUT
- Paramaters/body :
id : ( integer )
required, vehicle ID
plate_letters : ( array, optional )e.g. ["X", "Y", "Z"]
plate_numbers : ( array, optional )
fueltype_id : ( integer, optional )
cartype_id : ( integer, optional )
carbrand_id : ( integer, optional )
carmodel_id : ( integer, optional )
consumption_rate : ( numeric, optional )
company_branch_id : ( integer, optional )
tank_capacity, max_limit, year_industry : ( optional )
chassis_no, internal_id, structure_no : ( string, optional )
active : ( boolean, optional ) - Plate validation (plate_letters / plate_numbers) :
If you send
plate_lettersorplate_numbers, both are required together. Same rules as POST: plate_letters 1–3 elements (valid letters only; Saudi: no banned combinations), plate_numbers 1–4 elements, each a single digit (0–9), not all zeros. Heavy/structure-only and motor rules apply as in create. - Example bodies (Update) :
1. Update only active status:
2. Update plate (letters and numbers together):{ "id": 123, "active": false }
3. Update heavy vehicle structure_no and consumption:{ "id": 123, "plate_letters": ["A", "B", "C"], "plate_numbers": ["9", "8", "7", "6"] }
4. Partial update (branch and limit):{ "id": 456, "structure_no": "TRK-1002", "max_limit": 2500, "consumption_rate": 75 }{ "id": 123, "company_branch_id": 12, "max_limit": 600 } - success return:
{ "status": true, "message": "updated_successfully", "id": 123 } - failure return:
{ "status": false, "message": "vehicle_not_found" }
DELETE vehicles/{id}
Delete a vehicle by ID.
- URL : https://app-stg.petroapp.app/webservice/vehicles/
id - Header Request parameters:
Authorization :
Bearer your_api_token - Method: DELETE
- Paramaters/body : None.
idin URL path. - success return:
{ "status": true, "message": "deleted_successfully" } - failure return:
{ "status": false, "message": "Vehicle Not Found" }
GET delegates
List all delegates (paginated).
- URL : https://app-stg.petroapp.app/webservice/delegates?page=
page_number - Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- Paramaters/body :
name : ( String, optional )
Filter by delegate name (partial match)
username : ( String, optional )Filter by username (partial match)
code : ( String, optional )Filter by delegate code
active : ( 0|1, optional )Filter by active status
limit : ( integer, optional )Items per page (default 10)
get_deleted : ( boolean, optional )Include soft-deleted delegates when true
- success return:
{ "success": true, "data": { "data": [ { "id": 1, "name": "Delegate Name", "code": "DLG-001", "username": "delegate_user", "mobile": "0501234567", "email": "delegate@example.com", "active": true, "status": "active", "allow_to_use_any_vehicle": false, "company_branch_id": 10, "vehicle_ids": [1, 2], "created_at": "2024-01-15T10:00:00+00:00", "updated_at": "2024-01-15T10:00:00+00:00" } ], "current_page": 1, "per_page": 10, "total": 25 } } - failure return:
{ "success": false, "message": "Unauthenticated.", "data": null }
POST delegates
Create a new delegate.
- URL : https://app-stg.petroapp.app/webservice/delegates
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
name : ( string )
required
username : ( string )required, min 6 chars, unique per company
password : ( string )required, must satisfy password policy
email : ( string, optional )valid email, unique if provided
mobile : ( string, optional )numeric
active : ( boolean )required, default true
company_branch_id : ( integer )required, exists in company_branches
allow_to_use_any_vehicle : ( boolean )required, default false
vehicle_ids : ( array of integers, optional )required if allow_to_use_any_vehicle is false; vehicle IDs belonging to company
- Example request body (Create) :
With allow_to_use_any_vehicle (no vehicle_ids required) :{ "name": "Ahmed Ali", "username": "ahmed_delegate", "password": "SecurePass123!", "email": "ahmed@example.com", "mobile": "0501234567", "active": true, "company_branch_id": 10, "allow_to_use_any_vehicle": false, "vehicle_ids": [1, 2] }{ "name": "Sara Mohamed", "username": "sara_delegate", "password": "SecurePass123!", "email": "sara@example.com", "active": true, "company_branch_id": 10, "allow_to_use_any_vehicle": true } - success return:
{ "success": true, "data": { "message": "added_successfully" } } - failure return:
{ "success": false, "message": "", "errors": { "username": ["The username has already been taken."] } }
PUT delegates/{id}
Update an existing delegate.
- URL : https://app-stg.petroapp.app/webservice/delegates/
id - Header Request parameters:
Authorization :
Bearer your_api_token - Method: PUT
- Paramaters/body :
name : ( string, optional )
username : ( string, optional )min 6 chars, unique per company
password : ( string, optional )must satisfy password policy if provided
email : ( string, optional )
mobile : ( string, optional )numeric
active : ( boolean, optional )
company_branch_id : ( integer, optional )exists in company_branches
allow_to_use_any_vehicle : ( boolean, optional )
vehicle_ids : ( array of integers, optional )
- Example request body (Update) :
1. Update name and mobile only:
2. Update active status and branch:{ "name": "Ahmed Ali Updated", "mobile": "0509876543" }
3. Update password and allow any vehicle:{ "active": false, "company_branch_id": 12 }{ "password": "NewSecurePass456!", "allow_to_use_any_vehicle": true } - success return:
{ "success": true, "data": { "message": "updated_successfully" } } - failure return:
{ "success": false, "message": "not_found" }
GET delegates/{id}
Retrieve a single delegate by ID.
- URL : https://app-stg.petroapp.app/webservice/delegates/
id - Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- Paramaters/body : None.
idin URL path. - success return:
{ "success": true, "data": { "id": 1, "name": "Delegate Name", "code": "DLG-001", "username": "delegate_user", "mobile": "0501234567", "email": "delegate@example.com", "active": true, "status": "active", "allow_to_use_any_vehicle": false, "company_branch_id": 10, "vehicle_ids": [1, 2], "created_at": "2024-01-15T10:00:00+00:00", "updated_at": "2024-01-15T10:00:00+00:00" } } - failure return:
{ "success": false, "message": "not_found" }
POST delegates/{id}/activate
Activate a delegate by ID.
- URL : https://app-stg.petroapp.app/webservice/delegates/
id/activate - Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body : Optional.
idin URL path. Empty object or no body. - Example request body :
{} - success return:
{ "success": true, "message": "delegate_activated_successfully" } - failure return:
{ "success": false, "message": "not_found" }
POST delegates/{id}/deactivate
Deactivate a delegate by ID.
- URL : https://app-stg.petroapp.app/webservice/delegates/
id/deactivate - Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body : Optional.
idin URL path. Empty object or no body. - Example request body :
{} - success return:
{ "success": true, "message": "delegate_deactivated_successfully" } - failure return:
{ "success": false, "message": "not_found" }
POST delegates/{id}/restore
Restore a soft-deleted delegate by ID.
- URL : https://app-stg.petroapp.app/webservice/delegates/
id/restore - Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body : Optional.
idin URL path. Empty object or no body. - Example request body :
{} - success return:
{ "success": true, "data": { "message": "restored_successfully" } } - failure return:
{ "success": false, "message": "not_found" }
GET car_types
List car types (reference data).
- URL : https://app-stg.petroapp.app/webservice/car_types
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- success return:
{ "success": true, "data": [ { "id": 1, "title": "سيارة خفيفة" }, { "id": 2, "title": "معدات ثقيلة" } ] } - failure return:
{ "success": false, "message": "Unauthenticated.", "data": null }
GET car_brands
List car brands (reference data).
- URL : https://app-stg.petroapp.app/webservice/car_brands
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- success return:
{ "status": true, "data": [ { "id": 1, "title": "Toyota" }, { "id": 2, "title": "Ford" } ] } - failure return:
{ "status": false, "message": "Unauthenticated.", "data": null }
GET car_models/{car_brand_id}
List car models for a given brand.
- URL : https://app-stg.petroapp.app/webservice/car_models/
car_brand_id - Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- Paramaters/body :
car_brand_idin URL path. - success return:
{ "carModels": [ { "id": 1, "title": "Camry" }, { "id": 2, "title": "Corolla" } ] } - failure return:
{ "success": false, "message": "Unauthenticated.", "data": null }
GET fuel_types
List fuel types (reference data).
- URL : https://app-stg.petroapp.app/webservice/fuel_types
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- success return:
{ "status": true, "data": [ { "id": 1, "type": "91", "name": "91" }, { "id": 2, "type": "95", "name": "95" }, { "id": 3, "type": "diesel", "name": "ديزل" } ] } - failure return:
{ "status": false, "message": "Unauthenticated.", "data": null }
Vehicles
Here you will get all your vehicles
As you might see in the vehicles directory;
- URL : https://app-stg.petroapp.app/webservice/vehicles?page=
page_number - Paramaters/body :
plate : ( String )
Example [ X Y Z 2 0 2 0 ] Vehicle Plate Number Or Truck Structure Number
- Header Request parameters:
Authorization :
Bearer your_api_token - Method :GET
- success return:
{ "success": true, "data": { "current_page": 1, "data": [ { "branch_name": "Branch test1", "arabic_plate_letter": "س س س", "english_plate_letter": "S S S", "english_plate_number": "9 0 9 6", "arabic_plate_number": "٩ ٠ ٩ ٦", "trip_number": "test-123", "consumption_method": "NULL", "consumption_type": "NULL", "max_consumption_by_rial": 0, "max_consumption_by_liters": 0, "current_consumption_by_rial": 0, "current_consumption_by_liters": null, "photo": null, "vehicle_available_days": "Sun,Mon,Tue,Wed,Thu,Fri,Sat", "brand": " Austin", "model": " Mini Cooper", "type": "معدات ثقيلة", "year": null, "other_one": null, "other_two": null, "other_three": null, "chassis_number": "A1234567", "odometer":"120000", "internal_number": null } ], "from": 1, "last_page": 52, "next_page_url": "https://app-stg.petroapp.app/webservice/vehicles?page=2", "path": "https://app-stg.petroapp.app/webservice/vehicles", "per_page": 1, "prev_page_url": null, "to": 1, "total": 52 } } - failure return:
{ "message": "no data found", "success": true, "data": { "current_page": 1, "data": [], "from": null, "last_page": 0, "next_page_url": null, "path": "https://app-stg.petroapp.app/webservice/vehicles", "per_page": 10, "prev_page_url": null, "to": null, "total": 0 } }
insert Trip
Here you will add new trip to vehicle
As you might see in the insert_trip directory;
- URL : https://app-stg.petroapp.app/webservice/insert_trip
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
plate : ( String )
Example [ X Y Z 2 0 2 0 ] Vehicle Plate Number Or Truck Structure Number
trip_number: ( String )your new trip number
max_trip_consumption_rial : ( double )max trip consumption in saudi rial (SRA)
start_date : ( Date ) format exampl YYYY-mm-dd
end_date : ( Date ) format example YYYY-mm-dd
- success return::
{ "success": true,"message":"trip has been inserted", "data": {} } - failure return:
{ "success": false,"message":"error is occured", "data": {} }
Increase vehicle consumption
Here you can update vehicle consumption
Note that ! vehicle will be not related with any trips and this endpoint used to only increase vehicle consumption value
As you might see in the increase_vehicle_consumption directory;
- URL : https://app-stg.petroapp.app/webservice/increase_vehicle_consumption
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
plate : ( String )
Example [ X Y Z 2 0 2 0 ] Vehicle Plate Number Or Truck Structure Number
current_consumption : ( double )vehicle consumption in saudi rial (SRA) - success return::
{ "success": true,"message":"vehicle consumption has been increased", "data": {} } - failure return:
{ "success": false,"message":"error is occured", "data": {} }
Update Trip
Here you will add new trip to vehicle
As you might see in the update_trip directory;
To update current trip skip {trip_number}
if you want update a one of trip parameter just need to skip others parameters
- URL : https://app-stg.petroapp.app/webservice/update_trip
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
current_trip_number : ( String )
your old trip number
trip_number: ( String )your new trip number
increase_trip_consumption : ( double )To Increase current trip consumption and existed max trip consumption
reset : ( Boolean )To reset trip current consumption to equal existed max trip consumptionif reset parameter is true increase_trip_consumption will equal NULLtrip_consumption : ( double )To set trip consumption value and current consumption you needn't to send reset or increase_trip_consumption
start_date : ( Date ) format exampl YYYY-mm-dd
end_date : ( Date ) format example YYYY-mm-dd
- success return::
{ "success": true,"message":"trip has been updated", "data": {} } - failure return:
{ "success": false,"message":"error is occured", "data": {} }
Updated trips list
Here you will get updated trips had consumed with vehicle plate number
page limit with 10 records to get second records send parameter page=2... pagination structure
As you might see in the updated_trips directory;
- URL : https://app-stg.petroapp.app/webservice/updated_trips
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- Paramaters/body :
date_from : ( Date ) format exampl YYYY-mm-dd H:i:s
date_to : ( Date ) format example YYYY-mm-dd H:i:s
status : ( Boolean ) true : active / false : inactive - success return::
{ "success": true, "data": [ { "trip_number": "81002", "trip_start": "2022-05-31 02:00:00", "trip_end": "2022-06-01 02:00:00", "trip_consumption": 500, "consumed": 100, "remaining_balance": 400, "active": "active", "updated_at": "2022-05-31T07:49:25.000000Z", "vehicle": "H H H - 9 9 9 9" } ] } - failure return:
{ "success": false,"data": {} }
Assign vehicle to trip
Here you will assign trip to vehicle
As you might see in the assign_vehicle_to_trip directory;
- URL : https://app-stg.petroapp.app/webservice/assign_vehicle_to_trip
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
trip_number : ( STRING )
your trip number
plate: ( STRING )Vehicle plate - success return::
{ "success": true,"message":"vehicle now can using this trip", "data": {} } - failure return:
{ "success": false,"message":"this vehicle is not exist", "data": {} }
Remove vehicle from trip
Here you will remove vehicle from trip
As you might see in the remove_vehicle_from_trip directory;
- URL : https://app-stg.petroapp.app/webservice/remove_vehicle_from_trip
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
trip_number : ( STRING )
your trip number
plate: ( STRING )Vehicle plateNote : vehicle consumption method will changed to open then (max_consumption , current_consumption )
values will be ( 0 SAR ) - success return::
{ "success": true,"message":"vehicle now can not using this trip", "data": {} } - failure return:
{ "success": false,"message":"this vehicle is not exist", "data": {} }
Active Trip
To active trip use this endpoint
As you might see in the active_trip directory;
- URL : https://app-stg.petroapp.app/webservice/active_trip/
trip_number - Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- success return::
{ "success": true,"message":"trip has been active", "data": {} } - failure return:
{ "success": false,"message":"trip not found", "data": {} }
Deactivate Trip
To stop trip use this endpoint
As you might see in the deactivate_trip directory;
- URL : https://app-stg.petroapp.app/webservice/deactivate_trip/
trip_number - Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- success return::
{ "success": true,"message":"trip has been deactivate", "data": {} } - failure return:
{ "success": false,"message":"trip not found", "data": {} }
Trip status log
trip log to check who`s activate or deactivate trip
As you might see in the trip_status_logs directory;
- URL : https://app-stg.petroapp.app/webservice/trip_status_logs
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- success return::
{ "success": true, "data": { "current_page": 1, "data": [ { "trip_consumption": 1, "current_consumption": 1, "trip_number": "75002", "username": "app", "status": 0 }, { "trip_consumption": 1, "current_consumption": 1, "trip_number": "75002", "username": "app", "status": 1 } ], "first_page_url": "http://127.0.0.1:9999/webservice/trip_status_logs?page=1", "from": 1, "last_page": 1, "last_page_url": "http://127.0.0.1:9999/webservice/trip_status_logs?page=1", "links": [ { "url": null, "label": "pagination.previous", "active": false }, { "url": "http://127.0.0.1:9999/webservice/trip_status_logs?page=1", "label": "1", "active": true }, { "url": null, "label": "pagination.next", "active": false } ], "next_page_url": null, "path": "http://127.0.0.1:9999/webservice/trip_status_logs", "per_page": 10, "prev_page_url": null, "to": 2, "total": 2 } } - failure return:
{ "success": false,"message":"trip not found", "data": {} }
Vehicles Trip Log
Here you will get all your vehicles trip log
As you might see in the vehicles_trip_log_data directory;
- URL : https://app-stg.petroapp.app/webservice/vehicles_trip_log_data?page=
page_number - Paramaters/body :
trip_number: ( String )
trip number - Header Request parameters:
Authorization :
Bearer your_api_token - Method:GET
- success return:
{ "success": true, "data": { "current_page": 1, "data": [ { "branch_name": "Branch test1", "plate_letter_arabic": "ر ر ر", "plate_letter_english": "R R R", "structure_number": null, "plate_arabic_number": "۰ ۰ ۰ ۰", "english_plate_number": "0 0 0 0", "trip_number": "5dc4ce0d8f92d", "trip_consumption_by_rial": 100, "current_consumption_by_rial": 80, "trip_start_date": "2019-09-08 00:00:00", "trip_end_date": "2019-11-09 00:00:00", "inserted_at": null, "fuel_type": "91" } ], "from": 1, "last_page": 1, "next_page_url": "http://localhost/petroappwebprod/webservice/vehicles_trip_log_date?page=2", "path": "http://localhost/petroappwebprod/webservice/vehicles_trip_log_date", "per_page": 10, "prev_page_url": null, "to": 1, "total": 1 } } - failure return:
{ "message": "no data found", "success": true, "data": { "current_page": 1, "data": [], "from": null, "last_page": 0, "next_page_url": null, "path": "https://app-stg.petroapp.app/webservice/vehicles_trip_log_date", "per_page": 10, "prev_page_url": null, "to": null, "total": 0 } }
Get Bills
Here you can get your company bills with filter inputs
As you might see in the bills directory;
- Language parameters : ar || en
- URL : https://app-stg.petroapp.app/webservice/bills?page=
page_number&from=YYYY-mm-dd&to=YYYY-mm-dd&branch_name=your_branch_name&lang=en - Header Request parameters:
Authorization :
Bearer your_api_token - Method : GET
- parameters:
from : :( Date ) format example YYYY-mm-dd
to :( Date ) format example YYYY-mm-dd
branch_name : ( String ) Example: branch test - Successfuly Response:
{ "success": true, "data": { "current_page": 1, "data": [ { "bill_date": "2019-10-09 12:55:33", "trip_number": null, "payment_method": 1, "billDate": "2019-10-09 12:55:33", "status": 0, "branch_name": "Branch test1", "station_name": "حساب تجريبي", "station_lat": 21.63234578000000141173586598597466945648193359375, "station_lng": 48.62287828000000189376805792562663555145263671875, "delegate_name": null, "plate_letter": null, "plate_snum": null, "cost": 50.5, "num_of_liters": 107.4470000000000027284841053187847137451171875, "internal_number": null, "structure_number": null, "city": " طريف", "district": " الورود", "payment_method_text": "نقدى", "odometer":"120000" } ], "from": 1, "last_page": 1, "next_page_url": https://pre.petroapp.com.sa/webservice/bills?page=2, "path": "https://pre.petroapp.com.sa/webservice/bills", "per_page": 10, "prev_page_url": null, "to": 3, "total": 3 } }
Get Bills For Trips
Here you will your company bills with trip number input
As you might see in the bills directory;
- URL : https://pre.petroapp.com.sa/webservice/bills?page=
page_number&trip_number=trip_number - Header Request parameters:
Authorization :
Bearer your_api_token - Method :GET
- parameters:
trip_number: (String)
- Successfuly Response:
{ "success": true, "data": { "current_page": 1, "data": [ { "bill_date": "2019-10-09 12:55:33", "trip_number": 123123, "payment_method": 1, "billDate": "2019-10-09 12:55:33", "status": 0, "branch_name": "Branch test1", "station_name": "حساب تجريبي", "station_lat": 21.63234578000000141173586598597466945648193359375, "station_lng": 48.62287828000000189376805792562663555145263671875, "delegate_name": null, "plate_letter": null, "plate_snum": null, "cost": 50.5, "num_of_liters": 107.4470000000000027284841053187847137451171875, "internal_number": null, "structure_number": null, "city": " طريف", "district": " الورود", "payment_method_text": "نقدى", "odometer":"120000" } ], "from": 1, "last_page": 1, "next_page_url": "https://pre.petroapp.com.sa/webservice/bills?page2", "path": "https://pre.petroapp.com.sa/webservice/bills", "per_page": 10, "prev_page_url": null, "to": 3, "total": 3 } }
PetroApp Locations
Here you will get all petroapp locations
As you might see in the petroapp_locations directory;
- URL : https://pre.petroapp.com.sa/webservice/petroapp_locations?page=
page_number - Header Request parameters:
Authorization :
Bearer your_api_token - Method : GET
- Params: Response with station title , lat / lng , station services
- success return locations:
{ "request": null, "locs": [ { "station_name": "adwa elezz", "lat": 24.551790199999999231295078061521053314208984375, "lng": 46.6297075199999966343966661952435970306396484375, "id": 8, "service": [ { "service_name": "صيانة سيارات" }, { "service_name": "بنشر" }, { "service_name": "مغسلة سيارات" }, { "service_name": "سوبر ماركت" }, { "service_name": "صراف الي" }, { "service_name": "كوفي شوب" }, { "service_name": "مسجد" }, { "service_name": "غيار زيت" } ], "petrol_prices": [ { "id": 1, "fuel_type": "91" }, { "id": 3, "fuel_type": "ديزل" } ], "diesel": "yes" }, ] }
PetroApp Locations Filter
As you might see in the petroapp_locations directory;
- URL : https://pre.petroapp.com.sa/webservice/petroapp_locations?page=
page_number&search_request=lat,lng - OR : https://pre.petroapp.com.sa/webservice/petroapp_locations?page=
page_number&search_request=station_name - Header Request parameters:
Authorization :
Bearer your_api_token - Method:GET
- Paramaters:
search_request:
lat,lng||(String) station_name||(String) station_services - search_request with latitude longitude type lat,lng the same this way 24.55179019999,24.55179019999
- search_request with title type any String title and if exist you will get station data , return with request letter
{
"lat": "24.551790199999999231295078061521053314208984375",
"lng": "46.6297075199999966343966661952435970306396484375",
"request": "24.551790199999999231295078061521053314208984375,46.6297075199999966343966661952435970306396484375",
"locs": [
{
"station_name": "adwa elezz",
"lat": 24.551790199999999231295078061521053314208984375,
"lng": 46.6297075199999966343966661952435970306396484375,
"id": 8,
"service": [
{
"service_name": "صيانة سيارات"
},
{
"service_name": "بنشر"
},
{
"service_name": "مغسلة سيارات"
},
{
"service_name": "سوبر ماركت"
},
{
"service_name": "صراف الي"
},
{
"service_name": "كوفي شوب"
},
{
"service_name": "مسجد"
},
{
"service_name": "غيار زيت"
}
],
"petrol_prices": [
{
"id": 1,
"fuel_type": "91"
},
{
"id": 3,
"fuel_type": "ديزل"
}
],
"diesel": "yes"
},
]
}
Add delegate
Here you can add new delegate
As you might see in the add_delegate directory;
- URL : https://app-stg.petroapp.app/webservice/add_delegate
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
name : :( string ) example delegate name
username :( string ) example delegate username
password : ( String ) Example: Aa12345678
mobile : ( String ) Example: 102030405060
email : ( String ) Example: delegate@gmail.com
plate : ( String ) Example: Z Z Z 1 1 1 1
active : ( integer ) Example: 1 or 0
company_branch_id : ( integer ) Example: 120
- success return::
{ "success": true,"message":"The addition was successful", "data": {} } - failure return:
{ "success": false,"message":"error is occured", "data": {} }
Update delegate
Here you can update delegate code and status
As you might see in the update_delegate directory;
- URL : https://app-stg.petroapp.app/webservice/update_delegate
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
username :( string ) example delegate username
code : ( String ) Example: 1234
status : ( String ) Example: active or inactive - success return::
{ "success": true,"message":"The edit has been successfully made", "data": {} } - failure return:
{ "success": false,"message":"error is occured", "data": {} }