locked
Documentation Clarification RRS feed

  • Question

  • I'm having a difficult time following the API docs for the HTTP interface. The parameters seem to mix query strings in the URI with things they expect as XML in the body of the request, but do not specify which is which except for in the code examples. The XML expected in both the request and returned in the response seems undocumented as I cannot find it. Since I am not working under .NET and do not have the various resources the code examples use, using this API is just about impossible.

    Could someone clarify things with example requests and responses, please? That would be most useful, thank you.

    Saturday, June 25, 2011 11:15 PM

Answers

  • The HTTP interface has two flavors - Get and Post. For simple operation, such as Translate, it uses Http GET, which means you use the URL query string to pass in the parameters. For complex one, such as TranslateArray, the URL query string is not sufficient to pass in complex object. In this case, it uses HTTP POST, which uses the body to pass in the parameters. However, there is no case to use both URL and Body to pass in parameters.

    When you look at the API doc, it differeitates Http Get from Http Post. The example also shows the difference.

    I hope this help.

    • Marked as answer by Vikram Dendi Tuesday, June 28, 2011 6:57 AM
    Tuesday, June 28, 2011 6:55 AM

All replies

  • Sorry to hear that the documentation wasn't clear. Have you looked at the interactive SDK: http://sdk.microsofttranslator.com ? I have asked one of my colleagues to help with this request.

     


    Vikram Dendi, Group Product Manager
    Microsoft Translator
    Tuesday, June 28, 2011 6:50 AM
  • The HTTP interface has two flavors - Get and Post. For simple operation, such as Translate, it uses Http GET, which means you use the URL query string to pass in the parameters. For complex one, such as TranslateArray, the URL query string is not sufficient to pass in complex object. In this case, it uses HTTP POST, which uses the body to pass in the parameters. However, there is no case to use both URL and Body to pass in parameters.

    When you look at the API doc, it differeitates Http Get from Http Post. The example also shows the difference.

    I hope this help.

    • Marked as answer by Vikram Dendi Tuesday, June 28, 2011 6:57 AM
    Tuesday, June 28, 2011 6:55 AM
  • Ah, that makes sense. Now for the XML schema, I'm assuming it's just whatever the .NET code produces as serialized structures and nothing special?
    Those who deny freedom to others, deserve it not for themselves" -- Abraham Lincoln
    Tuesday, June 28, 2011 7:03 AM
  • You are right. There is nothing special there. When you pass in the XML doc as the the body, .NET will deserialize it back to CLR objects on the service side. So please pay attention to the namespaces for the xml elements from the sample code.

    Tuesday, June 28, 2011 7:12 AM