Cloud Development Kit

Sample HTTP Request in JSON format

I am building a small test desktop app in VB.NET so that I can test the MyScript Cloud. I have both an applicationkey and an HMAC.

I am attempting to send a simple POST request to using an HTTP Client.

Using client As HttpClient = New HttpClient()

client.DefaultRequestHeaders.Accept.Add(New MediaTypeWithQualityHeaderValue(application/json))

Using response As HttpResponseMessage = Await client.PostAsync(recognitionCloudURL, New StringContent(inputtext, Encoding.UTF8, application/json))
Using content As HttpContent = response.Content
Dim result As String = Await content.ReadAsStringAsync()
If result IsNot Nothing Then
End If
End Using
End Using
End Using

Whatever I try I always get the same result.... Required String parameter 'applicationKey' is not present

I have searched the MyScript website and studied the forum posts but I cannot find a sample HTTP/REST request that shows how the application key together with textInput is passed in JSON format.

Please paste in a sample I can use for basic testing.

Many thanks

Thank you so much. I tested with the sample code and it is working fine. I can now work on with a desktop application.

Dear Chris,
Thanks for your e-mail.

We have checked with our developer team and at first sight, it seems your code missed the api key and hmac key parameters inside of your request. The Hmac key is not mandatory but as it is a security parameter, we recommend to use it, however it requires additional coding to use it properly, as mentioned in the following doc section:

As we understand it is not really obvious and we want to facilitate your implementation, we have added a sample, so you can start testing on this website:
Don't forget to replace api key and hmac key default values with yours.

Best regards

Dear Chris,
Thanks for your request.
I invite you to check the following documentation about the way to send JSON request:

Each JSON request should include the following parameters:
textInput={inputUnits: [{textInputType: MULTI_LINE_TEXT, components: [{y: [588.0880, 587.3380, 587.7130, 603.0910, 621.0930, 615.0920], x: [116.879, 116.879, 116.879, 120.63, 122.505, 120.63], type: stroke},...}

To better help, you can send your request per e-mail at devportal.admin[at], so we can do additional testing on our side.

Best regards

Login or Signup to post a comment