Using the ODATA Rest API we are trying to make a batch call with 2 operations in the same call.
- Insert a new record in the calendar exception
- Change task status
We have used an incorrect task status value to ensure the call fails but even though this call fails the 1st call is successful and not rolled back. The operation in the change sets should be atomic.
Request :
--batch_d3bcb804-ee77-4921-9a45-761f98d32029
--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621
Content-Type: application/http
Content-Transfer-Encoding: binary
POST https://tsrvwapp1497.tdk.dk/IFS_T2FSM_Application/odata/person_cal_except HTTP/1.1
Content-Type: application/json
Content-ID: 3
{
"person_id" : "A72033",
"exception_type" : "DRIFT AF BIL",
"start_dttm" : "2021-10-24T13:12:42.7997002",
"end_dttm" : "2021-10-25T14:12:42.7997002",
"modified_by" : "A72033",
"created_by" : "A72033"
}
--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621
Content-Type: application/http
Content-Transfer-Encoding: binary
PATCH https://tsrvwapp1497.tdk.dk/IFS_T2FSM_Application/odata/task(83581) HTTP/1.1
Content-Type: application/json
Content-ID: 4
{
"task_status": "ENROUTE123",
"status_as_of": "2021-10-26T15:37:37.0047496",
"user_def109": "",
"modified_by": "A72033"
}
--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621--
--batch_d3bcb804-ee77-4921-9a45-761f98d32029
Response :
--batchresponse_fe17b595-700c-48d5-8c9a-d5e455e71c0c
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 201 Created
Location: https://tsrvwapp1497.tdk.dk/IFS_T2FSM_Application/odata/person_cal_except
Content-Type: application/json; odata.metadata=minimal
OData-Version: 4.0
{"@odata.context":"https://tsrvwapp1497.tdk.dk/IFS_T2FSM_Application/OData/$metadata#PERSON_CAL_EXCEPT/$entity","available":"N","count_as_capacity":"N","created_by":"A72033","created_dttm":"2021-11-15T16:02:22.4889549","description":"(15) Drift af bil/IT-udstyr","end_dttm":"2021-10-25T14:12:42.7997002","exception_id":19418,"exception_type":"DRIFT AF BIL","fixed_commitment":"N","modified_by":"A72033","modified_dttm":"2021-11-15T16:02:22.5149582","person_id":"A72033","start_dttm":"2021-10-24T13:12:42.7997002"}
--batchresponse_fe17b595-700c-48d5-8c9a-d5e455e71c0c
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=utf-8
{"Message":"Invalid value of ENROUTE123 for column Task Task Status.\n\r\n"}
--batchresponse_fe17b595-700c-48d5-8c9a-d5e455e71c0c--