Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 15 Current »

Base Url: /smartfin/api/v1/whitelist


Retrieve Company Data


GET /smartfin/api/v1/whitelist

Get all company data that are visible to current user.

Authentication / Authorization

  • API Key

Headers

Schema


Headers:

  • Content-Type: application/json

Authorization:

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

Responses

Example:

{
    "error_code": 0,
    "value": {
        "items": [
            {
                "last_update_time": "2020-07-20 10:33:45",
                "user_id": 10,
                "entity_id": 2905,
                "create_by_name": "test10",
                "entity_name": "name",
                "entity_type": "",
                "country": "country",
                "address": "address",
                "company_id": 1,
                "create_time": "2020-07-20 10:33:45",
                "create_by": 10,
                "update_by": "",
                "tel": "tel",
                "credit_amt": "",
                "invoice_code": "",
                "invoice_add": "",
                "invoice_bank": "",
                "reg_no": "",
                "credit_ccy": "",
                "fax_no": "",
                "invalid": "",
                "update_by_name": "",
                "email": "email@example.com"
            },
            {
                "last_update_time": "2020-07-20 10:29:33",
                "user_id": 10,
                "entity_id": 2901,
                "create_by_name": "test10",
                "entity_name": "name",
                "entity_type": "",
                "country": "country",
                "address": "address",
                "company_id": 1,
                "create_time": "2020-07-20 10:29:33",
                "create_by": 10,
                "update_by": "",
                "credit_amt": "",
                "invoice_code": "",
                "invoice_add": "",
                "invoice_bank": "",
                "reg_no": "",
                "credit_ccy": "",
                "fax_no": "",
                "invalid": "",
                "tel": "tel",
                "update_by_name": "",
                "email": "email@example.com"
            },
            ..
        ],
        "company_type": [
            "OWNER",
            "COUNTERPARTY"
        ],
        "broker": [
            "VANTAGE",
            "BGC",
            "STEEM1961",
            "SSY"
        ],
        "company_name": [
            "VITOL SA",
            "name",
            "xyz",
            "HYUNDAI",
            "BRITISH AIRWAYS",
            "CHINA AVIATION OIL (SINGAPORE) CORPORATION LTD",
            "yyyy",
            "updated name2",
            "SC SHIPPING",
            "qqq",
            "updated name",
            "aaaaa",
            "PTT"
        ]
    }
}

Returns

  • a list of objects named items, each representing a company (in descending order of entity_id)

  • a list of company_names present in the data

  • a list of company_types present in the data

  • a list of brokers present in the data

Schema


last_update_time, update_by_name, update_by - string

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

create_time, create_by, create_by_name - string

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

user_id, entity_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 company data.

  • company_id - The main company Id for the data.

entity_name, entity_type - string
  • entity_name - Company name

  • entity_type - Company type (COUNTERPARTY or BROKER)

entity_name and entity_type cannot be duplicated,

  • Eg. entity_name of 'COMPANY NAME' will not allow to be stored if the same entity_name has been found in database.

  • Eg. entity_name of ‘COMPANY NAME' and entity_type of 'COUNTERPARTY’ will not allow to be stored if the same entity_name and entity_type has been found in database.

address, email, tel, country, credit_amt, invoice_code, invoice_add, invoice_bank,
reg_no, credit_ccy, fax_no - string

Extra information of the company data

invalid - boolean

The status of company data (true or false)

Update / Insert Company Data


POST /smartfin/api/v1/whitelist

Insert new or update existing company 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:

{
   "insert_list":[
      {
         "entity_name":"TEST_COMPANY_NAME",
         "entity_type":"COUNTERPARTY",
         "address":"2",
         "email":"2",
         "tel":"3",
         "fax_no":"3",
         "country":"",
         "credit_amt":"",
         "credit_ccy":"",
         "invoice_code":"",
         "invoice_add":"",
         "invoice_bank":"",
         "reg_no":"",
         "invalid":""
      }
   ],
   "update_list":[
      {
         "entity_id":261472,
         "entity_name":"TEST_COMPANY_3",
         "entity_type":"BROKER",
         "address":"",
         "email":"",
         "tel":"",
         "fax_no":"",
         "country":"",
         "credit_amt":"",
         "credit_ccy":"",
         "invoice_code":"",
         "invoice_add":"",
         "invoice_bank":"",
         "reg_no":"",
         "invalid":""
      }
   ]
}

Schema


insert_list - array[object]

update_list - array[object]

Response

Example:

{
    "error_code": 0,
    "value": {
        "insert_list": [
            {
                "entity_id": 261485,
                "company_id": 119,
                "entity_name": "TEST_COMPANY_NAME",
                "entity_type": "COUNTERPARTY",
                "address": "2",
                "email": "2",
                "tel": "3",
                "country": "",
                "create_by": 2,
                "create_time": "2023-11-07 14:59:42",
                "update_by": "",
                "last_update_time": "2023-11-07 14:59:42",
                "user_id": 2,
                "credit_amt": "",
                "invoice_code": "",
                "invoice_add": "",
                "invoice_bank": "",
                "reg_no": "",
                "credit_ccy": "",
                "fax_no": "3",
                "invalid": "",
                "create_by_name": "test2",
                "update_by_name": ""
            }
        ],
        "update_list": {
            "updated": [
                {
                    "entity_id": 261472,
                    "company_id": 119,
                    "entity_name": "TEST_COMPANY_3",
                    "entity_type": "BROKER",
                    "address": "",
                    "email": "",
                    "tel": "",
                    "country": "",
                    "create_by": 2,
                    "create_time": "2023-11-02 14:39:54",
                    "update_by": 2,
                    "last_update_time": "2023-11-07 14:59:42",
                    "user_id": 2,
                    "credit_amt": "",
                    "invoice_code": "",
                    "invoice_add": "",
                    "invoice_bank": "",
                    "reg_no": "",
                    "credit_ccy": "",
                    "fax_no": "",
                    "invalid": "",
                    "create_by_name": "test2",
                    "update_by_name": "test2"
                }
            ],
            "failed": []
        }
    }
}

Schema


insert_list - array[object]

update_list - object
updated - array[object]
failed - array[object]
  • Contain the same parameters as items in response body of https://mafint.atlassian.net/wiki/spaces/MAD/pages/2128150536/Entity+Management#Responses ( Refer to the definition of each parameter )

  • updated consists of data that has been updated successfully ,where failed consists of data that has not been updated in database.

  • The relevant error message will be returned if there are any duplicated data attempting to insert or update into the database.

Insert process would fail if there is an existing company with the same entity_name, entity_type or same entity_name

Update process would fail if there is an existing company with the same entity_name, entity_type or same entity_name

Delete Company


DELETE /smartfin/api/v1/whitelist

Deletes single / multiple company according to its entity_id

Authentication / Authorization

  • API Key

Headers

Schema


Headers:

  • Content-Type: application/json

Authorization:

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

Request

Example:

JSON Body:

{
  "del_id_list":[261485]
}
del_id_list - array
  • A list that consists of unique entity_id, that user would like to delete from.

Response:

Example:

{
  "error_code": 0,
  "value": [
    {
      "entity_id": 261485
    }
  ]
}
  • Return a list of object named value, each object contains entity_id that indicates the company that has been deleted successfully.

  • No labels