GetAppIdToken Method

Returns a tokenized AppID which can be used as the AppID parameter in any method (except GetAppIdToken()). A tokenized AppID should be used when the appID must be kept secret.

Syntax

URI

http://api.microsofttranslator.com/V2/Ajax.svc/GetAppIdToken

Parameters

Parameter Description

appId

A string containing AppID

minRatingRead

An int to define the minimum rating translations require to be returned. The recommended minRatingRead is 5 as this will only include automatic translations and authority approved translations.

maxRatingWrite

An int to define the maximum rating that a user can write with using this token. The recommended maxRatingWrite is from 1 to 4 for anonymous users, and from 6 to 10 for authoritative users whom you trust. Translations with ratings of 5 or higher will replace automatic translations when calling Translate() or TranslateArray() with the same appId. Translations with ratings lower then 5 will only be returned when calling GetTranslations() or GetTranslationsArray().

expireSeconds

An int that defines the duration in seconds from now that the token is valid. The value can be between 1 and 86400 (24 hours).

Return value

A string representing the tokenized identification for the calling application.

Example
                                    
    <script type="text/javascript">

        function getAppIdToken() {
            window.mycallback = function(response) { alert("The tokenized AppID is:" + response); 
            }

            var s = document.createElement("script");
            s.src = "http://api.microsofttranslator.com/V2/Ajax.svc/GetAppIdToken?oncomplete=mycallback&appId=myAppId&minRatingRead=5&maxRatingWrite=4&expireSeconds=60";
            document.getElementsByTagName("head")[0].appendChild(s);
        }
    </script>