Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

basePath = /smartfin/api/v1

Warehouses - Post

...

Get company

...

Get warehouse list that is visible to current user

...

Request

URL:

  • {basePath}/wh/select

Method:

  • POST

Headers:

  • Content-Type: application/json

  • token

JSON Body:

  • {}

...

Response

...

Table of Contents
minLevel1
maxLevel2
outlinefalse
typelist
printablefalse

Base Url: /smartfin/api/v1/wh

Retrieve Warehouse’s Data

...

POST/smartfin/api/v1/wh/select

Retrieve all of the warehouse’s data under the current user

Authentication / Authorization

  •  API Key

Headers

Schema

...

Headers:

  • Content-Type: application/json

Authorization:

  • string - JWT <<YOUR_API_KEY_HERE>> (required)

Request

Example:

JSON Body:

Code Block
{}

Response

Example:

Code Block
{
    "error_code": 0,
    "value": {
        "
wh_add
whs": 
"OOOO",
[
            {
   
"company_id": 119,
             
"
c
wh_
name
id": 
"test2"
174,
                "
u
wh_name": 
null
"JIJI",
            
},
    
{
"update_time": null,
                "
wh
update_
id
by": 
165
null,
                "
wh
create_
name
by": 
"
2
"
,
                "
update
create_time": "2023-
08
11-
23
01 
14
11:
31
50:
04
35",
                "
update
user_
by
id": 
65
null,
                "
create
wh_
by
entity": 
2
"KIKIK",
                "
create
wh_
time
add": "
2023-08-23 14:07:39
OOOO",
                "
user
company_id": 
65
119,
                "
wh
c_
entity
name": "
KKK1
test2",
                "
wh
u_
add
name":
"KKK",
 null
            },
     
"company_id": 119,
       {
                "
c
wh_
name
id": 
"test2"
165,
                "
u
wh_name": "
Careers
2",
            
},
    "update_time": 
{
"2023-08-23 14:31:04",
                "
wh
update_
id
by": 
164
65,
                "
wh
create_
name
by": 
"KKK"
2,
                "
update
create_time": 
null
"2023-08-23 14:07:39",
                "
update
user_
by
id": 
null
65,
                "
create
wh_
by
entity": 
2
"KKK1",
                "
create
wh_
time
add": "
2023-08-23 14:07:19
KKK",
                "
user
company_id": 
null
119,
                "
wh
c_
entity
name": "
KKK
test2",
                "
wh
u_
add
name": "
KKK
Careers"
,

            },
   
"company_id": 119,
     ],
        
"
c
dropdown_
name
list": 
"test2",
{
            "wh_entity": [
  
"u_name":
 
null
             
}
"KKK1",

       
],
         "
dropdown_list": {
\u4e2d\u50a8\u65b0\u6e2f",
              
"wh_entity": [
  "MARK",
                "
KKK1
WAREHOUSE",
                "
\u4e2d\u50a8\u65b0\u6e2f
CAR",
                "
MARK
KIKIK",
                "
WAREHOUSE
TEST",
                "
CAR
CAR1",
                "
KIKIK
4",
                "
TEST
SALESX",
                "
CAR1
NEW E",
                "
4
LOLOLO1",
                "
SALESX
XX",
                "
NEW E
2",
                "
LOLOLO1
\u5170\u8003\u660c\u76db",
                "
XX
DGG",
                "
2
1",
                
"\u5170\u8003\u660c\u76db",
"HAHA",
                "
DGG
SALES",
                "
1
34",
                "
HAHA
MARKS",
                "
SALES
BUY ENTITY",
                "
34
ADMIN",
                "
MARKS
MARKX",
                
"BUY ENTITY",
"KKK"
            ],
            "
ADMIN",
wh_name": [
                "
MARKX
\u4e2d\u50a8\u65b0\u6e2f",
                "
KKK
54546",
                
]
"MARK",
            
"wh_name": [
    "WAREHOUSE",
                "
\u4e2d\u50a8\u65b0\u6e2f
CAR",
                "
54546
NEW NAME",
                "
MARK
TEST",
                "
WAREHOUSE
CAR1",
                "
CAR
55",
                "
NEW NAME
4",
                "
TEST
SALESX",
                "
CAR1
\u9752\u5c9b\u6e2f-\u7eac\u56db\u8def",
                "
55
XX",
                "
4
222",
                "
SALESX
2",
                "\
u9752
u5170\
u5c9b
u8003\
u6e2f-\u7eac\u56db\u8def
u660c\u76db",
                "
XX
BUY NAME",
                "
222
1",
                "
2
HAHA",
                "
\u5170\u8003\u660c\u76db
SALES",
                "
BUY NAME
JIJI",
                "
1
MARKS",
                "
HAHA
MARKX",
                "
SALES
ADMIN",
                "
JIJI
KKK"
,

            
"MARKS",
],
            "
MARKX
validation"
,
: []
        }
    
"ADMIN", "KKK" ], "validation": [] } } }

Notes

Returns

  • a list of objects (whs), each representing a warehouse (in descending order of wh_id)

  • a list of wh_entity present in the data

  • a list of wh_name present in the data

  • a list of validation that been used to indicate the list that is not able to add a new value (it is empty, all of the lists are able to update and add a new value)

Warehouses - Upsert ( Update/ Insert )

Update/insert warehouse

Inserts/Update warehouse

Request

URL:

  • {basePath}/wh/upsert

Method:

  • POST

Headers:

  • Content-Type: application/json

  • token

JSON Body:

  • insert_list: warehouse/s to be inserted

