[Google Cloud Vision OCR] Why I Get 404 Not Found When Consume Rest API?
Question
Forge component by Aurelio Junior

Hello, Why I Get 404 Not Found When Consuming API But When Testing I Get The Response Here What I Want To Do

I Want To Access Google OCR API Here

 

I Want Implement This On Mobile APP Then i'm testing it 

that got the response but when i try it on mobile got error 404 Not Found when execute the logic

here's my logic and input

and this what i'm sending to the API

Champion
Solution

Hi Marvin,


Already success doing this.

So the problem like what I already inform before, is because Outsystems doing safe url by encoding it, but google need the ":" while encoder translate that to "%3A".

So what you need to do is :

1. using this plugin (https://www.outsystems.com/forge/component-overview/145/html-utils)

2. on the REST API consume, create new "OnBeforeRequest"

3. On that new "OnBeforeRequest" server action, add this 

This should reverse the encoded url (/v1/images%3Aannotate) back to normal (/v1/images:annotate)


Shout out if you still have problem.

Also if you want to speak in bahasa, join Komunitas Outsystems Indonesia (https://www.linkedin.com/groups/10383387/)


Thanks

Champion

Hi Marvin,


If you can, create sample oml and post it here. 

Also, on mobile, did you use wifi or phone internet ? If using wifi, is the googleapis.com can be accessed from there ?


Thanks

Hello, I'm Already Use A Few Connection when try to accessing but it still cant access the API,

 Here the oml, sorry i'm zipping the file Thanks For The Help

Testing.oml

Champion

Hi Marvin,


I have checked your code, and get the same problem like yours.

I also check this by copying the url to the browser (it also said not found 404)

The possibility is API KEY now is needed to put on environment configuration and not on the url (check here https://cloud.google.com/vision/docs/quickstart-cli),

Maybe the reason Service Studio can test this, because another configuration on the API key (not sure)

But if you only want to use OCR, you can use this plugin (https://www.outsystems.com/forge/component-overview/1572/google-cloud-vision-ocr)


Thanks

But i'm using APIKey I can use in test mode in here

Champion

Yes Marvin, I also find this strange.

I still checking this, but for workaround, you can use the plugin.


Thanks

Champion

Hi Marvin,


Found the problem.

Because Outsystems sanitize the url, so the url is changed from https://vision.googleapis.com/v1/images:annotate?key=AIzaxxxxxxxxx

to 

https://vision.googleapis.com/v1/images%3Aannotate?key=AIzaxxxxxxxxx

{"BaseURL":"https://vision.googleapis.com","URLPath":"/v1/images%3Aannotate","URLQueryParameters":[{"Name":"key","Value":"AIzaxxxxxxxxxxxxxxxxx"}],"HTTPMethod":"POST","Headers":[{"Name":"User-Agent","Value":"OutSystemsPlatform"},{"Name":"Content-Type","Value":"application/json; charset=UTF-8"}],"RequestText":"{}","RequestBinary":"e30="}

I'm currently trying to devoce this using this (https://www.outsystems.com/forums/discussion/54475/consume-rest-url-paramater-chance-by-outsystems/)

But still failed, will update again later


Thanks

Champion
Solution

Hi Marvin,


Already success doing this.

So the problem like what I already inform before, is because Outsystems doing safe url by encoding it, but google need the ":" while encoder translate that to "%3A".

So what you need to do is :

1. using this plugin (https://www.outsystems.com/forge/component-overview/145/html-utils)

2. on the REST API consume, create new "OnBeforeRequest"

3. On that new "OnBeforeRequest" server action, add this 

This should reverse the encoded url (/v1/images%3Aannotate) back to normal (/v1/images:annotate)


Shout out if you still have problem.

Also if you want to speak in bahasa, join Komunitas Outsystems Indonesia (https://www.linkedin.com/groups/10383387/)


Thanks

Hello, Sorry for late reply this already work thanks for the help

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.