Skip Navigation
Expand
Validation error when uploading content with the Knowledge Advanced REST API
Answer ID 9001   |   Last Review Date 07/08/2019

When uploading content via the Knowledge Advanced REST API, how can we fix a "Cannot perform operation..." error with error code OK-GEN0003?

Environment:

Knowledge Advanced REST API v1

Issue:

On trying to create or update an article via the Knowledge Advanced REST API, the following error message with code OK-GEN0003 is received:

"An application error has occurred. Root Cause: Cannot perform operation because of invalid input."

Resolution:

This message is returned when the content XML in your request does not match the security regular expressions (regexes) for the content type's schema attributes. Somewhere in the content is a character not allowed in that schema element. The security regex uses Perl-compatible regular expression (PCRE) syntax.

Capture the request that you are sending to the API. Compare each element of the XML with the respective regex. To view and edit the security regex fields: In Agent Desktop, navigate to Authoring > Repository > Content Types (List) and select the schema for the content type in use. Then click each attribute name. Each attribute within the schema can have its own setting, although some data types (such as dates) do not include this option.

A very quick test is to back up the current values to a text file, and then replace them with an expression that will allow any character. Here is one possibility (whitespace or not-whitespace, repeated any number of times):

[\s\S]*

If the create or update action succeeds after changing the security regex(es) to this, then the content XML does not match the original regex. You will want to further investigate the regular expressions based on your needs, and perform any necessary changes to the appropriate regex and/or the content itself before reverting to the backed-up expressions.