Trying to create a global request naming rule for all my custom services as requests now are named {CustomService:Class}.{CustomService:Mehod} - I would like to change request name per default to {CustomService:Method} only by using Configuration API to post a request naming rule. Can't get my request validated. The one thing I need to check is that CUSTOMSERVICE_CLASS exists; tried this:
{
"enabled": true,
"namingPattern": "{CustomService:Method}",
"conditions": [
{
"attribute": "CUSTOMSERVICE_CLASS",
"comparisonInfo": {
"type": "BOOLEAN",
"comparison": "EXISTS",
"negate": false
}
}
]
}
Gets this:
{
"error": {
"code": 400,
"message": "Constraints violated.",
"constraintViolations": [
{
"path": "conditions[0].attribute",
"message": "Request naming condition invalid combination of type, attribute and matcher",
"parameterLocation": "PAYLOAD_BODY",
"location": null
}
]
}
}
Any ideas what's wrong/missing in my request? Also tried adding "value": true. Figured I could create exact same rule for one single custom service through GUI, read from API to fetch the definitions - but fetching all request naming rules gave no content.
Solved! Go to Solution.
The documentation is a bit lacking here, I had a similar issue yesterday.
When fetching the rules from the API, only global rules are returned, that is why your work around wasn't possible, I tried the same 😉
I wanted to check that a certain request attribute exists, I got that wo work with:
{
"enabled": true,
"namingPattern": "Test - {RequestAttribute:Lasttest NA}",
"conditions": [
{
"attribute": "SERVICE_REQUEST_ATTRIBUTE",
"comparisonInfo": {
"type": "STRING_REQUEST_ATTRIBUTE",
"comparison": "EXISTS",
"value": null,
"negate": false,
"requestAttribute": "Lasttest NA",
"caseSensitive": false
}
}
],
"placeholders":
}
I tried the value field first aswell, but the error actually said that requestAttribute had do be present.
From your error message I would conclude that CUSTOMSERVICE_CLASS can't be comined with the EXISTS matcher.
I would try it like this:
{
"enabled":true,
"namingPattern":"{CustomService:Method}",
"conditions":[
{
"attribute":"CUSTOMSERVICE_CLASS",
"comparisonInfo":{
"type":"STRING",
"comparison":"EQUALS",
"value":"..yourClassToMatch..",
"negate":false
}
}
]
}
Thanks, using EQUALS (or I ended up using CONTAINS) worked fine! Would be kind of interesting finding out correct syntax for using EXISTS as well though. Fiddling around with "lasttest" I see, fellow Swede?
German actually 😉
Yes, the documentation should definitely be enhanced a bit here. Either by adding more examples or including the possible combinations and fields that aren't mentioned in the current example.
I already submitted this via usersnap in the documentation though.