Maximo

 View Only
  • 1.  Getting unique key in the REST response in case of error

    Posted Tue February 27, 2024 03:19 AM

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


  • 2.  RE: Getting unique key in the REST response in case of error

    Posted Thu February 29, 2024 03:08 AM
    Edited by Salah Hassan Thu February 29, 2024 03:08 AM
      |   view attached

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

    Attachment(s)



  • 3.  RE: Getting unique key in the REST response in case of error

    Posted Thu February 29, 2024 04:26 AM

    That is great. Thanks Salah. This works!



    ------------------------------
    Suhas Joshi
    Pune
    ------------------------------