Introduction

Welcome to the Proof Of Delivery API! You can use our API to access our API endpoints, which can get information on various invoice records, profiles of driver in our database.

To gain access to the APIs buy the KPOD service from the azure marketplace.

BASE URL: https://kpodportal.kaispe.com/api/v1/:companyName

Here, companyName is the sub url which is assigned to the buyer.

Authentication

Get Access Token

curl --location -g --request POST '{{BASE_URL}}/Auth/createOAuthToken' \
--header 'clientid: client-id' \
--header 'clientsecret: client-secret'

The above command returns JSON structured like this:

{
"token_type": "Bearer",
"expires_in": "4 hours",
"accessToken": "accessToken"
}

This endpoint is used to get the JWT access token.

HTTP Request

POST {{BASE_URL}}/Auth/createOAuthToken

Header Parameters

ParameterDescription
clientidThe client id of the admin
clientsecretThe client secret of the admin

Authorization

To authorize, use this code:

curl "api_endpoint_here"
-H "Authorization: accessToken"

Make sure to replace accessToken with the token you get by calling the Get Access Token API.

KPOD API uses a JWT token to allow access to the API which is retrieved by the Get Access Token API.

KPOD API expects for the token to be included in all API requests to the server in a header that looks like the following:

Authorization: Bearer accessToken

Invoice Records

Get All Invoices

curl --location -g '{{BASE_URL}}/Auth' \
--header 'Authorization: Bearer accessToken'

The above command returns JSON structured like this:

{
"context": "",
"value": [
{
"packageImages": [],
"_id": "63c7ffe6a3341b00117d2cd8",
"invoice": "AR028288_SO-Inv",
"truckId": "TR",
"deliveryDate": "2022-01-26T12:00:00.000Z",
"dataAreaId": "bsi",
"company": "BSI Steel (PTY) LTD",
"salesUnit": "KG",
"invoiceDate": "2022-01-19T12:00:00.000Z",
"invoiceAmount": "0",
"invoiceAmountMST": "0",
"address": "73 Sardine Road\nGermiston\n1422",
"grossWeight": "2300",
"currencyCode": "",
"customerName": "",
"signatureImageUrl": "",
"nameOfReceiver": "",
"commentByReciver": "",
"actualDateOfDelivery": "",
"deliveryStatus": "notDelivered",
"latitude": "24.922901096541818",
"longitude": "67.10812835212685",
"invoiceDetails": [
{
"_id": "63c7ffe6a3341b00117d2cd9",
"invoice": "AR028288_SO-Inv",
"truckId": "TR",
"deliveryDate": "2022-01-26T12:00:00.000Z",
"dataAreaId": "bsi",
"companyName": "BSI Steel (PTY) LTD",
"invoiceAmountMST": "0",
"salesUnit": "KG",
"invoiceDate": "2022-01-19T12:00:00.000Z",
"invoiceAmount": "0",
"address": "73 Sardine Road\nGermiston\n1422",
"odataetag": "",
"name": "Slit Galvanised ISQ 230 Prime Z275 132.0x0.96",
"grossWeight": "2300",
"currencyCode": "ZAR",
"customerName": "Teichmann Steel (Pty) Ltd",
"itemId": "0012580",
"qty": "6786"
}
]
}
]
}

This endpoint retrieves all invoices.

HTTP Request

GET {{BASE_URL}}/Auth

Query Parameters

ParameterDefaultRequiredDescription
truckIdTrueIf value is given, the result will only consists of the invoices of the this specific truck id .

View all delivered invoices

curl --location -g '{{BASE_URL}}/Auth/history' \
--header 'Authorization: Bearer accessToken'

The above command returns JSON structured like this:

