question

lalit8 avatar image
13 3 3 7

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.

rkd-apirkdjsonquery-string
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

robin avatar image
141 1 4 1

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
}


10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.