Original Message:
Sent: Thu December 07, 2023 05:05 AM
From: Andreas Brieke
Subject: Problem with integration script (POST API metod)
Hi Jamina,
here we come to the field of absolutely basic scripting for maximo :)
mbo.setValue("mxtconnum",result)
For more information on this, refer to the Maximo Scripting Guide -> https://ibm-maximo-dev.github.io/maximo-autoscript-documentation/
------------------------------
Andreas Brieke
IT Service Management Consultant
SVA System Vertrieb Alexander GmbH
Original Message:
Sent: Mon December 04, 2023 03:29 AM
From: Jasmina Agic
Subject: Problem with integration script (POST API metod)
Hello Andreas,
just to let you know that we managed to solve the problem. We received a response from another application. We added only the lower function to one field, because the requester's codes are written in upper letters and theirs in lower letters, and that's why we had an error 411.
This is an example of feedback:
Now we need to enter the information we received in the answer into the field we have in Maximo (purchview.mxtconnum).
Do you have any ideas for us?
Thank you very much in advice.
Best Regards
Jasmina
------------------------------
Jasmina Agic
Original Message:
Sent: Fri December 01, 2023 05:06 AM
From: Jasmina Agic
Subject: Problem with integration script (POST API metod)
Thank you very much once again.
We included {0} in the message and received error 411, which means that the data we are sending is not in the database. Now we will contact another apartment to check.
We will contact you with feedback.
Jasmina
------------------------------
Jamina Agic
Original Message:
Sent: Fri December 01, 2023 04:52 AM
From: Andreas Brieke
Subject: Problem with integration script (POST API metod)
Hi,
seems like your target URL does not like what you send. Turn on logger maximo.integration to DEBUG and watch the logs when clicking your button, perhaps this gives a bit more information
------------------------------
Andreas Brieke
IT Service Management Consultant
SVA System Vertrieb Alexander GmbH
Original Message:
Sent: Fri December 01, 2023 04:46 AM
From: Jamina Agic
Subject: Problem with integration script (POST API metod)
Thank you very for a quick reply!
Now we get this error:
BMXAA1482E - the response code received from the http request from the endpoint is not successful.
Jasmina
------------------------------
Jamina Agic
Original Message:
Sent: Fri December 01, 2023 04:27 AM
From: Andreas Brieke
Subject: Problem with integration script (POST API metod)
Hi Jamina,
include in your messages a {0} so Maximo knows that it shall put the first value from the given parameters on this place.
If there is an error in the connection, set ERRORONSTATUS to True and the endpoint will give you some more information
ctx.put("ERRORONSTATUS",True)
------------------------------
Andreas Brieke
IT Service Management Consultant
SVA System Vertrieb Alexander GmbH
Original Message:
Sent: Fri December 01, 2023 03:55 AM
From: Jamina Agic
Subject: Problem with integration script (POST API metod)
Hello Andreas,
thank you very much for your help.
We did everything you suggested and after the test we get an error.
I am sending all the pictures in the attachment.
We have three virtual machines. One is ours on which the maximo application is installed, the other is exadata where the database (oracle database) is located and on the third machine there is an application that needs to return a number, i.e. (information).
I don't know if it's a network problem. From the server where the application is, we regularly ping the server where we send the data. On the server where the base is, they also checked and said that it was released on port 8080.
We tested it through Postman and it works properly. I am sending the pictures in the attachment.
Thanks again for any suggestions.
Lp
Jasmina
------------------------------
Jamina Agic
Original Message:
Sent: Fri December 01, 2023 02:39 AM
From: Andreas Brieke
Subject: Problem with integration script (POST API metod)
Hi Jamina,
i would say it doesn't look wrong. What is the error you get?
Just as a tip:
I personally would use an Endpoint (Integration -> End Points), so you can store the Password encrypted and don't have to handle all the connection settings.
from com.ibm.json.java import JSONObjectfrom java.util import HashMaprequest_data = JSONObject()request_data.put("opisUsluge", mbo.getString("DESCRIPTION"))request_data.put("brojOdobrenja", mbo.getString("MXTCONNUM"))request_data.put("mjestoTroska", mbo.getString("MXTMJESTTRO"))request_data.put("nazivDobavljaca", mbo.getString("VENDOR"))request_data.put("jibDobavljaca", mbo.getString("VENDOR.REGISTRATION1"))request_data.put("odobravatelj", mbo.getString("MXTNABZAH"))request_data.put("opu", mbo.getString("MXTPERSON.DEPARTMENT"))request_data.put("buc", mbo.getString("MXTPERSON.MXTPERBUC"))request_data.put("iznosBezPdv", mbo.getFloat("TOTALCOST"))request_data.put("iznosSaPdv", mbo.getFloat("MXTTOTALPDV"))request_data.put("delovodnikId", "KP")request_data.put("nacinKreiranja", "INTERNAL")request_data.put("tipDokumenta", "ecm:ugovor")request_data.put("nacinPrijema", "1")request_data.put("stepenPoverljivosti", "pov-interno")request_data.put("ojKreiranja", "01")jsonString = request_data.serialize(False)ctx = HashMap()ctx.put("ERRORONSTATUS",False)ctx.put("ALLRESPONSEHEADERS",True)result =service.invokeEndpoint("<EndPointName>", ctx, jsonString)if ctx.get("RESPONSE_HEADERS").get("RESPONSE_STATUS") == "200": service.error("<ErrorGroup>","<ErrorKey>",[result])else: service.error("<ErrorGroup>","<ErrorKey>",[ctx.get("RESPONSE_HEADERS").get("RESPONSE_STATUS")])
The one thing i am wondering about is why you want to throw an error and if you are using ErrorGroup/ErrorKey correct. ErrorGroup/ErrorKey normally refers to a message you defined in Databaseconfig -> Messages. If the message you want to show does not exist you get an error like "Succesful response: #200" shown.
------------------------------
Andreas Brieke
IT Service Management Consultant
SVA System Vertrieb Alexander GmbH
Original Message:
Sent: Wed November 29, 2023 09:17 AM
From: Jamina Agic
Subject: Problem with integration script (POST API metod)
Hello Everyone
I have a problem connecting Maximo with an external application via REST-API methods. We have Maximo 7.6.1 version installed. It is necessary to send the fields from the contract module from Maximo and to return information based on those fields that should be loaded into the field in maximo
When we test the POST method (documentation and link that we received from our partner), it returns the information properly through Postman.
In maximo, we created a script that is activated by clicking a button. We don't have much experience with this so if someone can help us.
I am sending the script in attachment.
Thanks in advance!
Lp
Jasmina
------------------------------
Jamina Agic
------------------------------