Skip to content

Buyer Companies

Overview

The Buyer Companies API enables the creation, retrieval, updating, and deletion of buyer company records. This documentation provides detailed information on the endpoints, request and response formats, and field descriptions.

Create

Endpoint: /api/message/buyer_companies/{ Company }

This API will create a new Buyer company.

  • Method: POST
  • Content-Type: application/json
  • Authentication: Bearer <token>

Request Body:

json
{
    "data_set": "<Data-set>",                       //string
    "buy_code": "<buyer-code>",                     //string
    "buy_name": "<buyer-name>",                     //string
    "buy_tin": "<buyer-TIN>",                       //string
    "buy_reg_nric": "<buyer-NRIC>",                 //string
    "buy_reg_brn": "<buyer-register-number>",       //string
    "buy_reg_passport": "<buyer-passport-number>",  //string
    "buy_reg_army": "<buyer-army-identification>",  //string
    "buy_sst": true ,                               //boolean
    "buy_sst_reg": "<buyer-SST-registration>",      //string
    "buy_email": "<buyer-email-address>",           //string
    "buy_cont_num": "<buyer-contact-number>",       //string
    "buy_adrs": "<buyer-address-code>",             //string
    "buy_comp_active": true ,                       //boolean
    "buy_msic": "<buyer-MSIC-code>",                //string
    "buy_badsca": "<buyer-business-activity>",      //string
    "buy_ttx": true ,                               //boolean
    "buy_ttx_reg": "<buyer-tourism-tax-number>",    //string
    "conso_buyer": true                             //boolean
}

Fields Details:

Field NameDescriptionData TypeLength
data_setData SetString10
buy_codeBuyer CodeString9
buy_nameBuyerString300
buy_tinTINString14
buy_reg_nricNRICString12
buy_reg_brnRegistration NumberString20
buy_reg_passportPassport NumberString12
buy_reg_armyArmy IdentificationString12
buy_sstSST Applicable?Boolean1
buy_sst_regSST RegistrationString17
buy_emailE-mail AddressString320
buy_cont_numContact NumberString15
buy_adrsAddress CodeString9
buy_comp_activeStatusBoolean1
buy_msicMSIC CodeString5
buy_badscaBusiness ActivityString300
buy_ttxTourism Applicable?Boolean1
buy_ttx_regTourism Tax NumberString17
conso_buyerConsolidation BuyerBoolean1

Response Body: (Status: 200)

json
{
        "buy_adrs": "<buyer-address>",
        "buy_badsca": "<buyer-business-activity>",
        "buy_code": "<buyer-code>",
        "buy_comp_active": true,
        "buy_cont_num": "<buyer-contact-number>",
        "buy_email": "<buyer-email-address>",
        "buy_msic": "<buyer-MSIC-code>",
        "buy_name": "<buyer-name>",
        "buy_reg_army": "<buyer-army-identification>",
        "buy_reg_brn": "<buyer-register-number>",
        "buy_reg_nric": "<buyer-NRIC>",
        "buy_reg_passport": "<buyer-passport-number>",
        "buy_sst": false,
        "buy_sst_reg": "<buyer-SST-registration>",
        "buy_tin": "<buyer-TIN>",
        "buy_ttx": false,
        "buy_ttx_reg": "<buyer-tourism-tax-number",
        "data_set": "<Data-set>",
        "conso_buyer": true,
}

Fields Details:

Field NameDescriptionData TypeExample
buy_adrsAddress CodeString"ACTR01"
buy_badscaBusiness ActivityString"Growing of maize"
buy_codeBuyer CodeString"AAPR01"
buy_comp_activeStatusBooleantrue
buy_cont_numContact NumberString"456782"
buy_emailE-mail AddressString"Test@gmail.com"
buy_msicMSIC CodeString"01111"
buy_nameBuyerString"AAB PRODUCTS SDN BHDN"
buy_reg_armyArmy IdentificationString"45773"
buy_reg_brnRegistration NumberString"267895"
buy_reg_nricNRICString"98765"
buy_reg_passportPassport NumberString"5678032"
buy_sstSST Applicable?Booleantrue
buy_sst_regSST RegistrationString"876342"
buy_tinTINString"1234765"
buy_ttxTourism Applicable?Booleanfalse
buy_ttx_regTourism Tax NumberString"984532"
data_setData SetString"Dataset1"
conso_buyerConsolidation BuyerBooleantrue

Response Body: (Status: 401 - Unauthorized)

When there is no token or invalid token passed:

json
{
    "message": "Unauthorized!"
}

Response Body: (Status: 400 - Bad Request)

When both the Data set and Buyer code is already present in the database:

json
{
    "message": "Record already exists!"
}

Response Body: (Status: 400 - Bad Request)

When there is an invalid data type is passed:

json
{
    "message": "Invalid Data Type"
}

Response Body: (Status: 400 - Bad Request)

When invalid or wrong Data set is passed:

json
{
    "message": "Reference Error"
}

Response Body: (Status: 500 - Internal Server Error)

When the mandatory fields are passed as an empty field:

json
{
    "message":  "Validation Errors|Validation 'isNotEmpty' failed for field 'data_set'|Validation 'isNotEmpty' failed for field 'buy_nama'"
}

Update

Endpoint: /api/message/buyer_companies/{ Company }

This API will update a Buyer company.

  • Method: PUT
  • Content-Type: application/json
  • Authentication: Bearer <token>

Request Body:

