API

Base URL

By default, the base URL of the API is http://localhost:7777. You can change this in the .env file.

A socket connection with the server can be established at ws://localhost:7777.

Authentication

Most of the endpoints require authentication. The authentication is done using JWT tokens. The user needs to send the token in the authorization header.

The socket connection is also authenticated using JWT tokens. The user needs to send the token in the token query parameter.

Endpoints

Accounts

  1. Get current user: /account
  • method: GET

  1. Get details of a user: /account/:id
  • method: GET

  1. Get stats of the current user: /account/stats
  • method: GET

  1. Search users by a query: /account/search
  • method: POST
  • body: { query: string, page: number, perPage: number }

  1. Update user details: /account
  • method: POST
  • body:
{ 
  name?: string, 
  acceptedTermsAndConditions?: boolean, 
  introDone?: boolean, 
  introSkipped?: boolean, 
  picture?: string, 
  deviceFCMToken?: string, 
  allowedNotifications?: Object | string
  meta?: Object | string
  files: File[]  
}

  1. Block account: /account/update/blocked/block/:accountId
  • method: PUT

  1. Unblock account: /account/update/blocked/unblock/:accountId
  • method: PUT

  1. Delete account: /account
  • method: DELETE

Auctions

  1. Get latest auctions: /auction/latest
  • method: GET

  1. Get details of an auction: /auction/details/:id
  • method: GET

  1. Search auctions by a keyword: /auction/:keyword/:page/:perPage
  • method: GET

  1. Get active auctions owned by an account: /auction/active/:accountId
  • method: POST
  • body:
{ 
  page: number, 
  perPage: number 
  query?: string
  orderDirection?: ASC | DESC
  orderBy?: string
}

  1. Count filtered auctions: /auction/filter/count
  • method: POST
  • body:
{ 
  categories: string[],
  subCategories: string[],
  locationIds: string[],
  activeOnly?: boolean
  includeMyAuctions?: boolean
  minPrice?: number
  maxPrice?: number
}

  1. Get filtered auctions: /auction/filter/auctions
  • method: POST
  • body:
{ 
  categories: string[],
  subCategories: string[],
  locationIds: string[],
  activeOnly?: boolean
  includeMyAuctions?: boolean
  minPrice?: number
  maxPrice?: number
  page: number
  perPage: number
  orderDirection?: ASC | DESC
  orderBy?: string
}

  1. Get auctions by bid status: /auction/byBid/:status
  • method: POST
  • body:
{ 
  page: number, 
  perPage: number 
  query?: string
  orderDirection?: ASC | DESC
  orderBy?: string
}

  1. Create auction: /auction
  • method: POST
  • body:
{ 
  latLng: string
  location: string
  title: string
  description?: string
  price: number
  hasCustomStartingPrice: boolean
  condition: string
  mainCategoryId: string
  subCategoryId: string
  assetsToKeep: string[]
  files: File[] 
}
  1. Update auction: /auction/:id
  • method: PUT
  • body:
{ 
  latLng: string
  location: string
  title: string
  description?: string
  price: number
  hasCustomStartingPrice: boolean
  condition: string
  mainCategoryId: string
  subCategoryId: string
  assetsToKeep: string[]
  files: File[] 
}
  1. Delete auction: /auction/:id
  • method: DELETE

Bids

  1. Create a bid: /bid/:auctionId
  • method: POST
  • body:
{ 
  price: number
  description?: string
  latLng: string
  location: string
}

  1. Update bid: /bid/:id
  • method: PUT
  • body:
{ 
  isAccepted?: boolean
  isRejected?: boolean
  rejectionReason?: string
}

  1. Delete bid: /bid/:id
  • method: DELETE

Categories

  1. Get all categories: /category
  • method: GET

Chat

  1. Get current account chat groups: /chat-group
  • method: GET

  1. Get chat group by id: /chat-group/:id
  • method: GET

  1. Get messages from a chat group: /chat-group/messages/:id/:page/:perPage
  • method: GET

  1. Get chat groups for two accounts: /chat-group/:firstAccountId/:secondAccountId
  • method: GET

  1. Create chat group between current account and another: /chat-group/:accountId
  • method: POST

  1. Send a message: /chat-group/message/new
  • method: POST
  • body:
{ 
  message: string
  groupId: string
  id: string
}

  1. Mark chat group messages as seen: /chat-group/seen/:groupId
  • method: PUT

Favourites

  1. Load account favourites: /favourites
  • method: GET

  1. Get accounts who added auction to favourites: /favourites/auction/:auctionId/:page/:perPage
  • method: POST

  1. Add auction to favourites: /favourites/add/:auctionId
  • method: PUT

  1. Remove auction from favourites: /favourites/remove/:auctionId
  • method: PUT