Skip to content

Map State Codes

Overview:

The Map State Code API enables the creation, retrieval, updating, and deletion of state code mappings. This documentation provides detailed information on the endpoints, request and response formats, and field descriptions.

Create:

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

This API will create a new map state code.

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

Request Body:

json
{
    "data_set": "<data-set>",                 //string
    "src_ccty": "<Source-Country-Code>",      //string
    "src_cste": "<Source-State-Code>",        //string
    "src_dsca": "<Source-State-Description>" //string
}

Fields Details:

Field NameDescriptionData TypeLength
data_setData SetString10
src_cctySource Country CodeString3
src_csteSource State CodeString3
src_dscaSource State DescriptionString120

Response Body: (Status: 200)

json
{
    "data_set": "<data-set>", 
    "src_ccty": "<Source-Country-Code>",
    "src_cste": "<Source-State-Code>",
    "src_dsca": "<Source-State-Description>"
}

Field Details:

Field NameDescriptionData TypeExample
data_setData SetString"Dataset1"
src_cctySource Country CodeString"IND"
src_csteSource State CodeString"02"
src_dscaSource State DescriptionString"KUL"

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 Payload)

When passing invalid data to state code:

json
{
    "message": "Reference Error: State Code"
}

Response Body: (Status: 400 - Bad Request/ Invalid Payload)

When passing invalid data to country code:

json
{
    "message": "Reference Error: Country Code."
}

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 country code:

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

When passing an empty field as input to the source state code:

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

when passing an empty field as input to dataset:

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

Update:

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

This API will update the specified map state code.

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

Request Body:

json
{
    "data_set": "<data-set>",                   //string
    "src_ccty": "<Source-Country-Code>",        //string
    "src_cste": "<Source-State-Code>",          //string
    "src_dsca": "<Source-State-Description>"   //string
}

Response Body: (Status: 200)

json
{
    "data_set": "<data-set>",  
    "src_ccty": "<Source-Country-Code>",
    "src_cste": "<Source-State-Code>",
    "src_dsca": "<Source-State-Description>"
}

Response Body: (Status: 401 - Unauthorized / Invalid Token)

When there is no token /invalid token passed or When Normal User tries to update the 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 Payload)

When passing invalid data to state code:

json
{
    "message": "Reference Error: State Code"
}

Response Body: (Status: 400 - Bad Request/ Invalid Payload)

When passing invalid data to country code:

json
{
    "message": "Reference Error: Country Code."
}

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 country code:

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

When passing an empty field as input to the source state code:

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

when passing an empty field as input to dataset:

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

Delete:

Endpoint: /api/message/map_state_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/map_state_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>",  
    "ccty_dsca": "<Country-Description>",
    "dsca": "<State-Description>",
    "src_ccty": "<Source-Country-Code>",
    "src_cste": "<Source-State-Code>",
    "src_dsca": "<Source-State-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/map_state_codes/{ Company }/{ PageSize }/{ PageNumber }

This API retrieves all records.

  • Method: GET
  • Authentication: Bearer <token>

Response Body: (Status: 200)

json
[
    {
        "data_set": "<data-set>",  
        "ccty_dsca": "<Country-Description>",
        "dsca": "<State-Description>",
        "src_ccty": "<Source-Country-Code>",
        "src_cste": "<Source-State-Code>",
        "src_dsca": "<Source-State-Description>"
    }
]

Response Body: (Status: 401 - Unauthorized / Invalid Token)

When there is no token or invalid token passed :

json
{
    "message": "Unauthorized!"
}