That is great. Thanks Salah. This works!
Original Message:
Sent: Thu February 29, 2024 03:07 AM
From: Salah Hassan
Subject: Getting unique key in the REST response in case of error
Hi Suhas,
This can be achieved by making use of Bulkid by passing it in the payload, we will receive it back in the response along with the metadata.
Payload
[ { "_data": { "assetnum": "PIPE-32-T-5443", "worktype": "PM", "pmnum": "3442211", "status": "WAPPR", "reportedby": "SALAH", "targstartdate": "2022-08-14T20:40:56+00:00", "targcompdate": "2022-08-17T04:59:59+00:00", "siteid": "BEDFORD", "_bulkid": "93890eurv4rt4" } }, { "_data": { "assetnum": "PIPE-32-T-5444", "worktype": "PM", "pmnum": "3442211", "status": "WAPPR", "reportedby": "SALAH", "targstartdate": "2022-08-14T20:40:56+00:00", "targcompdate": "2022-08-17T04:59:59+00:00", "siteid": "BEDFORD", "_bulkid": "63890DDhv4rtRR5" } }]
Reponse with error :
[ { "_responsedata": { "Error": { "extendedError": { "moreInfo": { "href": "http://localhost/maximo/api/error/messages/BMXZZ9553I" } }, "reasonCode": "BMXZZ9553I", "message": "BMXZZ9553I - Please provide a Valid Asset Number for Creating the Workorder.", "statusCode": "400" } }, "_responsemeta": { "_bulkid": "93890eurv4rt4", "status": "400" } }, { "_responsedata": { "Error": { "extendedError": { "moreInfo": { "href": "http://localhost/maximo/api/error/messages/BMXZZ9553I" } }, "reasonCode": "BMXZZ9553I", "message": "BMXZZ9553I - Please provide a Valid Asset Number for Creating the Workorder.", "statusCode": "400" } }, "_responsemeta": { "_bulkid": "63890DDhv4rtRR5", "status": "400" } }]
I have written about this functionality in detail in my blogpost :maximo-bulkload-rest-api
I am also attaching a postman collection with sample payloads for add, update and delete.
Please reach out if you need further info on the same.
------------------------------
Salah Hassan
Consultant
Infosys
9746885191
Original Message:
Sent: Tue February 27, 2024 03:18 AM
From: Suhas Joshi
Subject: Getting unique key in the REST response in case of error
Hi,
We have a requirement where we are sending data updates through BULK operation using REST call. If all the records are processed successfully we are good. However, if some of the records do not get processed because of any Maximo validations (such as asset does not exists), can we add the unique key reference (in this case assetnum) in the error response?
Right now we just see a message saying "Asset record does not exist" but it does not tell which assetnum does not exist. Any pointers?
Thanks,
Suhas
------------------------------
Suhas Joshi
Pune
------------------------------