NAV -image
bash javascript

Introduction

This documentation aims to provide all the information you need to work with our API.

Base URL

http://mudunelmanar.theportal.agency

Authenticating requests

This API is not authenticated.

Authentication

APIs for authenticating users

Login

Example request:

curl -X POST \
    "http://mudunelmanar.theportal.agency/api/login" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"email":"suscipit","password":"voluptas"}'
const url = new URL(
    "http://mudunelmanar.theportal.agency/api/login"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "suscipit",
    "password": "voluptas"
}

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request   

POST api/login

Body Parameters

email  string  
The email of the user.

password  string  
The password of the user.

Driver

APIs for driver trips

Trips

requires authentication

Example request:

curl -X GET \
    -G "http://mudunelmanar.theportal.agency/api/driver/trips?status=corporis" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://mudunelmanar.theportal.agency/api/driver/trips"
);

let params = {
    "status": "corporis",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

{
    "message": "Unauthenticated."
}

Request   

GET api/driver/trips

Query Parameters

status  string optional  
the trip status e.g. completed for completed trips, on_going for on_going trips

Update trip Status

requires authentication

Example request:

curl -X PUT \
    "http://mudunelmanar.theportal.agency/api/driver/trips/libero/update_status" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"status":"mollitia"}'
const url = new URL(
    "http://mudunelmanar.theportal.agency/api/driver/trips/libero/update_status"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "status": "mollitia"
}

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request   

PUT api/driver/trips/{trip}/update_status

URL Parameters

trip  string  

Body Parameters

status  string  
the new trip status e.g: 'assigned_driver_and_truck', 'not_assigned_driver_and_truck', 'arrived', 'on_loading', 'on_way', 'on_half_way', 'off_loading', 'completed']

Upload on loading image

requires authentication

Example request:

curl -X PUT \
    "http://mudunelmanar.theportal.agency/api/driver/trips/ea/upload_on_loading_image" \
    -H "Content-Type: multipart/form-data" \
    -H "Accept: application/json" \
    -F "on_loading_image=@C:\Users\Abdelrahman\AppData\Local\Temp\php206D.tmp" 
const url = new URL(
    "http://mudunelmanar.theportal.agency/api/driver/trips/ea/upload_on_loading_image"
);

let headers = {
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
};

const body = new FormData();
body.append('on_loading_image', document.querySelector('input[name="on_loading_image"]').files[0]);

fetch(url, {
    method: "PUT",
    headers,
    body,
}).then(response => response.json());

Request   

PUT api/driver/trips/{trip}/upload_on_loading_image

URL Parameters

trip  string  

Body Parameters

on_loading_image  file  
on loading image

Upload completed image

requires authentication

Example request:

curl -X PUT \
    "http://mudunelmanar.theportal.agency/api/driver/trips/et/upload_completed_image" \
    -H "Content-Type: multipart/form-data" \
    -H "Accept: application/json" \
    -F "completed_image=@C:\Users\Abdelrahman\AppData\Local\Temp\php207D.tmp" 
const url = new URL(
    "http://mudunelmanar.theportal.agency/api/driver/trips/et/upload_completed_image"
);

let headers = {
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
};

const body = new FormData();
body.append('completed_image', document.querySelector('input[name="completed_image"]').files[0]);

fetch(url, {
    method: "PUT",
    headers,
    body,
}).then(response => response.json());

Request   

PUT api/driver/trips/{trip}/upload_completed_image

URL Parameters

trip  string  

Body Parameters

completed_image  file  
completed image

Store location

requires authentication

Example request:

curl -X POST \
    "http://mudunelmanar.theportal.agency/api/driver/locations/voluptatum" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"trip_id":16,"lat":"velit","lng":"in"}'
const url = new URL(
    "http://mudunelmanar.theportal.agency/api/driver/locations/voluptatum"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "trip_id": 16,
    "lat": "velit",
    "lng": "in"
}

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request   

POST api/driver/locations/{driver}

URL Parameters

driver  string  

Body Parameters

trip_id  integer  
The id of the trip.

lat  string  
The current lat of the driver.

lng  string  
The current lng of the driver.

Update profile data

requires authentication

Example request:

curl -X POST \
    "http://mudunelmanar.theportal.agency/api/driver/profile" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"name":"enim","email":"dolores","fcm_token":"adipisci"}'
const url = new URL(
    "http://mudunelmanar.theportal.agency/api/driver/profile"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "enim",
    "email": "dolores",
    "fcm_token": "adipisci"
}

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request   

POST api/driver/profile

Body Parameters

name  string  
the new driver name

email  string  
the new driver email

fcm_token  string optional  
optional the driver fcm_token