microsoft computer vision api

microsoft computer vision api

  

Im tring to access microsoft vision api, it is working on the microsoft test site, but when i try to consume it in outsystems REST API Integration, it does not work.


Request URL: 

https://westus.api.cognitive.microsoft.com/vision/v1.0/ocr?language=en&detectOrientation =true


HTTP request

POST https://westus.api.cognitive.microsoft.com/vision/v1.0/ocr?language=en&detectOrientation =true HTTP/1.1
Content-Type: application/json
Host: westus.api.cognitive.microsoft.com
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••

{"url":"https://storage.googleapis.com/totoocr/imagewithText.png"}

Response status

200 OK

Response latency

287 ms


Hi Linguo,

There's a space character in the url, not sure if it might affect.

Is the API key correct?


João Neves wrote:

Hi Linguo,

There's a space character in the url, not sure if it might affect.

Is the API key correct?


i removed the space but still cannot. the API key is correct becuase i use the same key in the microsoft test site.


Linguo You

You are putting in the Request Body (for the Test) the whole content of the HTTP request. To properly test this you should have the JSON content only in the request body

{"url":"https://storage.googleapis.com/totoocr/imagewithText.png"}

and in the Headers/Auth tab add a Ocp-Apim-Subscription-Key header. Then back on the test tab you'll be able to add your key for testing.


Cheers


André Vieira wrote:

Linguo You

You are putting in the Request Body (for the Test) the whole content of the HTTP request. To properly test this you should have the JSON content only in the request body

{"url":"https://storage.googleapis.com/totoocr/imagewithText.png"}

and in the Headers/Auth tab add a Ocp-Apim-Subscription-Key header. Then back on the test tab you'll be able to add your key for testing.


Cheers


Hi Andre,


thank you so much, i got it working with url json input.

for input the image as binary data, how should i create the input object. i tried {"img":""} and change img to binary type, it is not working.


Solution

Linguo You,


I suggest creating a new method that instead of sending a JSON payload sends the binary data.

I'm attaching a sample.

Solution

André Vieira wrote:

Linguo You,


I suggest creating a new method that instead of sending a JSON payload sends the binary data.

I'm attaching a sample.

Super, thank you so much