question

Upvotes
Accepted
1 0 0 2

400 Bad request when calling IBES2 Methods using SoapUI

I have an account in www.trkd.thomsonreuters.com. I want to call APIs in Estimate IBES2. I generated the service token and impersonation token, referring the API documentation. WSDL file used to generate tokens is as follows.
wsdl: http://api.trkd.thomsonreuters.com/schemas/TokenManagement/wsdl/TokenManagement_1_HttpsAndAnonymous.wsdl
Soap Requests for token generation is as follows.
Service token - Refer 4.4.2.2 in the API document
Impersonation token - Refer 4.4.3.1 in the API document

After getting the impersonation token I tried to call the API to retrieve IBES2 Estimates Measures Data as refered in 48.3.1.1 in the documentaion. Provided [impersonation token] and [AppID].
But when calling the API I get 400 Bad Request. How can I call the API in 48.3.1.1 correctly?

To call the IBES2 API I used following WSDL
http://api.trkd.thomsonreuters.com/schemas/EstimatesIBES2/wsdl/EstimatesIBES2_1_HttpAndRKDToken.wsdl

rkd-apirkderror-400
icon clock
10 |1500

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

Upvotes
Accepted
13k 32 12 18

@kasun There are couple of issues with your cURL request.

Here is a working one:

curl -X POST http://api.trkd.thomsonreuters.com/api/EstimatesIBES2/EstimatesIBES2.svc/REST/EstimatesIBES2_1/GetMeasures_1 
-H "content-type: application/json;charset=utf-8"
-H "X-Trkd-Auth-ApplicationID: ****"
-H "X-Trkd-Auth-Token: ****"
-d '{"GetMeasures_Request_1": {"Symbol": {"Type": "RIC", "Value": "IBM.N"}, "Period": ""}}'
icon clock
10 |1500

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

Upvotes
13k 32 12 18

@kasun Are you developing a new application or adding on to an existing one?

icon clock
10 |1500

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

Upvotes
1 0 0 2

@Gupreet I'm going to develop a new application using python. I just try to learn how to get response from the API

icon clock
10 |1500

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

Upvotes
13k 32 12 18

@kasun You can try to use the REST/JSON interface for TRKD, as it is easy to use within Python.

I tried the EstimatesIBES2_1/GetMeasures_1 API call and am able to get data. You will have to share your code to help you solve the issue.

icon clock
10 |1500

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

To get Service token:
WSDL: http://api.trkd.thomsonreuters.com/schemas/TokenManagement/wsdl/TokenManagement_1_HttpsAndAnonymous.wsdl

<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">
    <Header>
        <To xmlns="http://www.w3.org/2005/08/addressing">https://api.trkd.thomsonreuters.com/api/TokenManagement/TokenManagement.svc/Anonymous</To>
        <MessageID xmlns="http://www.w3.org/2005/08/addressing">${=java.util.UUID.randomUUID()}</MessageID>
        <Action>http://www.reuters.com/ns/2006/05/01/webservices/rkd/TokenManagement_1/CreateServiceToken_1</Action>
    </Header>
    <Body>
        <CreateServiceToken_Request_1 xmlns:global="http://www.reuters.com/ns/2006/05/01/webservices/rkd/Common_1" xmlns="http://www.reuters.com/ns/2006/05/01/webservices/rkd/TokenManagement_1">
            <ApplicationID xmlns="http://www.reuters.com/ns/2006/05/01/webservices/rkd/Common_1">[AppID]</ApplicationID>
            <Username>[Username]</Username>
            <Password>[Password]</Password>
        </CreateServiceToken_Request_1>
    </Body>
</Envelope>

To get Impersonation token:

WSDL: http://api.trkd.thomsonreuters.com/schemas/TokenManagement/wsdl/ TokenManagement_1_HttpsAndAnonymous.wsdl

<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">
    <Header>
        <To xmlns="http://www.w3.org/2005/08/addressing">https://api.trkd.thomsonreuters.com/api/TokenManagement/TokenManagement.svc/Anonymous</To>
        <MessageID xmlns="http://www.w3.org/2005/08/addressing">${=java.util.UUID.randomUUID()}</MessageID>
        <Action>http://www.reuters.com/ns/2006/05/01/webservices/rkd/TokenManagement_1/CreateImpersonationToken_2</Action>
        <Authorization xmlns="http://www.reuters.com/ns/2006/05/01/webservices/rkd/Common_1">
            <ApplicationID>[AppID]</ApplicationID>
            <Token>[Impersonation Token]</Token>
        </Authorization>
    </Header>
    <Body>
        <CreateImpersonationToken_Request_2 xmlns="http://www.reuters.com/ns/2006/05/01/webservices/rkd/TokenManagement_1">
            <ApplicationID xmlns="http://www.reuters.com/ns/2006/05/01/webservices/rkd/Common_1">[AppID]</ApplicationID>
            <Username>[username]</Username>
            <Password>[password]</Password>
            <EffectiveUsername userType="Reuters">[username]</EffectiveUsername>
        </CreateImpersonationToken_Request_2>
    </Body>
</Envelope>

