iink SDK Web

Access denies to /iink/batch endpoint

 When using the swagger UI to test the batch endpoint with the example I get a 401 error.


When testing using the rest protocol in the My script Cloud UI, after drawing some math and clicking "Apply" Nothing changes and i se a 403 error in my network tab.


Is there a reason my application keys are not authorized for the batch API?

Thanks.



Hello James,


In order to understand, please find a basic math REST request that can be posted via curl:

curl -X POST \
https://cloud.myscript.com/api/v4.0/iink/batch \
-H 'Accept: application/json,application/mathml+xml' \
-H 'Content-Type: application/json' \
-H 'applicationKey:<span class="fr-marker" data-id="0" data-type="true" style="display: none; line-height: 0;"></span> ***-***<span class="fr-marker" data-id="0" data-type="false" style="display: none; line-height: 0;"></span>' \
-d '{"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},"eraser":{"erase-precisely":false}},"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: MyScriptInter;\nfont-size: 10;\n}\n","strokeGroups":[{"penStyle":null,"strokes":[{"x":[514,531,549,567,583,593,599,602,602,597,587,573,558,547,540,545,568,588,607,621,631,634,634,633,630,619,609,597,585,571],"y":[117,108,102,99,98,98,100,109,115,124,132,139,144,147,148,148,148,149,154,160,168,176,180,187,190,201,208,213,217,219],"t":[1674481572623,1674481572827,1674481572843,1674481572861,1674481572877,1674481572893,1674481572916,1674481572956,1674481572978,1674481572996,1674481573009,1674481573028,1674481573044,1674481573060,1674481573077,1674481573136,1674481573160,1674481573179,1674481573194,1674481573211,1674481573228,1674481573244,1674481573262,1674481573277,1674481573294,1674481573310,1674481573326,1674481573347,1674481573360,1674481573380],"pointerType":"mouse"},{"x":[724,724,724,723,719,718,715,714],"y":[104,120,127,154,182,191,215,220],"t":[1674481573722,1674481573813,1674481573819,1674481573842,1674481573865,1674481573872,1674481573904,1674481573927],"pointerType":"mouse"},{"x":[695,708,727,741,752,757],"y":[178,175,171,169,167,167],"t":[1674481574239,1674481574354,1674481574378,1674481574394,1674481574410,1674481574428],"pointerType":"mouse"},{"x":[838,835,832,830,830,832,847,860,870,873,875,875,872,861,850,839,831,828,839,852,869,887,895],"y":[144,141,136,133,130,127,121,119,119,121,125,136,157,180,204,227,243,252,250,245,239,235,233],"t":[1674481574765,1674481574793,1674481574826,1674481574844,1674481574879,1674481574895,1674481574910,1674481574926,1674481574944,1674481574960,1674481574980,1674481575012,1674481575027,1674481575042,1674481575061,1674481575076,1674481575093,1674481575109,1674481575177,1674481575193,1674481575211,1674481575227,1674481575236],"pointerType":"mouse"}]}],"height":209,"width":1920}'


In order to replay it, simple add your API key instead of '***-***' -H 'applicationKey: ***-***' , and ensure the hmac key is not request in your cloud dashboard.


As you can see, the body of the request is a simple JSON, which doesn't need to be serialized. There are no other specific rules.


Best regards,


Olivier


The demo in the dashboard works.

Can i ask for some clarity on what then `jsonString` parameter is?


It is the entire request body? Should the JSON be serialized in any specific way or are there rules on whitespace or key order?

I have just tested you key :

from the dashboard Test Panel, setting the backend url to https://cloud.myscript.com, Protocol REST, Recognition Math, click on apply

Then I wrote some math content and it was recognized as expected.


Could you please, perform the same test and confirm it is also OK?


Best regards,


Gwenaëlle

Thanks for the reply, I am using the key that isn’t revoked

Hi James,


Thank you for contacting us.


Usually the 403 error is due to a wrong hmac computation  (https://developer.myscript.com/support/account/registering-myscript-cloud#computing-the-hmac-value) or a revoked key.

I can see in your dashboard that you have 2 keys:

  1. one key that was created and revoked on April 26th.
  2. one key that was created on April 23 with hmac enabled.

Could you please, check that you are using the 2nd key and confirm that you are computing the hmac?


Best regards,


Gwenaëlle


Login or Signup to post a comment