Hello @John Tsz Kin WONG (External)
Thanks for reaching out to us, please be aware of that 2023-02-28-preview
capabilities are currently only available in the following regions:
- West Europe
- West US2
- East US
I am sharing a Python sample for your reference, you can get sample in more languages at the bottom of the page - https://westus.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-2023-02-28-preview/operations/AnalyzeDocument
########### Python 2.7 #############
import httplib, urllib, base64
headers = {
# Request headers
'Content-Type': 'application/json',
'Ocp-Apim-Subscription-Key': '{subscription key}',
}
params = urllib.urlencode({
# Request parameters
'pages': '{string}',
'locale': '{string}',
'stringIndexType': 'textElements',
})
try:
conn = httplib.HTTPSConnection('westus.api.cognitive.microsoft.com')
conn.request("POST", "/formrecognizer/documentModels/{modelId}:analyze?api-version=2023-02-28-preview&%s" % params, "{body}", headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))
####################################
########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64
headers = {
# Request headers
'Content-Type': 'application/json',
'Ocp-Apim-Subscription-Key': '{subscription key}',
}
params = urllib.parse.urlencode({
# Request parameters
'pages': '{string}',
'locale': '{string}',
'stringIndexType': 'textElements',
})
try:
conn = http.client.HTTPSConnection('westus.api.cognitive.microsoft.com')
conn.request("POST", "/formrecognizer/documentModels/{modelId}:analyze?api-version=2023-02-28-preview&%s" % params, "{body}", headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))
####################################
More samples at the bottom -
I hope this helps. Regards, Yutong -Please kindly accept the answer and vote 'Yes' if you feel helpful to support the community, thanks a lot.