Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Events to CONNECT

FailedRequests Controller

  • Last UpdatedApr 19, 2024
  • 1 minute read

This route is used by AVEVA Events to CONNECT to send the error response for failed requests to CONNECT data services.

C# Example:

[Route("api/[controller]")]

[Authorize]

[ApiController]

public class FailedRequestsController : ControllerBase

{

[HttpPost]

public async Task<IActionResult> Post()

{

// Read request body

var requestBody = await Request.GetJsonStringFromBody().ConfigureAwait(false);

if (string.IsNullOrEmpty(requestBody))

{

return StatusCode(StatusCodes.Status400BadRequest, new { message = "The requestBody is invalid" });

}

var jsonObject = JToken.Parse(requestBody!);

// TODO: Add code to store the error response

// Respond with appropriate status code

return Created(string.Empty, jsonObject);

}

}

The Failed Requests endpoint route will receive a JSON object with a structure similar to the following:

{

"MessageHeaders": {

"MessageType": "Events",

"MessageTypeDetails": {

"TypeId": "SampleEventType1304944",

"TypeName": null,

"EventId": null

},

"MessageAction": "Create"

},

"RequestContent": [

{

"property1": "SampleEventType1304944_1413463444",

"property2": 5,

"updateby": "SampleEventType1304944_125688679",

"id": "SampleEventType1304944_900805318",

"eventStartTime": "2023-07-03T08:59:15Z"

},

{

"property1": "SampleEventType1304944_916773632",

"property2": 25,

"updateby": "SampleEventType1304944_1668262035",

"id": "SampleEventType1304944_1692976233",

"eventStartTime": "2023-07-03T08:59:30Z"

}

],

"HttpStatusCode": 207,

"ResponseContent": {

"Reason": "See child errors",

"Error": "Some of the elements in the request failed.",

"Data": [

{

"id": "SampleEventType1304944_900805318",

"eventStartTime": "2023-07-03T08:59:15Z",

"severityCat": {

"id": "critical"

}

}

],

"ChildErrors": [

{

"StatusCode": 412,

"Reason": "OPTIMISTIC_CONCURRENCY_ERROR",

"Error": "Optimistic concurrency error",

"Id": "SampleEventType1304944_1692976233"

}

]

},

"EventMessageException": null

}

TitleResults for “How to create a CRG?”Also Available in