Appearance
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 Name | Description | Data Type | Length |
|---|---|---|---|
| data_set | Data Set | String | 10 |
| buy_code | Buyer Code | String | 9 |
| buy_name | Buyer | String | 300 |
| buy_tin | TIN | String | 14 |
| buy_reg_nric | NRIC | String | 12 |
| buy_reg_brn | Registration Number | String | 20 |
| buy_reg_passport | Passport Number | String | 12 |
| buy_reg_army | Army Identification | String | 12 |
| buy_sst | SST Applicable? | Boolean | 1 |
| buy_sst_reg | SST Registration | String | 17 |
| buy_email | E-mail Address | String | 320 |
| buy_cont_num | Contact Number | String | 15 |
| buy_adrs | Address Code | String | 9 |
| buy_comp_active | Status | Boolean | 1 |
| buy_msic | MSIC Code | String | 5 |
| buy_badsca | Business Activity | String | 300 |
| buy_ttx | Tourism Applicable? | Boolean | 1 |
| buy_ttx_reg | Tourism Tax Number | String | 17 |
| conso_buyer | Consolidation Buyer | Boolean | 1 |
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 Name | Description | Data Type | Example |
|---|---|---|---|
| buy_adrs | Address Code | String | "ACTR01" |
| buy_badsca | Business Activity | String | "Growing of maize" |
| buy_code | Buyer Code | String | "AAPR01" |
| buy_comp_active | Status | Boolean | true |
| buy_cont_num | Contact Number | String | "456782" |
| buy_email | E-mail Address | String | "Test@gmail.com" |
| buy_msic | MSIC Code | String | "01111" |
| buy_name | Buyer | String | "AAB PRODUCTS SDN BHDN" |
| buy_reg_army | Army Identification | String | "45773" |
| buy_reg_brn | Registration Number | String | "267895" |
| buy_reg_nric | NRIC | String | "98765" |
| buy_reg_passport | Passport Number | String | "5678032" |
| buy_sst | SST Applicable? | Boolean | true |
| buy_sst_reg | SST Registration | String | "876342" |
| buy_tin | TIN | String | "1234765" |
| buy_ttx | Tourism Applicable? | Boolean | false |
| buy_ttx_reg | Tourism Tax Number | String | "984532" |
| data_set | Data Set | String | "Dataset1" |
| conso_buyer | Consolidation Buyer | Boolean | 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 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!"
}