Define a JSON parser in automation script using native Java hashmap libraries. Call the API endpoint of the service and map the response bytes with MBO and external data.
You may need to import the security certificate of the API endpoints though to ensure Maximo establishes the connection with the API end point.
Here is one example where I read the JSON data of Work order from an external system ( tasknum, district, eqtag, station) and mapped it with WO MBO fields.
I hope this helps
responseBytes = handler.invoke(map,None)
response = String(responseBytes,"utf-8")
# raise TypeError(response)
object = JSONObject.parse(response)
message = object.get('message')
data = object.get('data')
if(message.get('code') == 0):
if(data is not None):
mbo.setValue("WONUM",str(data.get("tasknum")),11L)
mbo.setValue("SITEID",str(data.get("district")),11L)
mbo.setValue("ASSETNUM",str(data.get("eqtag")),11L)
mbo.setValue("LOCATION",str(data.get("station")),11L)
#mbo.getThisMboSet().save()
Thanks
Kushal
'The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com' Internal - General Use
Original Message:
Sent: 1/24/2024 5:35:00 AM
From: Biswaranjan Mishra
Subject: how to read the JSON data through automation script (user exit automation script)
Hi All - Currently I am developing one custom API where I can get the data from external system and I mapped that value to with a maximo existing attribute using JSON mapping. Could any one please tell me how to read the JSON data through automation script (user exit automation script)
Regards,
Biswa
------------------------------
Biswaranjan Mishra
------------------------------