Google Cloud Vision API using REST

Good Morning Fellow Outsytems Users,

Has anybody had any success in using Google's Cloud Vision API using the built-in REST features of the platform?

I know there is the GoogleCloudVisionOCR Forge component to do this, and it does work well, but I would like some more flexibility without having to write code.

I've set up the REST component using an example POST request/response message that tests perfectly and then builds the structures required.

I'm happy that my module is putting the correct data in the correct places before sending it, but when I try and use the routine I get a "404 - Not Found" error message being returned every time, which is what I find confusing. If I was getting a "Bad Request" or "Server Error" then I'd suspect I was building the message incorrectly and look to fix it, but a 404??

Here's hoping,

Chris.

Solution

Good news! Posting this just in case anyone else ever gets this issue.

I've manage to solve this by going away and reading all the available material on the Outsystems site for debugging and troubleshooting. Enabling full logging and using the http request detail gave me the clue.

I could then see that the platform was replacing the colon : in the URL with a %3A causing the 404 error from Google.

By adding an OnBeforeRequest action to the REST integration and doing the replace below fixed it.

SyntaxEditor Code Snippet

Replace(CustomizedRequest.URLPath,"%3A",":")
Solution

Chris O'Reilly wrote:

Good news! Posting this just in case anyone else ever gets this issue.

I've manage to solve this by going away and reading all the available material on the Outsystems site for debugging and troubleshooting. Enabling full logging and using the http request detail gave me the clue.

I could then see that the platform was replacing the colon : in the URL with a %3A causing the 404 error from Google.

By adding an OnBeforeRequest action to the REST integration and doing the replace below fixed it.

SyntaxEditor Code Snippet

Replace(CustomizedRequest.URLPath,"%3A",":")

Chris,

Thanks for posting the solution.  I encountered the same problem and it was baffling. Your solution worked great.

Thanks, Aaron


Edit

I found the solution! It had to do with the way the image content in the request input was called. The base64 content was not assigned correctly in this screenshot and I had to reassign it. Then it worked like a charm! 


Hi,

I am experimenting with the Google Cloud Vision API and I ran into a problem. I am trying to use image detection to detect what kind of object is in the image. I use this link https://cloud.google.com/vision/docs/request. First I ran into the problem that was discussed here, but than I ran into a "400 bad request" error. After several hours of searching where my mistake could be, I couldn't find it. I want to take a picture and therefore I need to make the binary data into a base64. However, there is something going wrong. Has anybody had the same struggle that I had?

Thanks in advance,

Tyler