Skip Navigation
Expand
Unable to authenticate console user in Knowledge Advanced REST API
Answer ID 8447   |   Last Review Date 03/18/2019

Why won't the Knowledge Advanced REST API allow me to authenticate the console user?

Environment:

Knowledge Advanced REST API, November 2015 (and later)

Issue:

When sending a JSON or XML request payload with the console or web user credentials to the Knowledge Advanced REST API (the KA REST API), the following error message is received:

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

Resolution:

This answer refers to the documentation for the KA REST API, available from the Technical Documentation and Sample Code.

The error occurs because when following the "Getting Started, Authentication and Access" section the user has just triumphantly sent a JSON payload (following the example in the documentation) with API user credentials and received the integration token. However, when sending the console or web user credentials in the next step, the payload must be form data. This fact is commonly missed.

So the raw POST request body for the staff account with login "Alice" and password "March_Hare" on the site "example" would be:

userName=Alice&password=March_Hare&siteName=example&userExternalType=ACCOUNT

Note that it is still correct to send the kmauthtoken header as a JSON string.