Hello,
I am trying to call an ion api inside an XtendM3 batch but i get the following error: Unable to lookup token since provided session id is null.
It is probably related to the token.
Here's the code i used:
public boolean callIONAPI() {
logger.info("starting bulk")
def endpoint = "M3/m3api-rest/v2/execute"
def headers = [
"Accept": "application/json",
"Content-Type": "application/json"
]
def queryParameters = (Map)null
IonResponse response = ion.post(endpoint, headers, queryParameters, body)
if (response.getError()) {
logger.info(response.getError().toString())
logger.info(response.getErrorMessage().toString())
return false
}
if (response.getStatusCode() != 200) {
return false
logger.info(response.getStatusCode().toString())
}
String content = response.getContent()
if (content != null && !content.trim().isEmpty()) {
logger.info(content.toString())
return true
} else {
return false
}
return true
}
The surprising part is that the same code runs fine inside an XtendM3 transaction.
Has anyone ever encountered this error before?
Thank you for your time