The API is used to provide the data for the mobile apps that includes :
- Handle register, login and logout for user
- Handle user to update the incoming and outgoing stock data
- Handle the prediction sales
Login account
GET /login Request Body
{
"username": "gabrielmdy08@gmail.com",
"password": "*********"
}Response Body
{
"status": "Success",
"message": "Login successful",
"refreshToken": "string token",
}Register new account
POST /signupRequest Body
{
"firstName": "Gabriel",
"lastName": "Waworundeng",
"username": "gabrielmdy08@gmail.com",
"password": "*********",
"confirmPassword": "*********"
}Response Body
{
"status": "Success",
"message": "User created successfully"
}Get user profile data using token
Authorization: Bearer <token>
GET /userResponse Body
{
"status": "Success",
"data": {
"firstName": "Asep",
"lastName": "Supratman",
"email": "asep@gmail.com"
}
}Logout account
POST /logoutResponse Body
{
"status": "Success",
"message": "Logout successful"
}Give user all the data stocks
Authorization: Bearer <token>
GET /stocks?name| Parameter | Type | Description |
|---|---|---|
name |
string |
Optional. Return stock data by name |
Response Body
{
"status": "string",
"data": [
{
"id": "string",
"name": "string",
"category": "string",
"price": 0,
"total_stocks": 0
}
]
}Give user the data stocks by ID
Authorization: Bearer <token>
GET /stocks/{id}Response Body
{
"status": "string",
"data": {
"id": "string",
"name": "string",
"category": "string",
"price": 0,
"total_stocks": 0
}
}Update incoming stock data
Authorization: Bearer <token>
POST /stocks/incomingRequest Body
{
"name": "string",
"vendor_name": "string",
"price": 0,
"date": "string",
"quantity": 0
}Response Body
{
"status": "string",
"data": {
"id": 0,
"name": "string",
"price": 0,
"date": "string",
"quantity": 0
}
}Update outgoing stock data
Authorization: Bearer <token>
POST /stocks/outgoingRequest Body
{
"name": "string",
"price": 0,
"date": "string",
"quantity": 0
}Response Body
{
"status": "string",
"data": {
"id": 0,
"name": "string",
"price": 0,
"date": "string",
"sales": 0
}
}Export csv file from outgoing stocks data
Authorization: Bearer <token>
POST /stocks/export?month| Parameter | Type | Description |
|---|---|---|
month |
string |
Required. range month to exported |
Response Body
name,price,date,sales
ACER ASPIRE 3 A315 RYZEN 5 3500 4GB 1TB ATI VEGA 8 DOS BLACK,6690000,2017-12-01,28
ACER ASPIRE 5 A514-52G-58PW -I5-10210U-8GB-512GB-MX250-WIN10-,10000000,2017-12-01,67
ACER ASPIRE 3 A314 49WC 4644 4816 - A4 9120E 4GB 1TB SHARE W10,3499000,2017-12-01,19
"ACER PREDATOR NITRO 5 AN515-55 - I5-10300H - 8GB - 512SSD - GTX1650TI 4GB - 15.6""144HZ -W10 - OFFICE",12599000,2017-12-01,33
ACER PREDATOR NITRO AN515-44 - RYZEN 7-4800H 8GB 512GB GTX1650TI 4GB,15499000,2017-12-01,83... (105 KB left)
Predict sales
Authorization: Bearer <token>
Content-Type: multipart/form-data
POST /predictRequest Body
{
"file": "filename.csv"
}Response Body
{
"status": "string",
"data": {
"low": [
{
"date": "string",
"sales": 1234
}
],
"midd": [
{
"date": "string",
"sales": 1234
}
],
"high": [
{
"date": "string",
"sales": 1234
}
]
}
}Give user the history from the last prediction
Authorization: Bearer <token>
GET /last-predictionResponse Body
{
"status": "string",
"data": {
"low": [
{
"date": "string",
"sales": 1234
}
],
"midd": [
{
"date": "string",
"sales": 1234
}
],
"high": [
{
"date": "string",
"sales": 1234
}
]
}
}- Artifact registry - Store docker image
- Cloud Run - Serverless service to deploy the API apps using image from artifact registry
- Cloud Storage - Store model file in json format
- Cloud SQL - Store transactions data and product stocks
- Firestore - Store User data and prediction histories
