API call
POST https://tfy.tech101.in/api/v1/totp
Headers:
Content-Type: application/json
Body
{ "phone": "phone-number" }
Headers
HTTP/1.1 202 ACCEPTED
Body: none
Headers
HTTP/1.1 400 INVALID-PHONE
Body: none
Headers
HTTP/1.1 404 USER-NOT-FOUND
Body: none
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
This is a sample error message.
API call
POST https://tfy.tech101.in/api/v1/oauth/token
Headers
Content-Type: application/json
Body
{ "grant_type": "password" , "username": "the-username" , "password": "the-totp" , "scope": "hirer:all" or "driver:all" }
Headers
HTTP/1.1 200 OK Content-Type: application/json
Body
{ "access_token": "the-access-token" , "token_type": "bearer" , "scope": "hirer:all" or "driver:all" }
Headers
HTTP/1.1 404 HIRER-NOT-FOUND or DRIVER-NOT-FOUND
Body: none
Headers
HTTP/1.1 401 INVALID-TOTP
Body: none
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
This is a sample error message.
API call
POST https://tfy.tech101.in/api/v1/oauth/token
Headers
Content-Type: application/json
Body
{ "grant_type": "password" , "username": "admin-username" , "password": "admin-password" , "scope": "all:all" }
Headers
HTTP/1.1 200 OK Content-Type: application/json
Body
{ "access_token": "the-access-token" , "token_type": "bearer" , "scope": "hirer:all" or "driver:all" }
Headers
HTTP/1.1 404 ADMIN-NOT-FOUND
Body: none
Headers
HTTP/1.1 401 INVALID-PASSWORD
Body: none
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
This is a sample error message.
API call
GET https://tfy.tech101.in/api/v1/<objects>
where <objects> is one of cities, truck-types, trucks or drivers
Headers
Authorization: Bearer <admin-token>
Headers
HTTP/1.1 200 OK Content-Type: application/json
Body for cities
[ { "id": "uuid-of-city", "name": "name-of-city" }, { ... more cities ... } ]
Body for truck types
[ { "id": "uuid-of-truck-type", "name": "name-of-truck-type", "img": "https://path/to/icon/of/truck/type" }, { ... more truck types ... } ]
Body for trucks
[ { "id": "uuid-of-truck", "status": <truck-status>, "city": "current-city" }, { ... more trucks ... } ]
where <truck-status> is a status code indicating the role that the truck is playing right now. It can be one of the following numbers
Body for drivers
[ { "id": "uuid-of-driver", "name": "name-of-driver", "license": "license-number-of-driver" }, { ... more drivers ... } ]
Headers
Headers
Headers Body
API call
POST https://tfy.tech101.in/api/v1/cities POST https://tfy.tech101.in/api/v1/truck-types POST https://tfy.tech101.in/api/v1/trucks POST https://tfy.tech101.in/api/v1/drivers
Headers
Authorization: Bearer <admin-token> Content-Type: application/json
Body for city
{ "name": "city-name" }
Body for truck type
{ "name": "name-of-truck-type" }
Body for truck
{ "registration": { "id": "truck's-registration-number" , "expiry": "expiry-date-of-registration" } , "type": "uuid-of-truck-type" , "capacity": "capacity-in-tonnes" , "city": "uuid-of-city-where-the-truck-is" }
Body for driver
{ "name": "driver-name" , "license: { "id": "driver's-license-number" , "expiry": "expiry-date-of-license" } , "phone": "phone-number-of-driver" }
Headers
HTTP/1.1 200 OK Content-Type: application/json
Body for city
{ "id": "uuid-of-city" , "name": "name-of-city" }
Body for truck type {
"id": "uuid-of-truck-type" , "name": "name-of-truck-type" , "img": "https://path/to/truck/type/icon"
}
Body for truck {
"id": "uuid-of-truck" , "registration": { "id": "registration-number-of-truck" , "expiry": "expiry-date-for-registration" } , "type": "uuid-of-truck-type" , "capacity": capacity-in-tonnes , "img": { "self": "https://path/to/image/of/truck" , "rc": "https://path/to/image/of/rc/book" } , "driver": "uuid-of-driver-assigned" }
}
Body for driver {
"id": "uuid-of-driver" , "name": "driver's name" , "license": { "id": "license-number-of-driver" , "expiry": "expiry-date-of-license" } , "phone": "phone-number-of-driver" , "img": { "self": "https://path/to/image/of/driver" , "license": "https://path/to/image/of/license" } , "truck": "uuid-of-truck-assigned"
}
Headers
HTTP/1.1 401 INVALID-TOKEN
Body: none
Headers
HTTP/1.1 403 FORBIDDEN
Body: none
Headers
HTTP/1.1 400 INVALID-<field-name> e.g. INVALID-CITY-NAME Content-Type: text/plain
Body
Validation message specific to invalid field
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
Sample error message
API call
PATCH https://tfy.tech101.in/api/v1/cities/uuid-of-city PATCH https://tfy.tech101.in/api/v1/truck-types/uuid-of-truck-type PATCH https://tfy.tech101.in/api/v1/trucks/uuid-of-truck PATCH https://tfy.tech101.in/api/v1/drivers/uuid-of-truck
Headers
Authorization: Bearer admin-token Content-Type: application/json
Body
{ "isHidden": true for hide / false for unhide }
Headers
HTTP/1.1 204 DONE
Body: none
Headers
HTTP/1.1 401 INVALID-TOKEN
Body: none
Headers
HTTP/1.1 403 FORBIDDEN
Body: none
Headers
HTTP/1.1 404 <object type>-NOT-FOUND e.g. CITY-NOT-FOUND, TRUCK-TYPE-NOT-FOUND
Body: none
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
Sample error message.
API call
POST https://tfy.tech101.in/api/v1/media
Headers
Authorization: Bearer admin-token Content-Type: image/jpeg or image/png
Body: byte array of image
Headers
HTTP/1.1 200 OK Content-Type: text/plain
Body
https://path/of/uploaded/image
Headers
HTTP/1.1 401 INVALID-TOKEN
Headers
HTTP/1.1 403 FORBIDDEN
Headers
HTTP/1.1 400 INVALID-<field-name>, e.g. INVALID-MIME, INVALID-JPEG Content-Type: text/plain
Body
Validation error specific to the error in the field
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
Sample error message
API call
PATCH https://tfy.tech101.in/api/v1/trucks/uuid-of-truck PATCH https://tfy.tech101.in/api/v1/drivers/uuid-of-driver PATCH https://tfy.tech101.in/api/v1/truck-types/uuid-of-truck-type
Headers
Authorization: Bearer admin-token Content-Type: application/json
Body for truck
{ "img": { "self": "https://path/to/truck/photo" AND / OR , "rc": "https://path/to/truck/rc/book/photo" } }
Body for driver
{ "img": { "self": "https://path/to/driver/photo" AND / OR , "license": "https://path/to/license/photo" } }
Body for truck type
{ "img": "https://path/to/icon/of/truck/type" }
Headers
HTTP/1.1 204 DONE
Headers
HTTP/1.1 401 INVALID-TOKEN
Headers
HTTP/1.1 403 FORBIDDEN
Headers
HTTP/1.1 400 INVALID-<field-name>, e.g. INVALID-PATH Content-Type: text/plain
Body
Validation error specific to the error in the field
Headers
HTTP/1.1 404 <object-type>-NOT-FOUND, e.g. TRUCK-NOT-FOUND
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
Sample error message
API call
GET https://tfy.tech101.in/api/v1/hire-requests
Headers
Authorization: Bearer admin-token
Headers
HTTP/1.1 200 OK
Body
[ { "id": "hire-request-id", "dates": { "load": "desired-loading-date", "delivery": "desired-delivery-date" }, "cities": { "load": { "id": "uuid-of-city", "name": "name-of-city" }, "delivery": { "id": "uuid-of-city", "name": "name-of-city" } } }, { ... more requests ... } ]
Headers
HTTP/1.1 401 INVALID-TOKEN
Headers
HTTP/1.1 403 FORBIDDEN
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
Sample error message
API call
https://tfy.tech101.in/api/v1/hire-requests/uuid-of-request
Headers
Authorization: Bearer admin-token Content-Type: application/json
Headers
HTTP/1.1 200 OK
Body
{ "id": "hire-request-id", "hirer": { "id": "uuid-of-hirer", "name": "name-of-hirer", "phone": "phone-number-of-hirer" }, "dates": { "load": "desired-loading-date", "delivery": "desired-delivery-date" }, "cities": { "load": { "id": "uuid-of-city", "name": "name-of-city" }, "delivery": { "id": "uuid-of-city", "name": "name-of-city" } }, "truckType": { "id": "uuid-of-truck-type", "name": "name-of-truck-type" }, "capacity": capacity-in-tonnes, "addresses": { "load": "complete-loading-address", "delivery": "complete-delivery-address" }, "tariff": quoted-tariff }
Headers
HTTP/1.1 401 INVALID-TOKEN
Headers
HTTP/1.1 403 FORBIDDEN
Headers
HTTP/1.1 400 INVALID-REQUEST-ID Content-Type: text/plain
Headers
HTTP/1.1 404 HIRE-REQUEST-NOT-FOUND
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
Sample error message
API call
GET https://tfy.tech101.in/api/v1/hire-requests/uuid-of-request/trucks
Headers
Authorization: Bearer admin-token
Headers
HTTP/1.1 200 OK Content-Type: application/json
Body
[ "truck": { "id": "uuid-of-truck", "registration": "registration-number-of-truck" }, "driver": { "id": "uuid-of-driver", "name": "name-of-driver", "phone": "" } ]
Headers
HTTP/1.1 401 INVALID-TOKEN
Headers
HTTP/1.1 403 FORBIDDEN
Headers
HTTP/1.1 400 INVALID-HIRE-REQUEST Content-Type: text/plain
Body
Hire request must be a UUID.
Headers
HTTP/1.1 404 HIRE-REQUEST-NOT-FOUND
where <object-type> can be HIRE-REQUEST or SUGGESTION
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
Sample error message
API call
POST https://tfy.tech101.in/api/v1/bookings
Headers
Authorization: Bearer user-token Content-Type: application/json
Body
{ "requestId": "uuid-of-hire-request", "truckId": "uuid-of-assigned-truck" }
Headers
HTTP/1.1 200 OK Content-Type: application/json
Body
{ "id": "uuid-of-booking", "hirer": { "id": "uuid-of-hirer", "name": "name-of-hirer", "phone": "phone-number-of-hirer" }, "truck": { "id": "uuid-of-truck", "registration": "registration-number-of-truck", "type": { "id": "uuid-of-truck-type", "name": "name-of-truck-type" } , "capacity": capacity-in-tonnes }, "driver": { "id": "uuid-of-driver", "name": "name-of-driver", "phone": "phone-number-of-driver" }, "plan": { "load": { "date": "YYYY-MM-DD, date of loading", "city": { "id": "uuid-of-city", "name": "name-of-city" }, "address": "full-address-of-loading-point" }, "delivery": { "date": "YYYY-MM-DD, date of delivery", "city": { "id": "uuid-of-city", "name": "name-of-city" }, "address": "full-address-of-delivery-point" } }, "tariff": tariff-in-rupees }
Headers
HTTP/1.1 401 INVALID-TOKEN
Headers
HTTP/1.1 403 FORBIDDEN
Headers
HTTP/1.1 400 INVALID-<field-name> Content-Type: text/plain
where <field-name> is one of
Body
Validation error specific to the error in the field
Headers
HTTP/1.1 404 <object-type>-NOT-FOUND
where <object-type> can be one of
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
Sample error message
API call
GET https://tfy.tech101.in/api/v1/trips
Headers
Authorization: Bearer user-token
Headers
HTTP/1.1 200 OK
Body
[ { "id": "uuid-of-trip", "truck": { "id": "uuid-of-truck", "registration": "registration-number" }, "source":{ "date": "YYYY-MM-DD, date when truck leaves source", "city": { "id": "uuid-of-city", "name": "name-of-city" }, }, "destination": { "date": "YYYY-MM-DD, date when truck reaches destination", "city": { "id": "uuid-of-city", "name": "name-of-city" } } }, { ... more trips ... } ]
Headers
HTTP/1.1 204 DONE
Headers
HTTP/1.1 401 INVALID-TOKEN
Headers
HTTP/1.1 403 FORBIDDEN
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
Sample error message
API call
POST https://tfy.tech101.in/api/v1/trips
Headers
Authorization: Bearer user-token Content-Type: application/json
Body
{ "truckId": "uuid-of-truck", "source": { "date": "YYYY-MM-DD, date when truck leaves source", "cityId": "uuid-of-city-from-where-truck-leaves" }, "destination": { "date": "YYYY-MM-DD, date when truck reaches destination", "cityId": "uuid-of-city-where-truck-reaches" } }
Headers
HTTP/1.1 200 OK
Body
{ "id": "uuid-of-trip", "truck": { "id": "uuid-of-truck", "registration": "registration-number-of-truck" }, "source": { "date": "YYYY-MM-DD, date when truck leaves source", "city": { "id": "uuid-of-city", "name": "name-of-city-from-where-truck-leaves" } }, "destination": { "date": "YYYY-MM-DD, date when truck reaches destination", "city": { "id": "uuid-of-city", "name": "name-of-city-where-truck-reaches" } } }
Headers
HTTP/1.1 401 INVALID-TOKEN
Headers
HTTP/1.1 403 FORBIDDEN
Headers
HTTP/1.1 400 INVALID-<field-name> Content-Type: text/plain
Body
Validation error specific to the error in the field
Headers
HTTP/1.1 404 <object-type>-NOT-FOUND
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
Sample error message