Views:

Behavior:
When attempting to establish a connection to DocuWare via the REST API, the following error is returned,

<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>Microsoft-Azure-Application-Gateway/v2</center>
</body>
</html>


Solution:
For this issue, we would need to look at the headers being sent in our request.
If we used Postman to convert a Rest call into a different language, we'd need to include the User-Agent header in our request. Otherwise, 403 will be returned.

For example, if we used Postman to convert to Python - Requests, then this is the code we get, 

import requests

 

url = "https://PetersEngineering.docuware.cloud/DocuWare/Platform/Account/Logon"

 

payload='Organization=PetersEngineering&Password=admin&UserName=admin'
headers = {
  'Content-Type''application/x-www-form-urlencoded',
  'Accept''application/json',
  'Cookie'[Cookie]
}

 

response = requests.request("POST", url, headers=headers, data=payload)

 

print(response.text)


This code will not include headers such as User-Agent, which must be addressed before we're able to send the request. 
Adding the User-Agent, like in the following example, will resolve the 403 error.

 

import requests

 

url = "https://PetersEngineering.docuware.cloud/DocuWare/Platform/Account/Logon"

 

payload='Organization=PetersEngineeringt&Password=admin&UserName=admin'
headers = {
  'User-Agent': 'Chrome/160.0.0.0',
  'Content-Type''application/x-www-form-urlencoded',
  'Accept''application/json',
  'Cookie'[Cookie]
}

 

response = requests.request("POST", url, headers=headers, data=payload)

 

print(response.text)


If the error still occurs after adding the User-Agent header, then the headers will need further investigation, which Postman could be helpful for.

KBA is applicable for both Cloud and On-premise Organizations.