Skip to content

[Server] REST API Documents

Hyeonwoo Kim edited this page Sep 13, 2022 · 43 revisions

BAETAVERSE REST API Documentation

Description of BATAVERSE API Server

You can also check here, BAETABERSE-Swagger

Overview

URL Method Bearer Token Description
/ GET No Simple index page, Response data is "Hello World"
/api/auth/signup/owner POST No Create instance to OWNER table and Respond created owner email and name
/api/auth/signup/forwarder POST No Create instance to FORWARDER table and Respond created forwarder email and name
/api/auth/login/owner POST No If email and password are true, Respond new owner token for authorization
/api/auth/login/forwarder POST No If email and password are true, Respond new forwarder token for authorization
/api/auth/token GET Any Verify any user bearer token and respond status code about token authorization
/api/auth/token/owner GET Owner Verify owner user bearer token and respond status code about token authorization
/api/auth/token/forwarder GET Forwarder Verify forwarder user bearer token and respond status code about token authorization
/api/hscode/{CODE} GET Any Respond HSCode information about parameter {code}, Server works as proxy server
/api/requests GET Owner Respond quote requests, that are matched with user token
/api/requests POST Owner Create instances to REQUESTS and GOODS table, After then respond created quote request and goods data
/api/requests/{ID} GET Owner Respond matched quote request and goods data with parameter {ID}
/api/requests/{ID}/quotations GET Owner Respond matched forwarder quotations with parameter {ID}
/api/requests/list GET Forwarder Respond all quote request
/api/quotations/ GET Forwarder Respond quotation, that are matched with user token
/api/quotations/ POST Forwarder Create instances to QUOTATION table, After then respond forwarder information, request and goods data
/api/quotations/{ID} GET Any Respond matched quotation info, forwarder info, request and good data
/api/reviews/ GET Any Respond matched review data with user token
/api/reviews/ POST Owner Create instances to REVIEW table, After then respond forwarder info, owner info, request info and quotation info

GET / Router

  • Request body

  • Bearer token

Request Body

interface body {}

Response

Hello world!

"status": 200



POST /api/auth/signup/owner Router

  • Request body

  • Bearer token

Request Body

interface body {
   "email": string,
   "password": string,
   "name": string,
   "phone_number": string
}

Response

interface Response {
   "status": number,
   "message": string,
   "email": string,
   "name": string
}

"status": 200 | 400


POST /api/auth/signup/forwarder Router

  • Request body

  • Bearer token

Request Body

interface body {
   "email": string,
   "password": string,
   "name": string,
   "phone_number": string
   "corporation_name": string
   "corporation_number": string
}

Response

interface Response {
   "status": number,
   "message": string,
   "email": string,
   "name": string
}

"status": 200 | 400


POST /api/auth/login/owner Router

  • Request body

  • Bearer token

Request Body

interface body {
   "email": string,
   "password": string,
}

Response

interface Response {
   "status": number,
   "message": string,
   "token": string
}

"status": 200 | 400 | 403


POST /api/auth/login/forwarder Router

  • Request body

  • Bearer token

Request Body

interface body {
   "email": string,
   "password": string,
}

Response

interface Response {
   "status": number,
   "message": string,
   "token": string
}

"status": 200 | 400 | 403


GET /api/auth/token Router

  • Request body

  • Bearer Any token

Request Body

interface body {}

Response

interface Response {
   "status": number,
   "message": string
}

"status": 200 | 401 | 409


GET /api/auth/token/owner Router

  • Request body

  • Bearer Owner token

Request Body

interface body {}

Response

interface Response {
   "status": number,
   "message": string
}

"status": 200 | 401 | 409


GET /api/auth/token/forwarder Router

  • Request body

  • Bearer Forwarder token

Request Body

interface body {}

Response

interface Response {
   "status": number,
   "message": string
}

"status": 200 | 401 | 409



GET /api/hscode/{CODE} Router

  • Request body

  • Bearer Any token

Request Body

interface body {}

Response

interface Response {
   "status": number,
   "message": string,
   "hscode": string[]
}

"status": 200 | 202 | 400



GET /api/requests Router

  • Request body

  • Bearer Owner token

Request Body

interface body {}

Response

interface Response {
   "status": number,
   "message": string,
   "selectedRequests": Request[]
}

QuoteRequest

interface Request {
   "id": number,
   "trade_type": string,
   "trade_detail": string,
   "forwarding_date": number,
   "departure_country": string,
   "departure_detail": string,
   "destination_country": string,
   "destination_detail": string,
   "incoterms": string,
   "closing_date": number,
   "created_at": number
}

"status": 200


POST /api/requests Router

  • Request body

  • Bearer Owner token

Request Body

interface body {
   "quoteRequest": ReqRequest,
   "goodsRequests": ReqGoods[]
}

QuoteRequest

