Please start a new message thread. Your topic is completely different than the original question on this thread and that makes it difficult for people to find relevant information when they're on the community.
Original Message:
Sent: Tue August 13, 2024 04:32 AM
From: Kalpana Devaraj
Subject: Track and capture response from Object Structure based REST API
Hi Steven Shull! ,
Good day!
Please provide your assistance with my request.
Getting expected results when a saved query is present in the GET request of the OSLC API based on the business rules:
https://hostname/maximo/oslc/os/objectstructurename?lean=1&oslc.select=*&oslc.pageSize=10&stablepaging=1&savedQuery=getLatestWOUpdates
If the URL does not have a saved query parameter in the GET request of the OSLC API, then I should not return any results, but currently it is returning all the results.
We can customize through a script without launch point whatever we want, but the URL needs to be modified as below, which is not recommended.
https://hostnamet/maximo/oslc/script/scriptname?lean=1
Java customization is also not recommended.
I tried it with the integration script on object structure with outbound definition; overridemethod() got trigered but was unable to take query parameters. If I try to use ctx.getJsonRequest(), getQueryParam("savedQuery"), then I am getting the below error message.
"reasonCode": "BMXAA7837E",
"message": "BMXAA7837E: An error occurred that prevented the OSOUT. WOWWOVENDORAPI script for the null launch point from running.AttributeError: 'NoneType' object has no attribute 'getQueryParam' in <script> at line number 19".
"statusCode": "400"
------------------------------
Kalpana Devaraj
Original Message:
Sent: Mon August 12, 2024 08:38 PM
From: Steven Shull
Subject: Track and capture response from Object Structure based REST API
Yes, from the JSON request you can call getQueryParam("paramname"). Example:
request=ctx.getJsonRequest()
lean=request.getQueryParam("lean")
If you want them all you can call getQueryParams() to get the full hashmap.
------------------------------
Steven Shull
Original Message:
Sent: Fri August 09, 2024 09:49 AM
From: Kalpana Devaraj
Subject: Track and capture response from Object Structure based REST API
Is it possible to get the request parameters using ctx.getJsonRequest()?
------------------------------
Kalpana
------------------------------
------------------------------
Kalpana Devaraj
Original Message:
Sent: Fri June 30, 2023 08:12 AM
From: Steven Shull
Subject: Track and capture response from Object Structure based REST API
I don't think you'll be able to capture the response. I think you need to open an idea for us to enable that.
Most creation/update requests return no response. It's only when a properties header is provided on the request that any response is generated and the logic for that is done in the OSPOSTRouteHandler itself after the data is committed. In the OSIN script, there is no guarantee the data will be committed because an error can occur after (such as an automation script after save event) that causes the transaction to rollback.
You should be able to get the OslcRequest (using ctx.getJsonRequest()) which will give you a lot of the critical information you need such as the properties header of the request. But you won't be able to use the method we use (preparePropertiesResponse) on OSPOSTRouteHandler because that's a protected method.
------------------------------
Steven Shull
Original Message:
Sent: Thu June 29, 2023 11:16 PM
From: Suhas Joshi
Subject: Track and capture response from Object Structure based REST API
Yes that is correct and we have seen this property. Forgot to mention that we want to do this only for a specific API and not for all. This property will be applicable for all APIs and moreover we also want to capture response and this property doesn't do that.
------------------------------
Suhas Joshi
Original Message:
Sent: Thu June 29, 2023 08:38 AM
From: MANU MAGANTI
Subject: Track and capture response from Object Structure based REST API
Check this link out. You'll have both in the requestlog table.
https://eam360.com/enable-mif-message-tracking-for-rest-api
------------------------------
MANU MAGANTI
EMA Canada| Inc.
OAKVILLE ON
Original Message:
Sent: Wed June 28, 2023 07:37 AM
From: Suhas Joshi
Subject: Track and capture response from Object Structure based REST API
Hi,
We have a requirement to capture the request and response for an inbound integration. Maximo is receiving an inbound request in JSON format. When the request comes and gets processed in Maximo, we need to capture the inbound JSON request as well as the response that Maximo sends and store it in DB.
We are able to capture inbound request in OSIN automation script (as it is object structure based API), but we are unable to capture the response. Any pointers to capture the response would be highly appreciated.
Thanks,
Suhas
------------------------------
Suhas Joshi
------------------------------