How to Create OMR Template in cURL using Aspose.OMR REST API

Create OMR template with cloud API is not working. Getting following error -

{
“requestId”: “629eeec0-7320-4c29-bb3a-c63278b944b8”,
“error”: {
“code”: “error”,
“message”: “One or more errors occurred. (Error making request with Error Code NotFound and Http Status Code NotFound. No further error information was returned by the service.) Error making request with Error Code NotFound and Http Status Code NotFound. No further error information was returned by the service.”,
“description”: “Operation Failed. General Error.”,
“dateTime”: “2022-03-09T10:43:07.5349Z”,
“innerError”: null
}
}

For following URL -

curl -X POST "https://api.aspose.cloud/v3.0/omr/omrtemplatenew/runOmrTask?actionName=GenerateTemplate" 
-H "accept: application/json" 
-H "authorization: Bearer eyJhbGciOi.....aoDAEj1A8qhN_3wQJP0qTYS1RratVf5IoE32hRJc_UhGjdfA" 
-H "Content-Type: application/json" 
-H "x-aspose-client: Containerize.Swagger" 
-d "{ \"FunctionParam\": \"string\", \"AdditionalParam\": \"string\"}"

What should be the functional parameters in this case?

@

Thanks for your inquiry. Please note you need to pass a text mark-up file to create OMR template in cURL using Aspose.OMR REST API . For example, I uploaded a simple template file to a cloud storage folder OMR and used the following parameter values to generate an OMR template file. Hopefully, it will help you to accomplish the task.test.zip (199 Bytes)

name: test.txt
actionName: GenerateTemplate
param: //remove the default properties form request body
folder: OMR

How to Create OMR Sheet in cURL

curl -X POST "https://api.aspose.cloud/v3.0/omr/test.txt/runOmrTask?actionName=GenerateTemplate&folder=OMR" 
-H "accept: application/json" 
-H "authorization: Bearer [Access_Token]" 
-H "Content-Type: application/json" 
-H "x-aspose-client: Containerize.Swagger" 
-d "{}"

It would be difficult to call basic OMR functions in API explorer at the start. So it is best to get familiar with the OMR workflow and functions you can try our Github Code Demo first.

And it is also highly recommended using GUI Client to get familiar with the process before using SDK. It is also well documented with screenshots that will lead you through the process.

Thanks for the help.
I tried creating a template with GUI and was able to do so. Then I tried recognizing an image with GUI and was able to do so well. But now, the recognize API call is not responding anything for following request (Same image recognition worked perfectly for GUI client) -

curl --location --request POST 'https://api.aspose.cloud/v3.0/omr/ZealNumericNew_Solved.png/runOmrTask?actionName=RecognizeImage' \

--header 'accept: application/json' \

--header 'Content-Type: application/json' \

--header 'x-aspose-client: Containerize.Swagger' \

--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE2NDY5MDY3MjcsImV4cCI6MTY0NjkxMDMyNywiaXNzIjoiaHR0cHM6Ly9hcGkuYXNwb3NlLmNsb3VkIiwiYXVkIjpbImh0dHBzOi8vYXBpLmFzcG9zZS5jbG91ZC9yZXNvdXJjZXMiLCJhcGkuYmlsbGluZyIsImFwaS5pZGVudGl0eSIsImFwaS5wcm9kdWN0cyIsImFwaS5zdG9yYWdlIl0sImNsaWVudF9pZCI6IjkwZmNlYTA3LWQ0NTUtNDcxNC1hNDAyLTAzMjFmYjAzMWM3NCIsImNsaWVudF9kZWZhdWx0X3N0b3JhZ2UiOiJmZjRlZjQxMS0zYjNiLTRlZWQtYWExZi01MDgyNjBkMTk2ODkiLCJjbGllbnRfaWRlbnRpdHlfdXNlcl9pZCI6Ijg4MjQzNSIsInNjb3BlIjpbImFwaS5iaWxsaW5nIiwiYXBpLmlkZW50aXR5IiwiYXBpLnByb2R1Y3RzIiwiYXBpLnN0b3JhZ2UiXX0.gAg20EdIioZUGug-w8pd0hR12ppK7X0Ik-g6oE9RD7duJjKdQrp9KxMf0tEtqJ5d8RwgqRMNR7GYEdvBT7AQQYVVvRLcW0RPDrMkqokmHI0m9ptOSewH7A8COK5T6UdPdSAltrywpqS6j0OVI4dnkfYFwYknrW1Qxxep268TDi0GlGA-1YrOyKQsDdQuKOPNXwao0E5wt9MEGg7kdkruiJSG7sEh_sg9DXX796ltNhczarjfEibZTH8TeJTdTz2Bf2H6FimsCCw-UbTQgYN39RC4US48Nd7aK2GeSzWwU9GauzGdrtFU0F5aj2F1lM0u8UgPwpVaonq7NFJV6diP_w' \

--header 'Cookie: AWSALB=JeMaM+WatdMHQ9dTWpnyEFZ0f1zXY+NPpEM0IUD3hKSq+8iUW3XQfzMdj/AsH9/jGslWvuzWnQJqSqKNwG6mQk5AKsxfvBR4/t4PhKU13U457AtfIYDhmeDv2FkK; AWSALBCORS=JeMaM+WatdMHQ9dTWpnyEFZ0f1zXY+NPpEM0IUD3hKSq+8iUW3XQfzMdj/AsH9/jGslWvuzWnQJqSqKNwG6mQk5AKsxfvBR4/t4PhKU13U457AtfIYDhmeDv2FkK' \

--data-raw '{ "FunctionParam": "ocr.omrcr"}'

@ajaxkulkarni

Please check the following documentation. The RecognizeImage action needs the Template Id as functionParams. Furthermore, as suggested above you can use SDK of your preferred programming language to use Aspose.OMR Cloud API, as SDK takes care of a lot of low-level details of making requests and handling responses itself.

I’m facing the same issue. I copied the sample text markup and placed test.txt file in a folder named “omr” inside my First Storage. After making a request to

https://api.aspose.cloud/v3.0/omr/test.txt/runOmrTask?actionName=GenerateTemplate&folder=omr

the following response is being returned:

{
“requestId”: “a26a0387-3c34-422e-bec2-ac67e705733b”,
“error”: {
“code”: “error”,
“message”: “One or more errors occurred. (Error making request with Error Code NotFound and Http Status Code NotFound. No further error information was returned by the service.) Error making request with Error Code NotFound and Http Status Code NotFound. No further error information was returned by the service.”,
“description”: “Operation Failed. General Error.”,
“dateTime”: “2022-08-15T11:56:56.9074104Z”,
“innerError”: null
}
}

Don't know what to do next.

@dranique12345

I’m unable to notice any issue to generate a template from the above shared text file. Please double check that you are correctly generating Access Token and referring correct file from the cloud storage.

# First get Access Token
# Get Customer Key and Customer ID from https://dashboard.aspose.cloud/
curl -X POST "https://api.aspose.cloud/connect/token" 
-d "grant_type=client_credentials&client_id=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxxxx" 
-H "Content-Type: application/x-www-form-urlencoded" 
-H "Accept: application/json"

## Generate Template
curl -X POST "https://api.aspose.cloud/v3.0/omr/test.txt/runOmrTask?actionName=GenerateTemplate&folder=OMR" 
-H "accept: application/json" 
-H "authorization: Bearer eyJhbGciOiJSUzI1NiI.....t8ca5usG1EJxssIxBXBSA" 
-H "Content-Type: application/json" 
-d "{\"FunctionParam\": null, \"AdditionalParam\": null}"