Question

POST Operations for Events with Assyst API

  • 3 November 2022
  • 2 replies
  • 319 views

We’ve been experimenting with the API and we’re wondering if there is an example of a POST request for an Event. The documentation on https://wiki.axiossystems.com/assyst11-3Wiki/index.php/Integrations:assystREST#Requests shows what the format of the request would look like but not all the required fields. I have looked through the resource schema on to find what fields are mandatory on events, every single field under events has a minOccurs attribute so that leads me to believe that none of the fields are mandatory?

 

It would help our understanding to see an example of a POST request for an event with all of the mandatory fields. Where could we find one for reference?


2 replies

Userlevel 3
Badge +12

Hello Ashton,

You can find some examples at the following link assystREST More Examples
 

The mandatory fields required can vary, depending on data setup, but generally you will need at least remarks, affectedUser, item and category.

I hope this will help.

Kind Regards,
Caroline

Userlevel 2
Badge +5

Following on from what Caroline suggests, the assystREST API is designed to be discoverable, so issuing a POST request with a blank body should return meaningful validation messages directing you what properties are required (and from there you should be able to adjust your request).

 

The mandatory properties will vary depending on circumstance. You are right that the schema defines no mandatory fields, this is because assyst contains a number of defaulting mechanisms (Import Profiles, Event Builders, Service Offerings, system defaults) which will default a missing value depending on circumstance. 

 

For example, if I issue this request to an assyst server:

 

POST https://{server}/assystREST/v2/events

Content-Type: application/json

Accept: application/json

BODY {}

 

I get this as a response:

 

{

    "type": "ComplexValidationException",

    "messageKey": "rest.exceptions.Exception",

    "errors": [

        {

            "rule": "mandatoryEventType",

            "field": "eventType",

            "messageKey": "server.validation.errors.mandatoryEventType",

        }

    ]

}

 

If I update the request in response to include that missing field: 

 

POST https://{server}/assystREST/v2/events

Content-Type: application/json

Accept: application/json

BODY {“eventType”: 1}

 

The response becomes:
 

{

    "type": "ComplexValidationException",

    "messageKey": "rest.exceptions.Exception",

    "errors": [

        {

            "rule": "mandatorySlaTimeToRespond",

            "field": "timeToRespondSla",

            "messageKey": "server.validation.errors.mandatorySlaTimeToRespond"

        },

        {

            "rule": "mandatoryAffectedUser",

            "field": "affectedUser",

            "messageKey": "server.validation.errors.mandatoryAffectedUser"

        },

        {

            "rule": "isPriorityValidOrDefault",

            "field": "priorityDerived",

            "messageKey": "server.validation.errors.isPriorityValidOrDefault"

        },

        {

            "rule": "mandatoryItemA",

            "field": "itemA",

            "messageKey": "server.validation.errors.mandatoryItemA"

        },

        {

            "rule": "mandatorySeriousness",

            "field": "seriousness",

            "messageKey": "server.validation.errors.mandatorySeriousness"

        },

        {

            "rule": "mandatoryCategory",

            "field": "category",

            "messageKey": "server.validation.errors.mandatoryCategory"

        },

        {

            "rule": "mandatoryPriority",

            "field": "priority",

            "messageKey": "server.validation.errors.mandatoryPriority"

        },

        {

            "rule": "mandatorySection",

            "field": "department.section",

            "messageKey": "server.validation.errors.mandatorySection"

        },

        {

            "rule": "mandatoryBuilding",

            "field": "room.building",

            "messageKey": "server.validation.errors.mandatoryBuilding"

        },

        {

            "rule": "cannotDeriveSla",

            "field": "sla",

            "messageKey": "server.validation.errors.cannotDeriveSla"

        }

    ]

}

 

And so on. 

 

(We also welcome feedback about the usability of the API itself and would suggest any improvements or extra documentation you need be raised as a suggestion in the Ideas forum)

Reply