I am trying to run some tests on TRTH v2 with the REST API receives 400 Bad Request

I am trying to run some tests with the REST API and I am running into issues. Here is my request and response:
POST https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractRaw
Authorization: Token _ZMTjszC_E1-FiDGK8UsSxrNw48pQigMcHVlIbeQGf3bhN4BOgnMGcYi_ZNhGYaAvDlQiTisxA3DraV5_qVR4H5PNti1TaAGS1LVyTg9sRvVCF4xINDMgSZjgOmn-txWQwqT9g6H3cJ78cvLTMy_6MNBbvT9yRv5KjcL8jd_L5VuC2wnk45ehU5HTkD5s2v-rP5ixRXMtLvIDdTNvOImssBfyUUy8NjoxPOZySkgE6utBXF7NmC4Ybc6uY9HiAJxW2nQPOxoDb4uAbC4J7LWbIYas3bi4VEaaq-OaB9ZhAMQ
Content-Length: 0
Content-Type: application/json; odata=minimalmetadata
Prefer: respond-async
@{"ExtractionRequest":{"ContentFieldNames":["Trade - Price","Trade - Volume"],"@odata.type":"#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.TickHistoryTimeAndSalesExtractionRequest","Condition":{"DisplaySourceRIC":"false","QueryStartDate":"2017-01-01T09:00:00.000","ReportDateRangeType":"Range","ApplyCorrectionsAndCancellations":"true","MessageTimeStampIn":"GmtUtc","QueryEndDate":"2017-01-01T10:00:00.000"},"IdentifierList":{"":"UseUserPreferencesForValidationOptions","InstrumentIdentifiers":[],"false":null,"HASH(0x11d72030)":"ValidationOptions","@odata.type":"#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.InstrumentIdentifiersList"}}}
WARNING: Bad request for url: https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractRaw
400 Bad Request
{"error":{"message":"Malformed request payload: Syntax error at Line 1, Char 59: Invalid array element type for property 'ContentFieldNames'. Expected element type of 'ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.ExtractionRequestBase', but found 'System.String'. {\"ExtractionRequest\":{\"ContentFieldNames\":[\"Trade - Pric"}}
I see this reported here: https://community.developers.refinitiv.com/questions/10093/dss-rest-api-error-400-malformed-request-payload.html
A JSON object is defined as a set of unordered name/value pairs. The reliance of TRTH API on ordered dictionary is a serious problem because it means you cannot use standard JSON libraries to create your requests.
This was first reported back in November. I am wondering if any progress has been made on fixing it?
Best Answer
-
Clarification from the content team:
"
The
Rest API uses ASP.NET Web API which is Microsoft’s implementation of OData
specifications.It’s
"
in the OData specification to specify the odata.type of a JSON object or
name/value pair. Please refer to odata json format doc
for more details on odata.type annotation. The odata.type annotation should
precede that particular type’s properties. However the properties for that type
can be unordered. Said differently, the type annotation must be the
first item after the complex type’s opening bracket, so the OData standard requires the JSON to be non-conformant.0
Answers
-
Hi Team, can I have an update on this please ? Basing on one of the old post on Dev Community <https://community.developers.refinitiv.com/questions/13604/i-am-getting-this-error-http11-400-bad-request-att.html>
I had suggested client to rerun the code on Postman tool , here is the client response :
I can confirm now that the issue is with the ordering of the JSON data. My query works when I hardcode the ordering using ordered hashes. Simply changing the order again causes it to break with the same error.
Relying on the user to code around this behavior is bad practice and I would strongly advise your developer teams to fix this. Otherwise all developers will have to do some hacky coding rather than using standard json libraries.
Please look into this on priority and provide an update.
0 -
Hi @Beera.Rajesh,
I have submitted your inquiry to the content team, and will update with any response.
For now, please continue using the expected order.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 690 Datastream
- 1.5K DSS
- 629 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 560 WebSocket API
- 39 FX Venues
- 15 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 25 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 281 Open PermID
- 46 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 2K Refinitiv Data Platform
- 724 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 95 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