Recognize REST call unauthorized


#1

I am attempting to use the REST endpoint to recognize bar code images from Microsoft Flow. I can use an HTTP action to make a POST call to https://api.aspose.cloud:443/v1.1/barcode/recognize?type=qr&stripFnc=true&appsid=myappid&signature=mysig with the image bytes in the body of the request. However, this fails with a 401 unauthorized.

I also tried the online sample here https://apireference.aspose.cloud/barcode/#!/Barcode/Barcode_PostBarcodeRecognizeFromUrlorContent and get the same “unauthorized” message.

Any help would be appreciated, thanks!


#2

@jherres

You need to sign your REST call before you can use the REST API. A simple way of using this would be to use the .NET SDK for Aspose.Barcode for Cloud. You can find the Github repository here. You can also study our complete documentation in our Developer Guide.

If you need any more help, please let us know.


#3

In our scenario, we cannot use any SDK as we are making these calls directly from Flow. The call we want to make is similar to BarCodePostBarCodeRecognizeFromUrlorContent in that SDK. However, looking at that code and following it to the InvokeApi call, I don’t see any “signing”.

Can you share what a POST request should look like when sending an image in the body for recognition? Is it possible to use AppID and Key to make this call?


#4

I have attached a simple JAVA application that generates a signed URL. Basically you need to create a SHA1 hash of the resource URL.URLGeneratorExample.java.zip (1.2 KB). If you need more help in .NET we can create a URL for you if provide me the API Key and SID.


#5

Thanks, I was able to get this resolved. I’d suggest a bit better documentation on how a REST request must be constructed and signed (your online sample fails to run). I had to dig out the Sign function from the .NET library, put it into a console app and run it against the request I wanted to make in order to get it to work.


#6

@jherres

Thank You. You point has been noted. We are going to update the documentation pages to add this content.

Please contact us for any further help you require.