IBES2 Estimates Measures Data (Using SOAP)
WSDL: http://api.trkd.thomsonreuters.com/schemas/EstimatesIBES2/wsdl/EstimatesIBES2_1_HttpAndRKDToken.wsdl

<Envelope xmlns=”http://www.w3.org/2003/05/soap-Envelope”> 
    <Header> 
        <To xmlns=”http://www.w3.org/2005/08/addressing”>http://api.trkd.thomsonreuters.com/api/EstimatesIBES2/EstimatesIBES2.svc</To> 
        <MessageID xmlns=”http://www.w3.org/2005/08/addressing”>[Unique Message ID]</MessageID> 
        <Action>http://www.reuters.com/ns/2011/12/02/webservices/rkd/EstimatesIBES2_1/GetMeasures_1</Action> 
        <Authorization xmlns=”http://www.reuters.com/ns/2006/05/01/webservices/rkd/Common_1”> 
          <ApplicationID>[AppID]</ApplicationID> 
          <Token>[Impersonation token with 289 characters]</Token> 
        </Authorization> 
    </Header> 
 <Body> 
      <GetMeasures_Request_1 xmlns="http://www.reuters.com/ns/2016/02/01/webservices/rkd/EstimatesIBES2_1" xmlns:xsd=http://www.w3.org/2001/XMLSchema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Symbol>
            <Value>IBM.N</Value>
         </Symbol>
         <RequestOptions>
            <IncludeSymbolInfo>true</IncludeSymbolInfo>
         </RequestOptions>
      </GetMeasures_Request_1>
 </Body>
</Envelope>
Upvotes
1 0 0 2

@Gurpreet. As you requested I tried to call using Rest API. Follow shows the curl command of the POST request. Still get 400 Bad request.

curl -X POST \
  http://api.trkd.thomsonreuters.com/api/EstimatesIBES2/EstimatesIBES2.svc \
  -H 'Accept: */*' \
  -H 'Action: http://www.reuters.com/ns/2011/12/02/webservices/rkd/EstimatesIBES2_1/GetMeasures_1' \
  -H 'Authorization: {"ApplicationID": "[AppID]", "Token": "[Impersonate token with 289 characters]"}' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/soap+xml' \
  -H 'Host: api.trkd.thomsonreuters.com' \
  -H 'MessageID: ${=java.util.UUID.randomUUID()}' \
  -H 'accept-encoding: gzip, deflate' \
  -H 'cache-control: no-cache' \
  -H 'content-length: 169' \
  -d '{
   "GetMeasures_Request_1": {
      "Symbol": {
         "Value": "IBM.N"
      },
      "RequestOptions": {
         "IncludeSymbolInfo": true
      }
   }
}'
icon clock
10 |1500

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

Upvotes
1 0 0 2

@Gurpreet. Thanks it works.

By the way can you tell me curl command to get Service token and Impersonation token?

curl -X POST \ http://api.trkd.thomsonreuters.com/api/TokenManagement/TokenManagement.svc/REST/TokenManagement_1/CreateServiceToken_1 \ -H 'Action: http://www.reuters.com/ns/2006/05/01/webservices/rkd/TokenManagement_1/CreateServiceToken_1' \ -H 'Authorization: Basic dHJrZC1kZW1vLXdtQHRob21zb25yZXV0ZXJzLmNvbTpsNG82ZzMxbXo=' \ -H 'Content-Type: application/json;charset=utf-8' \ -H 'Host: api.trkd.thomsonreuters.com' \ -H 'MessageID: 1560962043' \ -H 'To: http://api.trkd.thomsonreuters.com/api/TokenManagement/TokenManagement.svc/REST/TokenManagement_1/CreateServiceToken_1' \ -H 'content-length: 174' \ -d '{ "CreateServiceToken_Request_1": { "ApplicationID": "[AppID]", "Username": "[username]", "Password": "[password]" } }' 

Above is the curl command I tried for service token. Response is as below

{ "Fault": { "Code": { "Value": "Receiver", "Subcode": { "Value": "a:General_UnhandledException" } }, "Reason": { "Text": { "lang": "en-US", "Value": "The message with Action 'http://www.reuters.com/ns/2006/05/01/webservices/rkd/TokenManagement_1/CreateServiceToken_1' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None)." } }, "Detail": { "ClientErrorReference": { "Timestamp": "2019-06-19T16:35:46.5096532Z", "ErrorReference": "50f6c5a58d8445cd9a79c1552355aecf", "ServerReference": "D046D2F28F742103D4E3F226A47FB35F0B7B127121B9875C" } } } } 

Where did I get wrong here?

icon clock
10 |1500

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

Upvotes
13k 32 12 18

To get the service token use:

curl -X POST https://api.trkd.thomsonreuters.com/api/TokenManagement/TokenManagement.svc/REST/Anonymous/TokenManagement_1/CreateServiceToken_1
-H "content-type: application/json;charset=utf-8"
-d '{"CreateServiceToken_Request_1": { "ApplicationID": appid, "Username": username, "Password": password }}'


Response:
{
"CreateServiceToken_Response_1": {
"Expiration": "2019-06-19T21:09:29.8996736Z",
"Token": "****"
}
}
icon clock
10 |1500

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

Click below to post an Idea Post Idea