{
"context": "",
"value": [
{
"packageImages": [
"[{filename: 3994222711306379-wallpaperflare.com_wallpaper.jpg, url: https://kspnmpod.blob.core.windows.net/profile/3994222711306379-wallpaperflare.com_wallpaper.jpg},{filename: 6915330357416125-wp6422756-4k-iphone-7-wallpapers.jpg,url: https://kspnmpod.blob.core.windows.net/profile/6915330357416125-wp6422756-4k-iphone-7-wallpapers.jpg}]"
],
"_id": "639b236454dee229d84d3033",
"invoice": "AR028289_SO-Inv",
"truckId": "TR",
"deliveryDate": "2022-01-26T12:00:00.000Z",
"dataAreaId": "bsi",
"company": "BSI Steel (PTY) LTD",
"salesUnit": "EA",
"invoiceDate": "2022-01-19T12:00:00.000Z",
"invoiceAmount": "128528.37",
"invoiceAmountMST": "128528.37",
"address": "24 Harry Street \nRobertsham\nJohannesburg\n2130",
"grossWeight": "2400",
"currencyCode": "",
"customerName": "",
"signatureImageUrl": "",
"nameOfReceiver": "receiver name",
"commentByReciver": "Hello",
"actualDateOfDelivery": "2022-01-19T12:00:00Z",
"deliveryStatus": "delivered",
"latitude": "24.922901096541818",
"longitude": "67.10812835212685",
"invoiceDetails": [
{
"_id": "639b236454dee229d84d3034",
"invoice": "AR028289_SO-Inv",
"truckId": "TR",
"deliveryDate": "2022-01-26T12:00:00.000Z",
"dataAreaId": "bsi",
"companyName": "BSI Steel (PTY) LTD",
"invoiceAmountMST": "128528.37",
"salesUnit": "EA",
"invoiceDate": "2022-01-19T12:00:00.000Z",
"invoiceAmount": "128528.37",
"address": "24 Harry Street \nRobertsham\nJohannesburg\n2130",
"odataetag": "",
"name": "Sheet CR CQ Prime Dry 2450x1225x0.80",
"grossWeight": "2400",
"currencyCode": "ZAR",
"customerName": "Strut Africa (Pty) LTD",
"itemId": "0010870",
"qty": "270"
}
],
"imageRef": "6409d5c94285fc31184f0899"
}
]
}

This endpoint retrieves all invoices.

HTTP Request

GET {{BASE_URL}}/Auth/history

Query Parameters

ParameterDefaultRequiredDescription
truckIdTrueIf value is given, the result will only consists of the invoices of the this specific truck id .

Post invoice data in bulk

curl --location -g '{{BASE_URL}}/Auth/new' \
--header 'Authorization: Bearer accessToken' \
--header 'Content-Type: application/json' \
--data '[
{
"invoice": "AR028288_SO-Inv",
"truckId": "TR",
"deliveryDate": "2022-01-26T12:00:00.000Z",
"dataAreaId": "bsi",
"company": "BSI Steel (PTY) LTD",
"salesUnit": "KG",
"invoiceDate": "2022-01-19T12:00:00.000Z",
"invoiceAmount": "0",
"invoiceAmountMST": "0",
"address": "73 Sardine Road\nGermiston\n1422",
"grossWeight": "2300",
"currencyCode": "",
"customerName": "",
"signatureImageUrl": "",
"nameOfReceiver": "",
"commentByReciver": "",
"actualDateOfDelivery": "",
"deliveryStatus": "notDelivered",
"latitude": "24.922901096541818",
"longitude": "67.10812835212685",
"invoiceDetails": [
{
"invoice": "AR028288_SO-Inv",
"truckId": "TR",
"deliveryDate": "2022-01-26T12:00:00.000Z",
"dataAreaId": "bsi",
"companyName": "BSI Steel (PTY) LTD",
"invoiceAmountMST": "0",
"salesUnit": "KG",
"invoiceDate": "2022-01-19T12:00:00.000Z",
"invoiceAmount": "0",
"address": "73 Sardine Road\nGermiston\n1422",
"odataetag": "",
"name": "Slit Galvanised ISQ 230 Prime Z275 132.0x0.96",
"grossWeight": "2300",
"currencyCode": "ZAR",
"customerName": "Teichmann Steel (Pty) Ltd",
"itemId": "0012580",
"qty": "6786"
}
]
}
]'

The above command returns status code message like this:

Created

This endpoint is used to insert invoices in bulk quantity.

HTTP Request

POST {{BASE_URL}}/Auth/new

Body Parameters

