question

Upvotes
Accepted
262 8 9 15

Intraday Summaries extraction on TRTHv2 using Python language resulting '{"error":{"message":"Malformed request payload: \'@odata.type\' is either missing or misplaced for type ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.ExtractionRequest"}}'

error-msg-1.pngtrth-ondemand-intradaybars.txtOne of our clients trying to extract Intraday Summaries data from TRTHv2 using Python language but receiving '{"error":{"message":"Malformed request payload: \'@odata.type\' is either missing or misplaced for type ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.ExtractionRequest"}}'

pythontick-history-rest-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
Accepted
13.7k 26 8 12

@Beera.Rajesh, the code is that from one of our samples. Content field names, identifier and time range were changed. The code runs fine for me as well.

This error occurs when the order of the elements of a JSON request is not preserved. This is because the API expects to receive the @odata.type as first item; if that is not the case, then you get this specific error.

I'm guessing your customer is importing an old version of the requests library, which does not respect the order. I'm using requests version 2.12.4, it works fine.

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
262 8 9 15

tested-on-my-end-successfull-without-error.png

When I test on my end, I don't see an error (attached) . Please suggest what can be the reason for client side error


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