locked
Problem with Microsoft Translator API (Parameter: Text is not of type String) RRS feed

  • Question

  • Hello, We've been using Microsoft Translator API for a long time and now we have a problem with a standard method:

    curl --basic --data "From=en&Text=Hello%20Moto&To=nl" -u "user:Primary_Account_Key" https://api.datamarket.azure.com/Bing/MicrosoftTranslator/v1/Translate

    As a response we get: "Parameter: From is required but has not been provided",
    Sometimes for some reason it shows the same error but for "to" and "from".
    Sometimes it says "Parameter: Text is not of type String".

    Here it shows that this method should work https://yadi.sk/i/3ftrEF3chcMax
    Here is the request: https://yadi.sk/i/R4_hjPFzhcMo4
    Here is the link for this request https://www.runscope.com/public/b6acc250-67f9-4cca-9473-49f9aeb36528/61994e59-1563-41bc-9e6f-47df08e686b7

    We are looking for the solutions, what is wrong with the API?

    Kind Regards,

    Leo

    Wednesday, July 1, 2015 10:18 PM

Answers

  • Hi Leo,

    you can request as many tokens as you need. We strongly recommend to reuse the token per process, but each process can and should have its own, different token. We do not recommend to share tokens across processes. A token does not expire when you request a new one. Each token has an independent lifetime of 10 minutes.

    Token expiration is a security measure to limit unauthorized access to your balance.

    Our sample code includes automatic renewal of the token before expiration. Look at admauthentication.cs in https://github.com/MicrosoftTranslator/DocumentTranslator/tree/master/TranslationServices.Core as an example.

    If you can send your available times to translator at microsoft dot com, we can arrange for a call.

    Hope this helps,
    Chris Wendt
    Microsoft Translator

    Wednesday, July 15, 2015 7:42 PM

All replies

  • Dear Leo,

    You can find information on how to use the v2 version of the HTTP API here:
    - https://msdn.microsoft.com/en-us/library/ff512387.aspx

    Please try this and let us know if this resolves the issues you experience.

    Best regards,
    Christian Federmann (Microsoft Translator team)


    Microsoft Translator team - www.microsoft.com/Translator

    Monday, July 6, 2015 6:01 AM
  • Hi Christian,

    Thank you for your response.

    We are doing quite a lot of request in a row and from our point of view, 10-minutes access token is not really good idea.

    Currently our process may take much more then 10 minutes, sometimes sending ~10k requests mostly with a single word only and as you may see your non RESTful format is really non-scalable in this case. Maybe you can recommend the way to extend usage of access token to day / month / year base?

    Also, we've tried to test your API v.2 and it seems it does't work properly — we just can't obtain right Access Token, it responses with weird way (https://yadi.sk/i/AYJMlrL6hqZZs).

    Also, if you get new token — old will expiry which is also not perfect architecture (it was announced of 10-minutes live time, but not until the next request).

    It is REALLY bad and mostly impossible to implement your API to multi-threading tasks. If you can provide direct consultation I’ll be happy to speak to you on Skype.

    Kind Regards,

    Leo

    • Edited by LeoDace Monday, July 13, 2015 2:55 PM
    Monday, July 13, 2015 2:45 PM
  • Hi Leo,

    you can request as many tokens as you need. We strongly recommend to reuse the token per process, but each process can and should have its own, different token. We do not recommend to share tokens across processes. A token does not expire when you request a new one. Each token has an independent lifetime of 10 minutes.

    Token expiration is a security measure to limit unauthorized access to your balance.

    Our sample code includes automatic renewal of the token before expiration. Look at admauthentication.cs in https://github.com/MicrosoftTranslator/DocumentTranslator/tree/master/TranslationServices.Core as an example.

    If you can send your available times to translator at microsoft dot com, we can arrange for a call.

    Hope this helps,
    Chris Wendt
    Microsoft Translator

    Wednesday, July 15, 2015 7:42 PM