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ł

Best Answer

  • 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.

Answers