json
{
    "buy_code": "<buyer-code>",                     //string
    "buy_name": "<buyer-name>",                     //string
    "buy_tin": "<buyer-TIN>",                       //string
    "buy_reg_nric": "<buyer-NRIC>",                 //string
    "buy_reg_brn": "<buyer-register-number>",       //string
    "buy_reg_passport": "<buyer-passport-number>",  //string
    "buy_reg_army": "<buyer-army-identification>",  //string
    "buy_sst": true ,                               //boolean
    "buy_sst_reg": "<buyer-SST-registration>",      //string
    "buy_email": "<buyer-email-address>",           //string
    "buy_cont_num": "<buyer-contact-number>",       //string
    "buy_adrs": "<buyer-address-code>",             //string
    "buy_comp_active": true ,                       //boolean
    "buy_msic": "<buyer-MSIC-code>",                //string
    "buy_badsca": "<buyer-business-activity>",      //string
    "buy_ttx": true ,                               //boolean
    "buy_ttx_reg": "<buyer-tourism-tax-number>",    //string
    "conso_buyer": true                             //boolean
}

Response Body: (Status: 200)

json
{
        "buy_adrs": "<buyer-address>",
        "buy_badsca": "<buyer-business-activity>",
        "buy_code": "<buyer-code>",
        "buy_comp_active": true,
        "buy_cont_num": "<buyer-contact-number>",
        "buy_email": "<buyer-email-address>",
        "buy_msic": "<buyer-MSIC-code>",
        "buy_name": "<buyer-name>",
        "buy_reg_army": "<buyer-army-identification>",
        "buy_reg_brn": "<buyer-register-number>",
        "buy_reg_nric": "<buyer-NRIC>",
        "buy_reg_passport": "<buyer-passport-number>",
        "buy_sst": false,
        "buy_sst_reg": "<buyer-SST-registration>",
        "buy_tin": "<buyer-TIN>",
        "buy_ttx": false,
        "buy_ttx_reg": "<buyer-tourism-tax-number",
        "data_set": "<Data_set>",
        "conso_buyer": true,
}

Response Body: (Status: 401 - Unauthorized)

When there is no token or invalid token passed:

json
{
    "message": "Unauthorized!"
}

Response Body: (Status: 400 - Bad Request)

When there is an invalid data type is passed:

json
{
    "message": "Invalid Data Type"
}

Response Body: (Status: 400 - Bad Request)

When you are trying to update both the Data set and Buyer code:

json
{
    "message": "Record not found!"
}

Response Body: (Status: 500 - Internal Server Error)

When the mandatory fields are passed as an empty field:

json
{
    "message":  "Validation Errors|Validation 'isNotEmpty' failed for field 'data_set'|Validation 'isNotEmpty' failed for field 'buy_nama'"
}

Delete

Endpoint: /api/message/buyer_companies/{ Company }/{ record_id }

This API will delete a buyer company.

  • Method: DELETE
  • Authentication: Bearer <token>

Response Body: (Status: 200)

json
{
    "Message": "Message Deleted Sucessfully!"
}

Response Body: (Status: 401 - Unauthorized)

When there is no token or invalid token passed:

json
{
    "message": "Unauthorized!"
}

Response Body: (Status: 500 - Internal Server Error)

When invalid or wrong Buyer companies id is paased:

json
{
    "Message": "Unable to Delete Record - Invalid Data Type"
}

Get

Endpoint: /api/message/buyer_companies/{ Company }/{ record_id }

This API will get a buyer company.

  • Method: GET
  • Authentication: Bearer <token>

Response Body: (Status: 200)

json
{
        "buy_adrs": "<buyer-address>",
        "buy_badsca": "<buyer-business-activity>",
        "buy_code": "<buyer-code>",
        "buy_comp_active": true,
        "buy_cont_num": "<buyer-contact-number>",
        "buy_email": "<buyer-email-address>",
        "buy_msic": "<buyer-MSIC-code>",
        "buy_name": "<buyer-name>",
        "buy_reg_army": "<buyer-army-identification>",
        "buy_reg_brn": "<buyer-register-number>",
        "buy_reg_nric": "<buyer-NRIC>",
        "buy_reg_passport": "<buyer-passport-number>",
        "buy_sst": false,
        "buy_sst_reg": "<buyer-SST-registration>",
        "buy_tin": "<buyer-TIN>",
        "buy_ttx": false,
        "buy_ttx_reg": "<buyer-tourism-tax-number",
        "data_set": "<Data_set>",
        "conso_buyer": true,
}

Response Body: (Status: 200)

When invalid or wrong Buyer companies id is paased:

json
{
    "message": "null"
}

Response Body: (Status: 401 - Unauthorized)

When there is no token or invalid token passed:

json
{
    "message": "Unauthorized!"
}

Get All

Endpoint: /api/messages/buyer_companies/{ Company }/{ PageSize }/{ PageNumber }

This API will get all buyer companies.

  • Method: GET
  • Authentication: Bearer <token>

Response Body: (Status: 200)

json
[
    {
        "buy_adrs": "<buyer-address>",
        "buy_badsca": "<buyer-business-activity>",
        "buy_code": "<buyer-code>",
        "buy_comp_active": true,
        "buy_cont_num": "<buyer-contact-number>",
        "buy_email": "<buyer-email-address>",
        "buy_msic": "<buyer-MSIC-code>",
        "buy_name": "<buyer-name>",
        "buy_reg_army": "<buyer-army-identification>",
        "buy_reg_brn": "<buyer-register-number>",
        "buy_reg_nric": "<buyer-NRIC>",
        "buy_reg_passport": "<buyer-passport-number>",
        "buy_sst": false,
        "buy_sst_reg": "<buyer-SST-registration>",
        "buy_tin": "<buyer-TIN>",
        "buy_ttx": false,
        "buy_ttx_reg": "<buyer-tourism-tax-number",
        "data_set": "<Data_set>",
        "conso_buyer": true,
    },
    .
    .
    .
]

Response Body: (Status: 401 - Unauthorized)

When there is no token or invalid token passed:

json
{
    "message": "Unauthorized!"
}