Code Block
[
  {
         "wh_name":"MARK",
         "wh_entity":"TEST1",
         "wh_add":"TEST_ADDRESS",
         "company_id":119
  }
]
  • update_list: warehouse/s to be updated

Code Block[ { "wh_id":174,
}
}

Schema

...

In whs ,

Code Block
whs - array[object]
  • An array of object that contains warehouse’s data

Code Block
update_time, u_name, update_by - string

Information about last updated time for the data and the user who updating the data.

Code Block
create_time, c_name, create_by - string

Information about created time for the data and the user who creating the data.

Code Block
user_id, wh_id, company_id - integer

  • user_id - User Id ( who the data belongs to)

  • entity_id - A unique ID assigned to the data. This ID can be used to retrieve warehouse data.

  • company_id - The main company Id for the data.

Code Block
wh_name, wh_entity, wh_add - string
  • wh_name - Warehouse name

  • wh_entity - Warehouse Entity

  • wh_add - Warehouse address

Info

wh_name , wh_entity and wh_add cannot be duplicated,

  • Eg. wh_name of ‘WAREHOUSE' , wh_entity of ‘ENTITY’ wh_add of 'ADDRESS’ will not allow to be stored if the same wh_name , wh_entity and wh_add has been created in database.

In dropdown_list ,

Code Block
wh_entity , wh_name  - array[string]
  • a list of string that serve as dropdown list for selection purpose.

Code Block
validation - array[string]

  • a list of validation that been used to indicate the name of array in dropdown_list that is not able to add a new value (it is empty, all of the array are able to update and add a new value

Update / Insert Warehouse Data

...

POST/smartfin/api/v1/wh/upsert

Insert new or update existing warehouse data in database

Authentication / Authorization

  •  API Key

Headers

Schema

...

Headers:

  • Content-Type: application/json

Authorization:

  • string - JWT <<YOUR_API_KEY_HERE>> (required)

Request

Example:

JSON Body:

Code Block
{
   "insert_list":[
      {
         "wh_name":"
WH_NAME
MARK",
         "wh_entity":"
TEST2
TEST1",
         "wh_add":"
TESTADD1
TEST_ADDRESS",
         "company_id":119
  
} ]

Response

Code Block{
    }
  
"error_code": 0,
 ],
   "
value
update_list":[
{
      {
  
"whs":
 
[
      "wh_id":174,
      
{
   
"wh_name":"WH_NAME",
         "wh_
id
entity":
176
"TEST2",
         
"
"wh_
name
add":
"
MARK
TESTADD1",

         
"
update
company_
time
id":119
null,
      }
   
"update_by": null, "create_by": 2, "create_time": "2023-11-02 11:57:10", "user_id": null, "wh_entity": "TEST1", "wh_add": "TEST_ADDRESS", "company_id": 119, "c_name": "test2", "u_name": null }, { "wh_id": 174, "wh_name": "WH_NAME", "update_time": "2023-11-02 11:57:10", "update_by": 2, "create_by": 2, "create_time": "2023-11-01 11:50:35", "user_id": 2, "wh_entity": "TEST2", "wh_add": "TESTADD1", "company_id": 119, "c_name": "test2", "u_name": "test2" }, ], "dropdown_list": { "wh_entity": [ "KKK1", "\u4e2d\u50a8\u65b0\u6e2f", "MARK", "WAREHOUSE", "CAR", "TEST", "CAR1", "4", "SALESX", "NEW E", "LOLOLO1", "XX", "TEST1", "2", "\u5170\u8003\u660c\u76db", "DGG", "1", "HAHA", "SALES", "34", "TEST2", "MARKS", "BUY ENTITY", "ADMIN", "MARKX", "KKK" ], "wh_name": [ "\u4e2d\u50a8\u65b0\u6e2f", "54546", "MARK", "WAREHOUSE", "CAR", "NEW NAME", "WH_NAME", "TEST", "CAR1", "55", "4", "SALESX", "\u9752\u5c9b\u6e2f-\u7eac\u56db\u8def", "XX", "222", "2", "\u5170\u8003\u660c\u76db", "BUY NAME", "1", "HAHA", "SALES", "MARKS", "MARKX", "ADMIN", "KKK" ], "validation": [] } }

Notes

The returned response format are the same as Warehouses - Post response format.

Insert and Update
]
}

Schema

...

Code Block
insert_list - array[object]

Code Block
update_list - array[object]

Warning

Insert process would fail if there is an existing warehouse with the same wh_name, wh_entity and same wh_name

Update process would fail if there is an existing warehouse

...

with the same wh_name, wh_entity

...

and same wh_name

...

Warehouses - Delete

...

Response:

Delete Warehouse Data

...

DELETE/smartfin/api/v1/wh/delete

Deletes single / multiple warehouse

...

Request

...

URL:

  • {basePath}/wh/delete

Method:

  • DELETE

Headers:

  • Content-Type: application/json

  • token

JSON Body:

  • del_ids: list of ids to be deleted

Code Block
[109]

...

Response

...

Code Block
// Same format as {basePath}/wh/select response body

...

Notes

...

data according to its wh_id

Authentication / Authorization

  •  API Key

Headers

Schema

...

Headers:

  • Content-Type: application/json

Authorization:

  • string - JWT <<YOUR_API_KEY_HERE>> (required)

Request

Example:

JSON Body:

Code Block
{
  "del_ids":[109]
}
Code Block
del_ids - array[integer]
  • An array that consists of unique wh_id, that user would like to delete from.

Response: