Appearance
Measurement Unit
Overview:
The Unit of Measurement API allows you to create, retrieve, update, and delete unit of measurement information. This document provides detailed information about the endpoints, request and response formats, and field descriptions.
Create:
Endpoint: /api/message/uom_codes/{ Company }
This API will create a new record.
- Method: POST
- Content-Type: application/json
- Authentication: Bearer
<token>
Request Body:
json
{
"data_set": "<data-set>", //string
"src_unit": "<Source-UOM>", //string
"src_dsca": "<Source-Description>" //string
}Fields Details:
| Field Name | Description | Data Type | Length |
|---|---|---|---|
| data_set | Data Set | String | 5 |
| src_unit | Source UOM | String | 3 |
| src_dsca | Source Description | String | 120 |
Response Body: (Status: 200)
json
{
"data_set": "<data-set>",
"src_dsca": "<Source-Description>",
"src_unit": "<Source-Unit>"
}Fields Details:
| Field Name | Description | Data Type | Example |
|---|---|---|---|
| data_set | Data Set | String | "Dataset1" |
| src_dsca | Source Description | String | "sample description" |
| src_unit | Source UOM | String | "LOR" |
Response Body: (Status: 401 - Unauthorized / Invalid Token)
When there is no token / invalid token passed or When Normal User tries to create a new record :
json
{
"message": "Unauthorized!"
}Response Body: (Status: 400 - Bad Request / Duplicate)
When the record is already present in the database:
json
{
"message": "Record already exists!"
}Response Body: (Status: 400 - Bad Request / Invalid Datatype)
When passing a record with invalid datatype:
json
{
"message": "Invalid Data Type"
}Response Body: (Status: 500 - Internal Server Error / Empty field)
When passing an empty field as input to the source Unit:
json
{
"message": "Validation Errors|Validation 'isNotEmpty' failed for field 'src_unit'"
}when passing an empty field as input to dataset:
json
{
"message": "Validation Errors|Validation 'isNotEmpty' failed for field 'data_set'"
}Update:
Endpoint: /api/message/uom_codes/{ Company }
This API will update the existing record.
- Method: PUT
- Content-Type: application/json
- Authentication: Bearer
<token>
Request Body:
json
{
"data_set": "<data-set>", //string
"src_unit": "<Source-UOM>", //string
"src_dsca": "<Source-Description>" //string
}Response Body: (Status: 200)
json
{
"data_set": "<data-set>",
"src_dsca": "<Source-Description>",
"src_unit": "<Source-Unit>"
}Response Body: (Status: 401 - Unauthorized / Invalid Token)
When there is no token / invalid token passed or When normal user tries to create a new record :
json
{
"message": "Unauthorized!"
}Response Body: (Status: 400 - Bad Request/ Not Found)
When the specified record is not found:
json
{
"message": "Record not found!"
}Response Body: (Status: 400 - Bad Request / Invalid Datatype)
When passing a record with invalid datatype:
json
{
"message": "Invalid Data Type"
}Response Body: (Status: 500 - Internal Server Error / Empty field)
When passing an empty field as input to source unit:
json
{
"message": "Validation Errors|Validation 'isNotEmpty' failed for field 'src_unit'"
}when passing an empty field as input to dataset:
json
{
"message": "Validation Errors|Validation 'isNotEmpty' failed for field 'data_set'"
}Delete:
Endpoint: /api/message/uom_codes/{ Company }/{ record_id }
This API will delete the specified record id.
- Method: DELETE
- Authentication: Bearer
<token>
Response Body: (Status: 200)
json
{
"Message": "Message Deleted Sucessfully!"
}Response Body: (Status: 401 - Unauthorized / Invalid Token)
When there is no token / invalid token passed or When Normal user tries to delete the existing record:
json
{
"message": "Unauthorized!"
}Response Body: (Status: 500 - Internal Server Error / Invalid Record)
When there is no record or invalid record passed:
json
{
"Message": "Unable to Delete Record - Invalid Data Type"
}Get:
Endpoint: /api/message/uom_codes/{ Company }/{ record_id }
This API retrieves the specified record id.
- Method: GET
- Authentication: Bearer
<token>
Response Body: (Status: 200)
json
{
"data_set": "<data-set>",
"dsca": "<Description>",
"src_ccur": "<source-currency-code>",
"src_dsca": "<source-currency-description>"
}Response Body: (Status: 200 - Success Status/Invalid id)
When there is no such id or invalid id is passed :
json
{
"message": "null"
}Response Body: (Status: 401 - Unauthorized / Invalid Token)
When there is no token or invalid token passed :
json
{
"message": "Unauthorized!"
}Get All:
Endpoint: /api/messages/uom_codes/{ Company }/{ PageSize }/{ PageNumber }
This API retrieves all records.
- Method: GET
- Authentication: Bearer
<token>
Response Body: (Status: 200)
json
[
{
"data_set": "<data-set>",
"dsca": "<Description>",
"src_dsca": "<Source-Description>",
"src_unit": "<Source -Unit>"
}
]Response Body: (Status: 401 - Unauthorized / Invalid Token)
When there is no token or invalid token passed :
json
{
"message": "Unauthorized!"
}