KB Article #182615

REST API: Creating subscription with the values triggerFileOption and fileRetentionPeriod

Problem

If you try to execute a cURL request for the creation of a subsription using API v1.4 with the attributes triggerFileOption and fileRetentionPeriod like in the example below:


curl -u ADMINUSER:ADMINPASS -X POST "https://HOSTNAME:ADMINPORT/api/v1.4/subscriptions" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"subscriptions\":[{\"folder\":\"/send2/app13437\",\"maxParallelSitPulls\":\"10\",\"flowAttrsMergeMode\":\"preserve\",\"encryptMode\":\"default\",\"postTransmissionActions.triggerfileOption\":\"fail\", \"fileRetentionPeriod\": \"0\",\"submitFilenamePatternExpression\":\"*\",\"submitFilterType\":\"FILENAME_PATTERN\", \"triggerOnConditionEnabled\": \"true\", \"submitFilterType\": \"TRIGGER_FILE_CONTENT\", \"triggerOnConditionExpression\": \"${stenv['target'].matches('.*_CTL_.*')?1:0}\",\"account\":\"ACCOUNT3\",\"application\":\"AR\"}]}"


You will face an error message stating that the request can't be validated due to invalid properties:


{
"validationErrors": [
"Invalid props: fileRetentionPeriod, postTransmissionActions.triggerfileOption"
],
"docLink": "https://HOSTNAME:ADMINPORT/api/v1.4/docs/index.html",
"message": "Error validating request"
}


Resolution

A workaround will be to use APIv2.0, where this behaviour is not observed. An example of a valid curl command with both parameters can be found below:


curl -u ADMINUSER:ADMINPASS -X POST "https://HOSTNAME:ADMINPORT/api/v2.0/subscriptions" -H "accept: */*" -H "Content-Type: application/json" -d "{\"type\":\"AdvancedRouting\",\"folder\":\"/send2/app13438\",\"account\":\"ACCOUNT3\",\"application\":\"AR\",\"maxParallelSitPulls\":0,\"subscriptionEncryptMode\":\"false\",\"fileRetentionPeriod\":0,\"postTransmissionActions\":{\"triggerFileOption\":\"string\"}}"