ParameterData TypeRequiredRestrictionsDescription
invoiceStringYesN/AInvoice number
truckIdStringYesN/AUnique identifier for the truck transporting the package
deliveryDateDateYesN/ADate on which package was delivered
dataAreaIdStringYesN/AIdentifier for the geographical region
companyStringYesN/ACompany name
salesUnitStringYesN/AUnit responsible for sales
invoiceDateDateYesN/ADate on which the invoice was generated
invoiceAmountStringYesN/AAmount charged in the invoice currency
invoiceAmountMSTStringYesN/AAmount charged in the invoice currency after adjusting for taxes
addressStringYesN/ADelivery address
grossWeightStringYesN/ATotal weight of the package in kilograms
currencyCodeStringYesN/ACurrency code of the invoice amount
customerNameStringYesN/AName of the customer who placed the order
signatureImageUrlStringNoN/AURL of the signature image captured at the time of delivery
nameOfReceiverStringNoN/AName of the person who received the package
commentByReciverStringNoN/AAny comments made by the receiver
actualDateOfDeliveryStringNoN/AActual date on which the package was delivered
deliveryStatusEnum: ['delivered', 'notDelivered']YesN/AStatus of the package delivery
latitudeStringNoN/ALatitude coordinate of the delivery location
longitudeStringNoN/ALongitude coordinate of the delivery location
imageRefObjectIdNoN/AReference to the signature image in the database
packageImagesArrayNoN/AArray of URLs of images of the package
invoiceDetailsArray of ObjectsYesN/AArray of objects containing details of the invoice
- invoiceStringYesN/AInvoice number
- truckIdStringYesN/AUnique identifier for the truck transporting the package
- deliveryDateDateYesN/ADate on which package was delivered
- dataAreaIdStringYesN/AIdentifier for the geographical region
- companyNameStringYesN/ACompany name
- invoiceAmountMSTStringYesN/AAmount charged in the invoice currency after adjusting for taxes
- salesUnitStringYesN/AUnit responsible for sales
- invoiceDateDateYesN/ADate of the invoice
- invoiceAmountStringYesN/ATotal amount of order
- addressStringYesN/ADelivery address
- odataetagStringYesN/AThe tag of odataetag
- nameStringNoN/AName of the person who received the package
- grossWeightStringYesN/ATotal weight of the package in kilograms
- currencyCodeStringYesN/ACurrency code of the invoice amount
- customerNameStringYesN/AUnit responsible for sales
- invoiceDateStringYesN/AName of the customer
- itemIdStringYesN/AThe id of the item
- qtyStringYesN/AThe quantity of the item

Uploading package images

curl --location -g '{{BASE_URL}}/Auth/uploadPackageImages' \
--header 'Authorization: Bearer accessToken' \
--form 'packageImages=@"/image.jpg"'

The above command returns status code message like this:

[
{
"filename": "image.jpg",
"url": "https://kspnmpod.blob.core.windows.net/packageimages/image.jpg"
}
]

This endpoint is used to upload the package images to upload to cloud

HTTP Request

POST {{BASE_URL}}/Auth/uploadPackageImages

Body Parameters

ParameterData TypeRequiredRestrictionsDescription
packageImagesMediaYesSupported extension: png, jpg, jpeg and max 5 files allowedThe images of the package.

Changing invoice staus to delivered

curl --location -g '{{BASE_URL}}/Auth/upload' \
--header 'Authorization: Bearer accessToken' \
--form 'Name="Receiver"' \
--form 'Comments="Order was good"' \
--form 'DataAreaId="D1"' \
--form 'TruckId="TR"' \
--form 'FileName="file1"' \
--form 'FileData="filed1"' \
--form 'InvoiceNo="AR028288_SO-Inv"' \
--form 'actualDateOfDelivery="2022-01-19T12:00:00Z"' \
--form 'packageImages="[{\"filename\": \"image.jpg\", \"url\": \"https://kspnmpod.blob.core.windows.net/packageimages/image.jpg\"}]"'

The above command returns status code message like this:

{
"successfull": true
}

This endpoint is used to upload the package, signature image url and change invoice delivery status

HTTP Request

POST {{BASE_URL}}/Auth/upload

Body Parameters

ParameterData TypeRequiredRestrictionsDescription
nameStringYesN/AThe name of the receiver with the package or delivery.
commentsStringNoN/AComments given by receiver.
dataAreaIdStringYesN/AThe
truckIdStringYesN/AThe identifier for the truck or vehicle associated with the package or delivery.
fileNameStringNoN/AThe name of the signed image associated with the package or delivery.
fileDataStringNoN/AThe data of the signed image decoded associated with the package or delivery.
invoiceNoStringNoN/AThe invoice number associated with the package or delivery.
actualDateOfDeliveryStringNoN/AThe actual date of delivery for the package.
packageImagesArrayNoN/AAn array of package images associated with the package or delivery.

Driver Profile

Create profile

