consumes create token service by using json

Is Anybody consumes create token service by using json message format. if yes plz share service url and message format.

Best Answer

  • robin
    Answer ✓

    Here's a powershell script I use to do same. I'm sure you can work it all out from that, even if you are not using powershell, it has the api endpoint (note it must be https) the full url to point to create service token operation, the body of the request and the header for content type for json format. It then extracts the token value from the response.

    function get-trkdapiToken($app, $username, $password)
    {
    $trkdapi_url = "https://api.trkd.thomsonreuters.com"
       $trkdapi_tm_url = "$trkdapi_url/api/TokenManagement/TokenManagement.svc/REST/Anonymous/TokenManagement_1/CreateServiceToken_1"
       $trkdapi_tm_body = @"
       {
            "CreateServiceToken_Request_1":
            {
                "ApplicationID": "$app",
                "Username": "$username",
                "Password": "$password"
            }
        }


       $w = invoke-webrequest -Uri $trkdapi_tm_url -Body $trkdapi_tm_body -ContentType "application/json" -Method Post
       $b = $w.Content
       $j = $b | ConvertFrom-Json
       $r = $j.CreateServiceToken_Response_1
       $t = $r.Token
       $e = $r.Expiration
       return $t
    }