Skip to content

Item Classification via GL

Overview

The GL Codes API enables the creation, retrieval, updating, and deletion of GL codes records. This documentation provides detailed information on the endpoints, request and response formats, and field descriptions.

Create

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

This API will create a new GL code.

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

Request Body:

json
{
    "data_set": "<Data-set>",                    //string
    "src_leac": "<Source-Ledger-Account>",       //String
    "src_dsca": "<Source-Description>",          //string
}

Fields Details:

Field NameDescriptionData TypeLength
data_setData SetString10
src_leacSource Ledger AccountString12
src_dscaSource DescriptionString120

Response Body: (Status: 200)

json
{
    "data_set": "<Data_set>", 
    "src_leac": "<Source-Ledger-Account>",
    "src_dsca": "<Source-Description>",
}

Fields Details:

Field NameDescriptionData TypeExample
data_setData SetString"Dataset1"
src_leacSource Ledger AccountString"1543289"
src_dscaSource DescriptionString"Factory"

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 Source Ledger Account is already present in the database:

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

Response Body: (Status: 400 - Bad Request)

When invalid or wrong Classification code is passed:

json
{
    "message": "Reference Error: Classification codes."
}

Response Body: (Status: 400 - Bad Request)

When invalid or wrong Data set is passed:

json
{
    "message": "Reference Error"
}

Response Body: (Status: 400 - Bad Request)

When there is an invalid data type is passed:

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

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 'src_leac'"
}

Update

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

This API will update a GL codes.

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

Request Body:

json
{
    "data_set": "<Data-set>",                    //string
    "src_leac": "<Source-Ledger-Account>",       //String
    "src_dsca": "<Source-Description>",          //string
}

Response Body: (Status: 200)

json
{
    "data_set": "<Data_set>", 
    "src_leac": "<Source-Ledger-Account>",
    "src_dsca": "<Source-Description>", 
}

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 Source Ledger Account:

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

Response Body: (Status: 400 - Bad Request)

When invalid or wrong Classification code is passed:

json
{
    "message": "Reference Error: Classification codes."
}

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 'src_leac'"
}

Delete

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

This API will delete a GL codes.

  • 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 GL codes id is paased:

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

Get

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

This API will get a GL code.

  • Method: GET
  • Authentication: Bearer <token>

Response Body: (Status: 200)

json
{
    "ccode": "<Classification-code>",
    "data_set": "<Data_set>", 
    "dsca": "<Description>",
    "src_leac": "<Source-Ledger-Account>",
    "src_dsca": "<Source-Description>", 
}

Response Body: (Status: 200)

When invalid or wrong GL codes 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/gl_codes/{ Company }/{ PageSize }/{ PageNumber }

This API will get all GL codes.

  • Method: GET
  • Authentication: Bearer <token>

Response Body: (Status: 200)

json
[
   {
    "ccode": "<Classification-code>",
    "data_set": "<Data_set>", 
    "dsca": "<Description>",
    "src_leac": "<Source-Ledger-Account>",
    "src_dsca": "<Source-Description>",   
   },
   .
   .
   .
]

Response Body: (Status: 401 - Unauthorized)

When there is no token or invalid token passed:

json
{
    "message": "Unauthorized!"
}