Create event via the API with a null value for a list

Not Yet Reviewed

Hey Guys,

Can I just check if the following should or shouldn't be allowed...

"Create an event via the API with a null value for a list"

Currently get the following back out the API:

{"type":"DATA_VALIDATION_ERROR","message":"There are data validation errors in the form.","errorDetails":[{"jsonPath":"properties/IT.","details":"Specified value not found in the list of configured values"},{"jsonPath":"properties/IT","details":"Specified value not found in the list of configured values"}]}

We understand null is not configured hence the error but wanted to ask the question. 

If null are allowed the code in our script is alot cleaner as we only have to build one request, if not we'll have to create a number of "if else" statements and omit null from being submitted in the first place which works but balloons the code.... we like less code :)

As ever thanks in advance!

George

 

0

Comments

3 comments
Date Votes

Please sign in to leave a comment.

  • Hey George!

       That's an interesting question. I was able to successfully get this empty list in:

    {
    "properties": {
    "Message": "This is a message",
    "Test List": []
    },
    "recipients": [{ "targetName": "tdepuy" }]
    }

    Then I added "null" to the list of values and this worked:

    {
    "properties": {
    "Message": "This is a message",
    "Test List": [ null ]
    },
    "recipients": [{ "targetName": "tdepuy" }]
    }

    One last test I did was:

    {
    "properties": {
    "Message": "This is a message",
    "Test List": null
    },
    "recipients": [{ "targetName": "tdepuy" }]
    }

     

    So, yes, but I guess it comes down to what you want to do with that value after you get it into xMatters. In the Event Reoport > Properties tab, I did see the value properly reflected in each of these. 

    Do you have a sample payload you can share? Or details on exactly what you want it to look like?

    Happy Monday!
        --- Travis

    0
  • Hey Travis,

    After reviewing we were pushing the boundaries beyond what I think is possible.

    We wanted to create a single subscription form for a communication plan where the criteria was based on the values in a number of lists. Works until we want to select more than 1 value in the same list so is a no go.

    We have come up with another solution... not using subscriptions but back to sending to groups pre-selected based on a scenario.

    Thanks for your help

    Dave

    0
  • Aw darn. Yea, we've discussed various things around the subscriptions and there are a small subset of use cases that they don't work well or are not worth the effort for. 

    Do you have a specific request I can take back to product management? We can see how it would fit in with our other use cases and the general subscription road map. 

    In any case, glad to be of assistance. Let us know if we can help any further.

    Happy Thursday!
       --- Travis

    0

Didn't find what you were looking for?

New post