"message": "Malformed request payload: Syntax error at Line 1, Char 1: expected valid json array or
I'm making an http request to the api using the below details but I'm getting the 400 error with the above message.
URI: https://selectapi.datascope.refinitiv.com/RestApi/v1/Extractions/ExtractWithNotes
Headers:
{
"Accept": "application/json; odata.metadata=minimal",
"Authorization": "Token xxxxx",
"Content-Type": "application/json; odata=minimalmetadata; charset=utf-8"
}
Body:
{
"ExtractionRequest": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.IntradayPricingExtractionRequest",
"ContentFieldNames": [
"RIC",
"Ask Price",
"Asset Type",
"Bid Price",
"Currency Code",
"Exchange Code",
"High Price",
"Instrument ID",
"Instrument ID Type",
"Low Price",
"Open Price",
"Previous Close Date",
"Previous Close Price",
"Security Description",
"Settlement Price",
"Trade Date",
"User Defined Identifier",
"Volume"
],
"IdentifierList": {
"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
"InstrumentIdentifiers": [
{
"Identifier": "438516AC0",
"IdentifierType": "Cusip"
},
{
"Identifier": "IBM.N",
"IdentifierType": "Ric"
},
{
"Identifier": "JPYUSD=R",
"IdentifierType": "Ric"
},
{
"Identifier": "USDAUD=R",
"IdentifierType": "Ric"
},
{
"Identifier": "EURGBP=R",
"IdentifierType": "Ric"
},
{
"Identifier": "EURZAR=R",
"IdentifierType": "Ric"
},
{
"Identifier": "ZARUSD=R",
"IdentifierType": "Ric"
},
{
"Identifier": "USDZAR=R",
"IdentifierType": "Ric"
}
]
},
"Condition": { "ScalableCurrency": true }
}
}
Response:
{
"error": {
"message": "Malformed request payload: Syntax error at Line 1, Char 1: expected valid json array or json object "
}
}
Best Answer
-
I checked and found that It is a quite tricky to use DSS REST API on Azure Logic App.
First, the Azure Logic App can re-order the keys in the JSON body which causes the issue on DSS. Therefore, DSS will reject the request. The workaround is using a string variable that contains the JSON string.
Then, use this string variable in the HTTP action.
I found this solution on this page.
However, the default size of the variable is 1024 bytes so you may need to increase this default value (Runtime.Backend.VariableOperation.MaximumStatelessVariableSize). Please check the following links to change this value.
- https://learn.microsoft.com/en-us/azure/logic-apps/edit-app-settings-host-settings?tabs=azure-portal#reference-local-settings-json
- https://learn.microsoft.com/en-us/azure/logic-apps/edit-app-settings-host-settings?tabs=azure-portal#manage-host-settings
You need to change this value in host.json file.
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle.Workflows",
"version": "[1.*, 2.0.0)"
},
"extensions": {
"workflow": {
"settings": {
"Runtime.Backend.VariableOperation.MaximumStatelessVariableSize": "5000"
}
}
}
}
0
Answers
-
Hello @Huggins Mafigu,
There must be some other error in your code. I am able to use the exact request JSON message for the IntradayPricingExtractionRequest and successfully able to get the results.
{
"@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#DataScope.Select.Api.Extractions.ExtractionRequests.ExtractionResult",
"Contents": [{
"IdentifierType": "Cusip",
"Identifier": "438516AC0",
"RIC": null,
"Ask Price": null,
"Asset Type": "CORP",
"Bid Price": null,
.
.
.
"Previous Close Date": "2024-06-17",
"Previous Close Price": 0.05476,
"Security Description": "South African Rand/US Dollar FX Cross Rate",
"Settlement Price": null,
"Trade Date": "2024-06-18",
"Volume": 74067
}, {
"IdentifierType": "Ric",
"Identifier": "USDZAR=R",
"Error": "Not found"
}
],
"Notes": [***]
}0 -
@Gurpreet - I can get a successful request when I run this on Postman, but it's not giving the same results when I run this using a different platform. For example when I run this on Azure Logic App http request.
See below:
0 -
Hi @Huggins Mafigu,
I am not familiar with Azure Logic Apps, but there must certainly be something that is not correct in the request message. Are you sure the keyword json() has to encapsulate the POST data in the body?
0 -
@Jirapongse - thank you. I managed to add two steps before my HTTP request, that is, Initialize variable and Parse JSON.
Thank you for your assistance.
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