HTtp request throwing error.

I am trying the following code on postman with token and I got the following response

{

"error": {

"message": "The Authorization header is malformed. Supported Authorization types are Token,Basic."

}

}

for the below request

Content-Type: application/json; odata=minimalmetadata

{<!-- -->

"ExtractionRequest": {<!-- -->

"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.ElektronTimeseriesExtractionRequest",

"ContentFieldNames": [

"Ask",

"Bid",

"High",

"Last",

"Low",

"Trade Date"

],

"IdentifierList": {<!-- -->

"@odata.type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",

"InstrumentIdentifiers": [

{<!-- -->

"Identifier": "TRI.N",

"IdentifierType": "Ric"

}

],

"ValidationOptions": null,

"UseUserPreferencesForValidationOptions": false

},

"Condition": {<!-- -->

"ReportDateRangeType": "Range",

"QueryStartDate": "2015-12-01T00:00:00.000Z",

"QueryEndDate": "2015-12-02T00:00:00.000Z"

}

}

}


Best Answer

  • zoya faberov
    zoya faberov ✭✭✭✭✭
    Answer ✓

    Hello @gkusampudi ,

    I was able to run the same request via Postman, without issues. I have updated the headers to include Content-Type: application/json and odata=minimalmetadata.

    From the error message, it appears that a wrong Authorization type is applied.

    As the issue does not appear to be with the request or the headers as listed but with the authorization, suggest to work through tutorial REST API Tutorial 7: On Demand End of Day extraction by downloading Postman starter and submitting the included naked ElektronTimeseries request via Postman. If that works as expected, update request body to your request. if that also works as expected, the next step is to verify Authorization aspect in your custom code.

    Please see that the tutorial collection uses "Inherit Auth from parent" type of Authorization, which is populated with "No Auth", and passes Authorization token in Headers. if I change Authorization type to "Bearer Token" I am able to reproduce the same error as you see. Therefore, believe the aspect to verify in the code should be Authorization, and it should emulate the working approach from tutorial.

    Hope that this information is of help

Answers