iink SDK Web

Answered

Access not granted 401

I am trying to get this example to run in postman: https://swaggerui.myscript.com/#/Batch_mode/batch
However I am getting an Access not granted error. I already disabled "Enable HMAC" like suggested in this question: https://developer-support.myscript.com/support/discussions/topics/16000028385 and using now the raw hmac key

image

My Postman request:


image

Body:

 

{
  "width": 722,
  "height": 620,
  "contentType": "Text",
  "conversionState": "DIGITAL_EDIT",
  "theme": "ink {color: #000000; -myscript-pen-width: 1; -myscript-pen-fill-style: none; -myscript-pen-fill-color: #FFFFFF00;} mycolor {color: #120f51;} .math { font-family: STIXGeneral;} .math-solved {font-family: STIXGeneral; color: #A8A8A8FF;} .text {font-family: Open Sans; font-size: 10;}",
  "strokeGroups": [
    {
      "strokes": [
        {
          "id": "string",
          "x": [
            289,
            290,
            290,
            290,
            290,
            290,
            290,
            291,
            291,
            292,
            293
          ],
          "y": [
            215,
            218,
            222,
            225,
            228,
            231,
            235,
            238,
            242,
            245,
            248
          ],
          "t": [
            1516717383637,
            1516717383677,
            1516717383694,
            1516717383711,
            1516717383727,
            1516717383744,
            1516717383761,
            1516717383777,
            1516717383794,
            1516717383811,
            1516717383827
          ],
          "p": [
            0.5,
            0.8221720589961077,
            0.7145158745241171,
            0.6761535882018319,
            0.6761535882018319,
            0.6761535882018319,
            0.7145158745241171,
            0.6831899108492184,
            0.7145158745241171,
            0.6831899108492184,
            0.6831899108492184
          ],
          "pointerType": "PEN, TOUCH, ERASER",
          "pointerId": 0
        }
      ],
      "penStyle": "color: #120f51;↵-myscript-pen-width: 2;",
      "penStyleClasses": "ink mycolor"
    }
  ],
  "configuration": {
    "alwaysConnected": true,
    "lang": "en_US",
    "math": {
      "solver": {
        "enable": true,
        "fractional-part-digits": 3,
        "decimal-separator": ".",
        "rounding-mode": "half up",
        "angle-unit": "deg",
        "fraction-mode": "decimal",
        "options": "algebraic"
      },
      "margin": {
        "top": 10,
        "left": 15,
        "right": 15,
        "bottom": 10
      },
      "customGrammarId": "your_custom_grammar_id",
      "customGrammarContent": "symbol = 0\\nexpression ::= identity(symbol)\\nstart(expression)",
      "undo-redo": {
        "mode": "stroke"
      }
    },
    "text": {
      "margin": {
        "top": 10,
        "left": 15,
        "right": 15,
        "bottom": 10
      },
      "guides": {
        "enable": true
      },
      "configuration": {
        "customResources": [
          "your_custom_resource"
        ],
        "customLexicon": [
          "word1",
          "word2"
        ],
        "addLKText": true
      }
    },
    "export": {
      "image": {
        "guides": true,
        "viewport": {
          "x": 0,
          "y": 0,
          "width": 0,
          "height": 0
        }
      },
      "jiix": {
        "strokes": true,
        "style": false,
        "bounding-box": false,
        "text": {
          "chars": false,
          "words": true
        }
      },
      "mathml": {
        "flavor": "standard"
      },
      "image-resolution": 300
    },
    "diagram": {
      "text": {
        "customResources": [
          "your_custom_resource"
        ],
        "customLexicon": [
          "word1",
          "word2"
        ],
        "addLKText": true
      },
      "convert": {
        "edge": true,
        "node": true,
        "text": true
      },
      "enable-sub-blocks": true
    },
    "gesture": {
      "enable": true
    },
    "raw-content": {
      "recognition": {
        "text": true,
        "shape": true
      },
      "text": {
        "customResources": [
          "your_custom_resource"
        ],
        "customLexicon": [
          "word1",
          "word2"
        ],
        "addLKText": true
      }
    }
  },
  "xDPI": 96,
  "yDPI": 96
}

 






Best Answer

Dear Daniel,


please find a simple Text REST request:

