General questions

Answered

access not granted

Hi, 


Why the access is not granted, I setup the application key and hmac the same from my email address, why can not get access, please check for me 

https://swaggerui.myscript.com/#/Batch%20mode/batch


image



Best Answer

Hi 


Thank you for your update. Your account looks OK, so you should be able to use your keys without any problem.


Here is a python example that you can use with your own application key  after disabling temporary your hmac key in your dashboard. This might help you investigate whether the issue comes from the hmac computation:




import requests
import json

url = "https://cloud.myscript.com/api/v4.0/iink/batch"
 
headers = {
    "Content-Type": "application/json",
    "Accept": "application/x-latex, application/json",
    "applicationKey": ""
    }
 
data = {
    "contentType": "Math",
    "strokeGroups": 
  [ 
      {"strokes": 
    [
            {
              "id": "string",
              "pointerType": "PEN",
              "pointerId": 0,
              "x": [234,237,238,239,242,244,246,247,249,250,252,253,253,253,253,253,253,253,253,253,253,253,254,255,257,258,258,262,266,273,283,297,313,325,338,345,349,353],
              "y": [90,94,98,103,110,114,118,122,125,128,131,127,123,119,114,109,105,101,98,95,91,87,82,77,71,68,65,64,64,64,64,64,64,64,64,64,64,64],
              "t": [1591943916693,1591943916790,1591943916807,1591943916824,1591943916840,1591943916857,1591943916873,1591943916889,1591943916907,1591943916924,1591943916956,1591943917207,1591943917223,1591943917240,1591943917257,1591943917274,1591943917290,1591943917307,1591943917323,1591943917357,1591943917424,1591943917524,1591943917539,1591943917556,1591943917573,1591943917590,1591943917623,1591943917840,1591943917856,1591943917873,1591943917890,1591943917906,1591943917923,1591943917940,1591943917957,1591943917973,1591943917990,1591943918007],
              "p": [0.5,0.7763932022500211,0.7185264889882718,0.7461846839143089,0.7941045496521526,0.7292125754002905,0.7292125754002905,0.7185264889882718,0.7007103955941203,0.6831899108492184,0.7007103955941203,0.7185264889882718,0.7145158745241171,0.7145158745241171,0.7436746598382117,0.7436746598382117,0.7145158745241171,0.7145158745241171,0.6761535882018319,0.6761535882018319,0.7145158745241171,0.7145158745241171,0.7461846839143089,0.7461846839143089,0.7728798232191826,0.6831899108492184,0.6761535882018319,0.7185264889882718,0.7145158745241171,0.78472787299413,0.683772233983162,0.6258342613226058,0.6,0.6535898384862245,0.639444872453601,0.78472787299413,0.7145158745241171,0.7145158745241171]
            }
        ]
      }
    ]
  }
 
response = requests.post(url, headers=headers, json=data)
 
print("Status Code", response.status_code)

print(response.text)





For a full example of REST request with hmac computation you can also refer to the following post

https://developer-support.myscript.com/support/discussions/topics/16000031800


Best regards,


Gwenaëlle


1 Comment

Answer

Hi 


Thank you for your update. Your account looks OK, so you should be able to use your keys without any problem.


Here is a python example that you can use with your own application key  after disabling temporary your hmac key in your dashboard. This might help you investigate whether the issue comes from the hmac computation:




import requests
import json

url = "https://cloud.myscript.com/api/v4.0/iink/batch"
 
headers = {
    "Content-Type": "application/json",
    "Accept": "application/x-latex, application/json",
    "applicationKey": ""
    }
 
data = {
    "contentType": "Math",
    "strokeGroups": 
  [ 
      {"strokes": 
    [
            {
              "id": "string",
              "pointerType": "PEN",
              "pointerId": 0,
              "x": [234,237,238,239,242,244,246,247,249,250,252,253,253,253,253,253,253,253,253,253,253,253,254,255,257,258,258,262,266,273,283,297,313,325,338,345,349,353],
              "y": [90,94,98,103,110,114,118,122,125,128,131,127,123,119,114,109,105,101,98,95,91,87,82,77,71,68,65,64,64,64,64,64,64,64,64,64,64,64],
              "t": [1591943916693,1591943916790,1591943916807,1591943916824,1591943916840,1591943916857,1591943916873,1591943916889,1591943916907,1591943916924,1591943916956,1591943917207,1591943917223,1591943917240,1591943917257,1591943917274,1591943917290,1591943917307,1591943917323,1591943917357,1591943917424,1591943917524,1591943917539,1591943917556,1591943917573,1591943917590,1591943917623,1591943917840,1591943917856,1591943917873,1591943917890,1591943917906,1591943917923,1591943917940,1591943917957,1591943917973,1591943917990,1591943918007],
              "p": [0.5,0.7763932022500211,0.7185264889882718,0.7461846839143089,0.7941045496521526,0.7292125754002905,0.7292125754002905,0.7185264889882718,0.7007103955941203,0.6831899108492184,0.7007103955941203,0.7185264889882718,0.7145158745241171,0.7145158745241171,0.7436746598382117,0.7436746598382117,0.7145158745241171,0.7145158745241171,0.6761535882018319,0.6761535882018319,0.7145158745241171,0.7145158745241171,0.7461846839143089,0.7461846839143089,0.7728798232191826,0.6831899108492184,0.6761535882018319,0.7185264889882718,0.7145158745241171,0.78472787299413,0.683772233983162,0.6258342613226058,0.6,0.6535898384862245,0.639444872453601,0.78472787299413,0.7145158745241171,0.7145158745241171]
            }
        ]
      }
    ]
  }
 
response = requests.post(url, headers=headers, json=data)
 
print("Status Code", response.status_code)

print(response.text)





For a full example of REST request with hmac computation you can also refer to the following post

https://developer-support.myscript.com/support/discussions/topics/16000031800


Best regards,


Gwenaëlle



1 person likes this