GOUTHAMKUMAR
(Goutham Kumar Yellumahanti)
May 30, 2023, 4:33am
1
Hi Everyone,
When a Connect-REST fails with 404 and 500 errors codes although the error details are in the backend, is there a way to read them back to calling activity or data page?
I see those details in logs when I enable com.pega.pegarules.integration.engine.internal.connect.rest.RESTConnector to Debug / ALL but, I am not able to find them in any local variable or params of invoke / pyInvokeRESTConnector.
After enabling above setting, log says below
<em><strong>------------------HTTP RESPONSE CONTENTS------------------
Response Headers:
Connection: keep-alive
Content-Type: application/json
Date: Tue, 30 May 2023 03:45:43 GMT
RespRuleErrorCode: 0x00000000
Transfer-Encoding: chunked
X-Backside-Transport: FAIL FAIL,FAIL FAIL
X-Global-Transaction-ID: 804c2337647571677e3fac1f
Response Message Data: 554 bytes received
{"exceptions":[{"type":"E","code":"1002","message":"ERR3031 PMG/IPA PROV CONT NOT FND FOR PRODUCT"}]}
----------------END HTTP RESPONSE CONTENTS---------------- </strong></em>
I need to read the message variable from above line. Any insight is appreciated.
Pega version: 8.8.1
Thank you!
Nadimuthu_T
(Nadimuthu Thangavel)
May 30, 2023, 4:40am
2
@GOUTHAMKUMAR Please create the exception data model in your int class or use the function to map the response to clipboard
GOUTHAMKUMAR
(Goutham Kumar Yellumahanti)
May 30, 2023, 1:10pm
3
@Nadimuthu T Thank you for your response.The data model exists already however, it is not working all the time. Its working only for 401 code.
Nadimuthu_T
(Nadimuthu Thangavel)
May 30, 2023, 6:55pm
4
@GOUTHAMKUMAR Pls check the json for 401, it’s may be error page structure
LANH_ラン
(Lanh NguyenTrung)
May 31, 2023, 8:20am
5
@GOUTHAMKUMAR
use property pyHTTPResponseCode to get errors codes
Ex: D_APIPage.pyHTTPResponseCode
GOUTHAMKUMAR
(Goutham Kumar Yellumahanti)
May 31, 2023, 8:56pm
6
@LANH (ラン) , Thank you for your response. I am able to find the response code but I am not able to read the error code and details of the error.
GOUTHAMKUMAR
(Goutham Kumar Yellumahanti)
June 22, 2023, 5:16pm
7
Issue is resolved. This DSS Pega-IntegrationEngine • http/LegacyResponseMapping was set to true. After changing it to false, it followed the exception structure in response XML.
GOUTHAMKUMAR
(Goutham Kumar Yellumahanti)
May 31, 2023, 8:55pm
8
@Nadimuthu T I verified the response structure in postman. 401 and 404 response structure is same. both
401
{
“exceptions”: [
{
“type”: “E”,
“code”: “401”,
“message”: “FailedToResolveAPIKey”,
“detail”: “dcb9dc9a-9b8b-4a8a-b2bf-610f69be17c9 - The API key for this resource is invalid or missing”
}
]
}
404
{
“exceptions”: [
{
“type”: “E”,
“code”: “1002”,
“message”: “ERR3011 IPA ID NOT FOUND ON PROV DB”,
“detail”: “ERR3011 IPA ID NOT FOUND ON PROV DB”
}
]
}