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
- Get current user:
/account
- method:
GET
- Get details of a user:
/account/:id
- method:
GET
- Get stats of the current user:
/account/stats
- method:
GET
- Search users by a query:
/account/search
- method:
POST
- body:
{ query: string, page: number, perPage: number }
- 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[]
}
- Block account:
/account/update/blocked/block/:accountId
- method:
PUT
- Unblock account:
/account/update/blocked/unblock/:accountId
- method:
PUT
- Delete account:
/account
- method:
DELETE
Auctions
- Get latest auctions:
/auction/latest
- method:
GET
- Get details of an auction:
/auction/details/:id
- method:
GET
- Search auctions by a keyword:
/auction/:keyword/:page/:perPage
- method:
GET
- Get active auctions owned by an account:
/auction/active/:accountId
- method:
POST
- body:
{
page: number,
perPage: number
query?: string
orderDirection?: ASC | DESC
orderBy?: string
}
- Count filtered auctions:
/auction/filter/count
- method:
POST
- body:
{
categories: string[],
subCategories: string[],
locationIds: string[],
activeOnly?: boolean
includeMyAuctions?: boolean
minPrice?: number
maxPrice?: number
}
- 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
}
- Get auctions by bid status:
/auction/byBid/:status
- method:
POST
- body:
{
page: number,
perPage: number
query?: string
orderDirection?: ASC | DESC
orderBy?: string
}
- 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[]
}
- 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[]
}
- Delete auction:
/auction/:id
- method:
DELETE
Bids
- Create a bid:
/bid/:auctionId
- method:
POST
- body:
{
price: number
description?: string
latLng: string
location: string
}
- Update bid:
/bid/:id
- method:
PUT
- body:
{
isAccepted?: boolean
isRejected?: boolean
rejectionReason?: string
}
- Delete bid:
/bid/:id
- method:
DELETE
Categories
- Get all categories:
/category
- method:
GET
Chat
- Get current account chat groups:
/chat-group
- method:
GET
- Get chat group by id:
/chat-group/:id
- method:
GET
- Get messages from a chat group:
/chat-group/messages/:id/:page/:perPage
- method:
GET
- Get chat groups for two accounts:
/chat-group/:firstAccountId/:secondAccountId
- method:
GET
- Create chat group between current account and another:
/chat-group/:accountId
- method:
POST
- Send a message:
/chat-group/message/new
- method:
POST
- body:
{
message: string
groupId: string
id: string
}
- Mark chat group messages as seen:
/chat-group/seen/:groupId
- method:
PUT
Favourites
- Load account favourites:
/favourites
- method:
GET
- Get accounts who added auction to favourites:
/favourites/auction/:auctionId/:page/:perPage
- method:
POST
- Add auction to favourites:
/favourites/add/:auctionId
- method:
PUT
- Remove auction from favourites:
/favourites/remove/:auctionId
- method:
PUT