interface ReqRequest {
   "trade_type": string,
   "trade_detail": string,
   "forwarding_date": number,
   "departure_country": string,
   "departure_detail": string,
   "destination_country": string,
   "destination_detail": string,
   "incoterms": string,
   "closing_date": number
}

GoodsRequest

interface ReqGoods {
   "name": string,
   "price": number,
   "weight": number,
   "standard_unit": string,
   "hscode": string
}

Response

interface Response {
   "status": number,
   "message": string,
   "createdRequest": Request,
   "createdGoods": Goods[]
}

CreatedRequest

interface Request {
   "id": number,
   "trade_type": string,
   "trade_detail": string,
   "forwarding_date": number,
   "departure_country": string,
   "departure_detail": string,
   "destination_country": string,
   "destination_detail": string,
   "incoterms": string,
   "closing_date": number,
   "created_at": number
}

CreatedGoods

interface Goods {
   "id": number,
   "name": string,
   "price": number,
   "weight": number,
   "standard_unit": string,
   "hscode": string
   "created_at": number
}

"status": 200


GET /api/requests/{ID} Router

  • Request body

  • Bearer Owner token

Request Body

interface body {}

Response

interface Response {
   "status": number,
   "message": string,
   "selectedRequest": Request,
   "selectedGoods": Goods[]
}

"status": 200


GET /api/requests/{ID}/quotations Router

  • Request body

  • Bearer Owner token

Request Body

interface body {}

Response

interface Response {
   "status": number,
   "message": string,
   "Quotation": Quotation[],
   "selectedGoods": Goods[]
}

Quotation

interface Quotation {
   "id": number,
   "ocean_freight_price": number,
   "inland_freight_price": number,
   "total_price": number,
   "total_price": number,
   "estimated_time": number
   "created_at": number
   "forwarder": Forwarder,
}
interface Forwarder {
   "name": string,
   "phone_number": string,
   "corporation_name": string,
   "corporation_number": string,
}

"status": 200


GET /api/requests/list Router

  • Request body

  • Bearer Forwarder token

Request Body

interface body {}

Response

interface Response {
   "status": number,
   "message": string,
   "selectedRequests": Request[]
}

"status": 200


GET /api/quotations Router

  • Request body

  • Bearer Forwarder token

Request Body

interface body {}

Response

interface Response {
   "status": number,
   "message": string,
   "Quotation": Quotation[]
   "selectedGoods": Goods[]
}

Qoutation

interface Quotation {
   "id": string,
   "ocean_freight_price": number,
   "inland_freight_price": number,
   "total_price": number,
   "estimated_time": number,
   "created_at": number,
   "forwarder": {
       "name": string,
       "phone_number": string,
       "corporation_name": string,
       "corporation_number": string,
   },
   "requests": {
       "id": number,
       "trade_type": "test00",
       "trade_detail": string,
       "forwarding_date": number,
       "departure_country": string,
       "departure_detail": string,
       "destination_country": string,
       "destination_detail": string,
       "incoterms": string,
       "closing_date": number,
       "created_at": number,
   }
}

"status": 200


POST /api/quotations Router

  • Request body

  • Bearer Forwarder token

Request Body

interface body {
   "ocean_right_price": number,
   "inland_freight_price": number,
   "total_price": number,
   "estimated_time": number,
   "request_id": number
}

Response

interface Response {
   "status": number,
   "message": string,
   "Quotation": Quotation[]
   "selectedGoods": Goods[]
}

"status": 200


GET /api/quotations/{id} Router

  • Request body

  • Bearer Any token

Request Body

interface body {}

Response

interface Response {
   "status": number,
   "message": string,
   "Quotation": Quotation[]
   "selectedGoods": Goods[]
}

"status": 200


GET /api/reviews Router

  • Request body

  • Bearer Any token

Request Body

interface body {}

Response

interface Response {
   "status": number,
   "message": string,
   "Review": Review[]
   "selectedGoods": []
}

"status": 200


Review

interface Review: {
   "score": number,
   "message": string,
   "forwarder": {
       "name": string,
       "corporation_name": string,
   },
   "owner": {
       "name": string,
   },
   "requests": {
       "id": number,
       "trade_type": string,
       "trade_detail": string,
       "forwarding_date": number,
       "departure_country": string,
       "departure_detail": string,
       "destination_country": string,
       "destination_detail": string,
       "incoterms": string,
       "closing_date": number,
       "created_at": number,
   },
   "quotation": {
       "id": number,
       "ocean_freight_price": number,
       "inland_freight_price": number,
       "total_price": number,
       "estimated_time": number,
       "created_at": number,
   }
}

POST /api/reviews Router

  • Request body

  • Bearer Owner token

Request Body

interface body {
   score: number,
   message: string,
   quotation_id: number,
   request_id: number
}

Response

interface Response {
   "status": number,
   "message": string,
   "Review": Review[]]
}

"status": 200