OMR API Specification

Function Specifications

At present, Aspose.OMR for Cloud API exposes single function with string parameter that determines which specific action should be performed.

API Type Description Swagger Link
/omr​/{name}​/runOmrTask POST Run specific OMR task PostRunOmrTask

OMRFunctionParam Description

OMRFunctionParam is a separate class that has FunctionParam property. This property accepts string parameters, usually JSON strings, that are specific to each action. See examples given below for each action.

cURL Example

SDKs

Using an SDK (API client) is the quickest way for a developer to speed up the development. An SDK takes care of a lot of low-level details of making requests and handling responses and lets you focus on writing code specific to your particular project. Checkout our GitHub repository for a complete list of Aspose.OMR SDKs along with working examples, to get you started in no time.

SDK Examples

Actions

Generate Template

Expected parameters values:

  • name:
  • actionName:  <"GenerateTemplate">
  • functionParams: 
cURL Example for Generate Template
Example:
Response content details
  • Within OmrResponse.Payload.Result.Files we produce generated .omr template file and .png image.
  • Within OmrResponse.Payload.Result.Info.Details we produce JSON with following content:

OmrResponse.Payload.Result.Info.Details contains:


string [] TaskMessages;
string TaskResult;

OmrResponse.Payload.Result.Info.Details GenerateTemplate example:


{
  "Details": {
    "TaskMessages": [],
    "TaskResult": "Pass",
  }
}

Full Response GenerateTemplate example:


{
  "ErrorCode": 0,
  "ErrorText": "",
  "Payload": {
    "Result": {
      "TemplateId": null,
      "ExecutionTime": 0.65801920890808,
      "ResponseFiles": [
        {
          "Name": "AnswerSheet.omr",
          "Size": 53155,
          "Data": "ewogICAgIl.....I6IFtdCn0="
        }, 
        {
          "Name": "AnswerSheet.png",
          "Size": 353437,
          "Data": ""iVBORw0KGg.....5ErkJggg==""
        }
      ],
      "Info": {
        "ResponseVersion": "1.0",
        "ProcessedTasksCount": 1,
        "SuccessfulTasksCount": 1,
        "Details": { 
	   "TaskMessages": [],
           "TaskResult":"Pass"
	}
      }
    }
  }
}

Correct Template

Expected parameters values:

  • name: <Path to an image file (image name) that is used to create template>
  • actionName: <"CorrectTemplate">
  • functionParams: 
cURL Example for Correct Template
Example:
Response content details
  • Within OmrResponse.Payload.Result.Files we produce .omrcr file with corrected template JSON data
  • Within OmrResponse.Payload.Result.Info.Details we produce JSON with following content:

OmrResponse.Payload.Result.Info.Details contains:


string [] TaskMessages;
string TaskResult;

OmrResponse.Payload.Result.Info.Details Correction example:


{
  "Details": {
    "TaskMessages": [
      "Initial image resolution was too low. We magnified image in 2.0 times"
    ],
    "TaskResult": "Pass"
  }
}

Full Response Correction example:


{
  "ErrorCode": 0,
  "ErrorText": "",
  "Payload": {
	"Result": {
      "TemplateId": "5b535525-72fe-453f-83e8-5a058569620e",
      "ExecutionTime": 0.83317875862121582,
      "ResponseFiles": [
        {
          "Name": "AnswerSheet.omrcr",
          "Size": 27024,
          "Data": "ewogICAg.....GV0ZSI6IGZhbHNlCn0="
        }
      ],
      "Info": {
        "ResponseVersion": "1.0",
        "ProcessedTasksCount": 1,
        "SuccessfulTasksCount": 1,
        "Details": {
          "TaskMessages": [
            "Initial image resolution was too low. We magnified image in 2.0 times"
          ],
          "TaskResult": "Pass"
        }
      }
    }
  }
}

Finalize Template

Expected parameters values:

  • name: 
  • actionName: <"FinalizeTemplate">
  • functionParams: <Template ID string, recieved after Template Correction>
cURL Example for Finalize Template
Example:
Response content details
  • Within OmrResponse.Payload.Result.Files we produce RecognitionResult.dat file with finalization warnings and recognition data for the template image (note that it should not contain any results if image was filled)
  • Within OmrResponse.Payload.Result.Info.Details we produce JSON with following content:

OmrResponse.Payload.Result.Info.Details contains:


string [] TaskMessages;

string TaskResult;

OmrResponse.Payload.Result.Info.Details Finalization example:


{
  "Details": {
    "TaskMessages": [],
    "TaskResult": "Pass"
  }
}

Full Response Finalization example:


{
  "ErrorCode": 0,
  "ErrorText": "",
  "Payload": {
    "Result": {
      "TemplateId": "5b535525-72fe-453f-83e8-5a058569620e",
      "ExecutionTime": 5.373408794403076,
      "ResponseFiles": [
        {
          "Name": "RecognitionResult.dat",
          "Size": 182,
          "Data": "ewogICAg.....lc3VsdCI6IFtdCn0="
        }
      ],
      "Info": {
        "ResponseVersion": "1.0",
        "ProcessedTasksCount": 1,
        "SuccessfulTasksCount": 1,
        "Details": { 
		"TaskMessages": [],
            	"TaskResult":"Pass"
	}
      }
    }
  }
}

Recognize Image

Expected parameters values:

  • name: <Path to image file (image name) that should be recognized>
  • actionName: <"RecognizeImage”.>
  • functionParams: <Template ID, recieved after Template Correction>
cURL Example for Recognize Template
Example:
Response content details
  • Within OmrResponse.Payload.Result.Files we produce .dat file with recognition data for the provided image.
  • Within OmrResponse.Payload.Result.Info.Details we produce JSON with following content:

OmrResponse.Payload.Result.Info.Details contains:


RecognitionStatistics[]
{
	string Name;
	string[] TaskMessages;
	string TaskResult;
	double RunSeconds;
}

OmrResponse.Payload.Result.Info.Details Recognition example:

{
  "Details": {
    "RecognitionStatistics": [
      {
        "Name": "photo.jpg",
        "TaskMessages": [],
        "TaskResult": "Pass",
        "RunSeconds": 1.7953619956970215
      }
    ]
  }
}

Full Response Recognition example:


{
  "ErrorCode": 0,
  "ErrorText": "",
  "Payload": {
    "Result": {
      "TemplateId": "5b535525-72fe-453f-83e8-5a058569620e",
      "ExecutionTime": 1.7034006118774414,
      "ResponseFiles": [
	{
          "Name": "photo.dat",
          "Size": 121,
          "Data": "UXVlc3R.....24xMDpDCg=="
        }
      ],
      "Info": {
        "ResponseVersion": "1.0",
        "ProcessedTasksCount": 1,
        "SuccessfulTasksCount": 1,
        "Details": {
    		"RecognitionStatistics": [
	    	  {
	        	"Name": "photo.jpg",
	    	    	"TaskMessages": [],
	        	"TaskResult": "Pass",
		        "RunSeconds": 1.3482120037078857
		      }
		    ]
		  }
      }
    }
  }
}