Rejected Records

Visibility to Rejections

There are two ways in which records that are rejected will be surfaced. The first two below occur at the time of initial response. The third one is encountered after the task has entered the processing stage.

  1. Initial rejections - at the time of submitting a payload (of any size), preliminary validation will run on the payload and if any aspect of the payload fails validation, the entire payload will be rejected with the specific problematic records being highlighted. The resolution would be to fix or drop the problematic records and resend the entire payload. No tasks are generated at this time due to the initial validation failing.
HTTP 422 Unprocessable Content

{
    "Status": "Rejected",
    "RejectedRecords": [
        {
            "Record": {
                "ItemCode": "item1",
                "LocationCode": "loc1",
              	"ItemType": "",
								...
            },
            "Reasons": [
                "ItemType must be between 0 and 1 character.' (path: ItemType)"
            ]
        }
    ]
}
HTTP 202 Accepted
{
    "Status": "Received",
    "TaskId": "c81936e3-e41c-455a-bb9c-055e3c1b395c"
}
  1. Loader processing rejections - these occur after a Task ID has been assigned and a payload is being processed by GAINS. When querying all tasks or specific tasks, the response payload contains RejectedRecords which is further described in the next section.

Structure of Rejected Records

When a task contains records that were rejected by the core application loaders, it will result in a response payload contained a RejectedRecords array containing the rejected records with associated rejection reasons.

RejectedRecords is an array of objects composed of:

  • Record object that specifies the original record that encountered a failure. The example below shows an entire Customer record that was rejected
  • Reasons which is an array of strings with 1..n rejection reasons
"RejectedRecords": [
  {
    "Record": {
      "CustomerCode": "string",
      "Name": "string",
      "ShipToCode": "string",
      "ShipFromIdealLocationCode": "string",
      "Address1": "string",
      "Address2": "string",
      "City": "string",
      "State": "string",
      "Country": "string",
      "PostalCode": "string",
      "Latitude": 0,
      "Longitude": 0,
      "StartDate": "2024-06-05",
      "EndDate": "2024-06-05",
      "NearestLocation": "string"
    },
    "Reasons": [
      "string"
    ]
  }
]

If there are multiple reasons for rejecting a record, the Reasons array will reflect as follows:

"Reasons": [
    "Reason1",
    "Reason2"
]