[Office365] readCSPAccounts.py fails: The underlying connection was closed: The connection was closed unexpectedly
Modified on: Fri, 17 Nov 2023 12:08 PM2020-01-22
Symptoms
Script readCSPAccounts.py
fails with the error after calling getImportDataForCustomers:
~# ./readCSPAccounts.py --o365APS2-app-instance-id=8 --vendor-id=1000003
...
2016-02-18 19:22:44.814 INFO GET https://localhost:6308//aps/2/resources/27f4022f-525d-4a58-aa03-519475875db5/getImportDataForCustomers?vendorId=1000003 ...
...
2016-02-18 19:22:45.125 ERROR API Error:
2016-02-18 19:22:45.126 ERROR {
"code": 500,
"message": "The underlying connection was closed: The connection was closed unexpectedly.",
"additionalNonlocalizableMessage": ""
}
Error: HTTP Error 500: Internal Server Error
On MOSI server, the following error may be observed in sitelog: 2016-02-18 19:37:58,682 [ 10] DEBUG POAOpenAPI : REQUEST: pem.getServiceTemplate ... 2016-02-18 19:37:58,682 [ 10] ERROR aps_endpoint: Office365AppController.GetImportDataForCustomers finished by exception System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.
In OA Public API settings (at System > Settings > Public API) the Accept Connections is set to Only from allowed networks.
Cause
The MOSI IP is not in the list of Allowed Networks.
Resolution
Add the MOSI backnet API to the list of Allowed Networks in System > Settings > Public API