For a deeper look into our DataScope Select REST API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
5 1 2 2

Is there any documentation for response headers when request is invalid?

Hello.

When we send request for data and put invalid attribute, we receive response with code 400 (Bad Reqeust). This is perfectly fine. I can see all details are stored into "X-Validation-Messages" header.

Do we have any documentation about the response headers? Can the validation message model change or can we assume we will always get the response like that?


HttpResponseProxy{HTTP/1.1 400 Bad Request [Cache-Control: no-cache, Pragma: no-cache, Content-Type: application/json; charset=utf-8, Expires: -1, Server: Microsoft-IIS/7.5, X-Validation-Messages: [{"Id":"ReportTemplate.ContentFields.ContentFieldNamesMustBeValidContentFieldTypes","ItemType":"DataScope.Select.Extractions.ReportTemplates.PriceHistoryReportTemplate","ItemId":"0x0778946ebf8751ff","PropertyName":"ContentFields","Severity":4,"Message":"Invalid content FieldName \"A\"","DiagnosticMessage":null}], X-Client-Session-Id: 2c9be13f-5793-475f-a211-1ebbebe38f7a, X-Request-Execution-Correlation-Id: CiD/150533/7T6aIA.0778946ebf7751ff/RA, X-App-Id: Custom.RestApi, X-App-Version: 14.5.56.64, Date: Tue, 09 Mar 2021 14:47:01 GMT, Content-Length: 80] ResponseEntityProxy{[Content-Type: application/json; charset=utf-8,Content-Length: 80,Chunked: false]}}

Validation model contains: Id, ItemId, PropertyName, Severity, Message, DiagnosticMessage


Another question would be related to error messages, are they somewhere documented? I mean "Invalid content FieldName" etc.

I am asking because we would like to be sure if we create a response header representation on our side, and expects some error messages it will not change in some time.


Thank you,

Michał

dss-rest-apidatascope-selectdsserror-400
icon clock
10 |1500

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

Upvotes
Accepted
32.2k 40 11 20

Hello @michal.bogdal,

One of the goals of design, when integrating with DSS REST is to pinpoint and eliminate invalid/bad requests. The bad requests take up time and execution unnecessarily. I would not recommend designing into a DSS REST application a reliance on submitting invalid requests and parsing X-Validation-Messages, would suggest to tune the requests that are required during the design stage.

There are headers that are intended to investigate a specific submission, they are documented in Datascope Hosted -> Diagnostics, you will need to be logged into Datascope GUI to access the link with this information

There are also status codes that can be received from the service, they are in Datascope Hosted -> Status Codes, at least a subset of these codes is usually processed by the app.

Also, I find Extraction Notes per Extarction ID helpful, when something unexpected is found in the result, and also for Quota tracking.

icon clock
10 |1500

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

Upvotes
5 1 2 2

Thank you. Before we send extraction request we will first check if attributes provided by users are correct. For this purpose we will use following endpoint:

https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/GetValidExtractionFieldNames


Cheers,

Michał

icon clock
10 |1500

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

Upvote
32.2k 40 11 20

Hello @michal.bogdal,

This is usually done in design stage, to determine what fields to use going forward, please see REST API Tutorial 3: On Demand data extraction workflow "Get available field list", the tutorial says "this step is optional".

icon clock
10 |1500

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

Thank you.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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