{
  "width": 722,
  "height": 620,
  "contentType": "Text",
  "conversionState": "DIGITAL_EDIT",
  "theme": "ink {color: #000000; -myscript-pen-width: 1; -myscript-pen-fill-style: none; -myscript-pen-fill-color: #FFFFFF00;} mycolor {color: #120f51;} .math { font-family: STIXGeneral;} .math-solved {font-family: STIXGeneral; color: #A8A8A8FF;} .text {font-family: Open Sans; font-size: 10;}",
  "strokeGroups": [
    {
      "strokes": [
        {
          "id": "string",
          "x": [...],
          "y": [...],
          "t": [...],
          "p": [...],
          "pointerType": "PEN, TOUCH, ERASER",
          "pointerId": 0
        }
      ],
      "penStyle": "color: #120f51;↵-myscript-pen-width: 2;",
      "penStyleClasses": "ink mycolor"
    }
  ],
  "configuration": {
    "alwaysConnected": true,
    "lang": "en_US",
    "text": {
      "margin": {
        "top": 10,
        "left": 15,
        "right": 15,
        "bottom": 10
      },
      "guides": {
        "enable": true
      },
      "configuration": {"addLKText": true}
    },
    "export": {
      "image": {
        "guides": true,
        "viewport": {
          "x": 0,
          "y": 0,
          "width": 0,
          "height": 0
        }
      },
      "jiix": {
        "strokes": true,
        "style": false,
        "bounding-box": false,
        "text": {
          "chars": false,
          "words": true
        }
      },
      "image-resolution": 300
    },
    "gesture": {
      "enable": true
    }
  },
  "xDPI": 96,
  "yDPI": 96
}



And the headers:

Best regards,


Olivier


Answer

Dear Daniel,


please find a simple Text REST request:

{
  "width": 722,
  "height": 620,
  "contentType": "Text",
  "conversionState": "DIGITAL_EDIT",
  "theme": "ink {color: #000000; -myscript-pen-width: 1; -myscript-pen-fill-style: none; -myscript-pen-fill-color: #FFFFFF00;} mycolor {color: #120f51;} .math { font-family: STIXGeneral;} .math-solved {font-family: STIXGeneral; color: #A8A8A8FF;} .text {font-family: Open Sans; font-size: 10;}",
  "strokeGroups": [
    {
      "strokes": [
        {
          "id": "string",
          "x": [...],
          "y": [...],
          "t": [...],
          "p": [...],
          "pointerType": "PEN, TOUCH, ERASER",
          "pointerId": 0
        }
      ],
      "penStyle": "color: #120f51;↵-myscript-pen-width: 2;",
      "penStyleClasses": "ink mycolor"
    }
  ],
  "configuration": {
    "alwaysConnected": true,
    "lang": "en_US",
    "text": {
      "margin": {
        "top": 10,
        "left": 15,
        "right": 15,
        "bottom": 10
      },
      "guides": {
        "enable": true
      },
      "configuration": {"addLKText": true}
    },
    "export": {
      "image": {
        "guides": true,
        "viewport": {
          "x": 0,
          "y": 0,
          "width": 0,
          "height": 0
        }
      },
      "jiix": {
        "strokes": true,
        "style": false,
        "bounding-box": false,
        "text": {
          "chars": false,
          "words": true
        }
      },
      "image-resolution": 300
    },
    "gesture": {
      "enable": true
    }
  },
  "xDPI": 96,
  "yDPI": 96
}



And the headers:

Best regards,


Olivier


1 person likes this

Dear Daniel,


Thank you for contacting us.


Currently, I noticed you were able to do some requests. Did you solve the issue? Are you able to POST requests yto our cloud?


Indeed, your request is not formatted properly. Do you want to do a Math, Text, Diagram... request? Indeed, the configuration contains the information for all content types?


For example, the body of a simple Math request shall be as follows:

{"configuration":{
"math":{"mimeTypes":["application/x-latex","application/mathml+xml"],
"solver":{"enable":true,"fractional-part-digits":3,"decimal-separator":".","rounding-mode":"half up","angle-unit":"deg"},
"margin":{"bottom":10,"left":15,"right":15,"top":10}},
"lang":"en_US",
"export":{"image-resolution":300,"jiix":{"bounding-box":false,"strokes":false,"text":{"chars":false,"words":true}}}},
"xDPI":96,"yDPI":96,
"contentType":"Math",
"theme":"ink {\ncolor: #000000;\n-myscript-pen-width: 1;\n-myscript-pen-fill-style: none;\n-myscript-pen-fill-color: #FFFFFF00;\n}\n
.math {\nfont-family: STIXGeneral;\n}\n.math-solved {\nfont-family: STIXGeneral;\ncolor: #A8A8A8FF;\n}\n.text {\nfont-family: Open Sans;\nfont-size: 10;\n}\n",
"strokeGroups":[{"penStyle":null,"strokes":[{
"x":[... ],
"y":[...],
"t":[...]},
{"x":[...],
"y":[...],
"t":[...]},
{"x":[...],
"y":[...],
"t":[...]
}]}],"height":0,"width":0,"conversionState":"DIGITAL_EDIT"}


Please adapt the body to the type of part you want to recognize.


Best regards,


Olivier

Dear Oliver,

thanks for your quick reply. No, I didn't get it to run. The requests recorded are just the test requests from within the cloud dashboard.

I want to do a text request. Do you have also a simple example for that? I am not sure what to delete in my request.


Thanks Oliver! I got it running after setting the pointer type to "pointerType": "Pen" and removing "Touch, Eraser"

 

 


Dear Daniel,


thank you for the update, I am glad it is working.


Best regards,


Olivier

Login or Signup to post a comment