curl --location -g '{{BASE_URL}}/profile/create' \
--header 'Authorization: Bearer accessToken' \
--header 'Content-Type: application/json' \
--data '{
"name": "Truck Driver",
"password": "pass123",
"truckId": "TR",
"profile_image": "http://url.com",
"phoneNumber": "123456",
"address": "this one"
}'

The above command returns status code message like this:

{ "message": "Profile image updated successfully" }

This endpoint is used to create a driver profile

HTTP Request

POST {{BASE_URL}}/profile/create

Body Parameters

ParameterData TypeRequiredRestrictionsDescription
nameStringYesThe name of the user
passwordStringYesThe password of the user
truckIdStringYesUniqueThe unique id of the user
phoneNumberStringThe contact number of the user
addressStringYesThe address of the user
profile_imageStringYesThe profile image of the user

Get all driver profiles

curl --location -g '{{BASE_URL}}/profile/viewAll/profiles' \
--header 'Authorization: Bearer accessToken'

This endpoint is used to get the specific driver profile

[{
"_id": "63f31e65b2bad7276c3716d1",
"name": "truck rider",
"password": "$2b$10$NMsbQcx6P3Wy4nYpClYidePZlCsuE4n7hMvG6Y/SsZCqlHuo.rXRe",
"truckId": "TR",
"phoneNumber": "123456",
"address": "this one",
"licenseNo": "233-SD",
"profile_image": "https://kspnmpod.blob.core.windows.net/profile/6239398899617339-casey-horner-JNHrBVfdT_A-unsplash.jpg"
}]

HTTP Request

GET {{BASE_URL}}/profile/viewAll/profiles

Get the driver profile

curl --location -g '{{BASE_URL}}/profile/:truckId' \
--header 'Authorization: Bearer accessToken'

This endpoint is used to get the specific driver profile

{
"_id": "63f31e65b2bad7276c3716d1",
"name": "truck rider",
"password": "$2b$10$NMsbQcx6P3Wy4nYpClYidePZlCsuE4n7hMvG6Y/SsZCqlHuo.rXRe",
"truckId": "TR",
"phoneNumber": "123456",
"address": "this one",
"licenseNo": "233-SD",
"profile_image": "https://kspnmpod.blob.core.windows.net/profile/6239398899617339-casey-horner-JNHrBVfdT_A-unsplash.jpg"
}

HTTP Request

GET {{BASE_URL}}/profile/:truckId

URL Parameters

ParameterDescription
truckIdThe truck id of the driver given

Update the driver profile

curl --location -g --request PATCH '{{BASE_URL}}/profile/:truckId' \
--header 'Authorization: Bearer accessToken' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Truck Driver",
"email": "tr@email.com",
"password": "pass123",
"phoneNumber": "123456",
"address": "this one",
"truckId": "TR",
"licenseNo": "TRL",
"profile_image": "http://url.com"
}'

The above command returns JSON structured like this:

{
"message": "User updated successfully"
}

This endpoint is used to update the specific driver profile

HTTP Request

PATCH {{BASE_URL}}/profile/:truckId

URL Parameters

ParameterDescription
truckIdThe truck id of the driver should be given

Body Parameters

ParameterData TypeRequiredRestrictionsDescription
nameStringYesThe name of the user
passwordStringYesThe password of the user
truckIdStringYesUniqueThe unique id of the user
phoneNumberStringThe contact number of the user
addressStringYesThe address of the user
profile_imageStringYesThe profile image of the user

Delete the driver profile

curl --location -g --request DELETE '{{BASE_URL}}/profile/:truckId' \
--header 'Authorization: Bearer accessToken'

The above command returns JSON structured like this:

{
"message": "User deleted successfully"
}

This endpoint is used to delete the specific driver profile

HTTP Request

DELETE {{BASE_URL}}/profile/:truckId

URL Parameters

ParameterDescription
truckIdThe truck id of the driver should be given

Upload profile image

curl --location -g '{{BASE_URL}}/profile/image/:truckId' \
--header 'Authorization: Bearer accessToken' \
--form 'profileImage=@"/image.jpg"'

The above command returns status code message like this:

{ "message": "Profile image updated successfully" }

This endpoint is used to upload driver profile image

HTTP Request

POST {{BASE_URL}}/profile/image/:truckId

URL Parameters

ParameterDescription
truckIdThe truck id of the driver profile

Body Parameters

ParameterData TypeRequiredRestrictionsDescription
profileImageMedia typeYesExtension supported: jpg, jpeg, pngThe image of the user