Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel2
outlinefalse
typelist
printablefalse

Base Url: /smartfin/api/v1/stockmgmt

...

Table of Contents
minLevel1
maxLevel2
outlinefalse
typelist
printablefalse

Base Url: /smartfin/api/v1/stockmgmt

Info

The response of the following APIs will be returned as compressed form. To decompress it, please install https://www.npmjs.com/package/pako plugin and using the specific function ( inflate ) to decompress the response body.

...

POST /smartfin/api/v1/stockmgmt/select

Get all stocks that are visible to current user.

Info

During the implementation of HTTP service, HttpHeaders of each request need to be set as the format below:

Code Block
headers: new HttpHeaders({
    'Content-Type': 'application/json'
}),
responseType: 'arraybuffer' as 'json' 


Retrieve Stock Details

...

POST /smartfin/api/v1/stockmgmt/select

Get all stocks that are visible to current user.

Authentication / Authorization

...

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

Code Block
create_time, create_by, create_by_name - string

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

Code Block
user_id, stock_id, phy_trade_id, wh_id - integer

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

  • stock_id - A unique ID assigned to the data. This ID can be used to retrieve stock details.

  • phy_trade_id - The physical trade id that assigned with the stock.

  • wh_id - The warehouse id that are assigned with the stock.

Update / Insert Stock Details

Update:
POST/smartfin/api/v1/stockmgmt/updateInsert:
POST/

Code Block
group_name - string
maf_group_id - integer

  • maf_group_id - A unique group ID where the stock belongs to.

Code Block
wh_add, wh_entity, wh_name - string
wh_id - integer

  • wh_id - A unique warehouse ID where the stock belongs to.

  • wh_add, wh_entity, wh_name - related details of the warehouse.

Update / Insert Stock Details

...

Update:
POST/smartfin/api/v1/stockmgmt/update

Insert:
POST/smartfin/api/v1/stockmgmt/insert

Insert new or update existing stock details into database

...

JSON Body:

Code Block
{
   "phy_trade_ids":[
      60667
   ],
   "insert_list":[
      {
         "stock_id":"",
         "stock_date":"2023-12-01",
         "stock_type":1,
         "phy_trade_id":60667,
         "stock_wh_id":183,
         "stock_action":2,
         "trans_supplier":"",
         "slot_no":"",
         "stock_qty":1000,
         "match_id":"",
         "stock_s_date":"",
         "stock_e_date":"",
         "eta_note":"",
         "cod_date":"",
         "cost_name":"",
         "cost_amt":"",
         "cost_ccy":"",
         "ticket_ref_no":"",
         "remarks":"",
         "bl_no":"",
         "l_port":"",
         "etd":"",
         "d_port":"",
         "d_nor":"",
         "cc_date":"",
         "do_date":"",
         "stock_brand":"",
         "stock_spec":"",
         "cargo_ops_id":39833,
         "delivery_rule":"",
         "link_phy_trade_id":"",
         "stock_contract_qty":1000
      }
   ],
   "s_date":"2023-01-01",
   "e_date":"2023-12-15"date":"2023-01-01",
   "e_date":"2023-12-15",
   "phy_products":[
      
   ]
}

Schema

...

Code Block
s_date, e_date - string
  • Filter the stocks according to the given date range ( s_date = start date, e_date = end date )

Code Block
phy_trade_ids - array[number]

  • The physical trade id/s that will be updated ( when the valid id is parsed, the trade’s stock details will be updated ( stock quantity, un-stock quantity etc.) )

Code Block
insert_list - array[object]

Code Block
update_list - array[object]

Response:

Delete Stock Details

...

DELETE/smartfin/api/v1/stockmgmt/delete

Deletes single / multiple stock details according to its stock_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":[1004],
   "phy_products":[
]
}

Schema

...

,

...

  

...

  • Filter the stocks according to the given date range ( s_date = start date, e_date = end date )

...

 "phy_trade_ids

...

  • The physical trade id/s that will be updated ( when the valid id is parsed, the trade’s stock details will be updated ( stock quantity, un-stock quantity etc.) )

Code Block
insert_list - array[object]

  • Contain the same parameters as stmg in response body of ( Please refer to the request body above for the required parameters that needs to be included into request )

  • stock_id does not need to be parsed and not required in this array

  • Consists of new stock detail/s to be inserted into database.

Code Block
update_list - array[object]

...

Contain the same parameters as items in response body of ( Please refer to the request body above for the required parameters that needs to be included into request )

...

":[54794],
   "s_date":"2023-01-01",
   "e_date":"2023-12-15",
   "pair_types":[]
}
Code Block
del_ids - array[integer]
  • An array that consists unique stock_id, that user would like to delete from.

Code Block
phy_trade_ids - array[number]
  • The physical trade id/s that will be updated ( when the valid id is parsed, the trade’s stock details will be updated ( stock quantity, un-stock quantity etc.) )

Response: