REST services for knowledge questions

You can use REST services to manage knowledge questions.

Users can perform self care management operations to retrieve, create, update, and delete knowledge questions. You can use REST services to support these operations.

The knowledge question attributes are:

  • id

    The unique ID of the question

  • answer

    The user-supplied answer to the question

  • question

    The text of the user defined question

The base URL for all the self-care management REST interfaces for knowledge questions is:

https://<WebSEAL host>:<port>/<junction_name>/sps/mga/user/mgmt/

The REST interfaces represent a collection of questions. The URI template is /questions.

Note:
  • For all methods, the response type for Accept Header and Content-Type Header is application/json.
  • Sorting, filtering, and paging are not supported.
  • Users must authenticate in order to use the REST services.

Table 1. REST interface for managing knowledge questions

A list of the methods, a description, and the URL for the REST interface.

Method Operation URL Response
GET

Retrieve a list of questions for a user.

http://<WebSEAL host>:<port>/<junction_name>/sps/mga/user/mgmt/questions

Response code: 200 OK

The response is a JSON array of questions and JSON objects. To view an example response, see User questions REST model

POST

Create all the questions for a user.

Response code: 201 CREATED

PUT

Update all the questions for a user

Response code: 204 NO CONTENT

DELETE

Delete all questions that are registered for a user

Table 2. Error responses

A list of the methods and error responses.

Method Error Response
POST

Response code: 400 BAD REQUEST

Response type: application/json

Explanation: Malformed question found. Possible reasons:

  • No answer submitted.
  • Non-Unique Questions ID

    The ID for each question must be unique for each user. The ID does not have to be globally unique.

PUT

User questions REST model

The following table lists the attributes for user knowledge questions.

Table 3. Attributes for user questions

A list of the attributes, a description of each, and examples.

Attribute Examples
Name: username

Description: the username

Data type: String

Note: Only provided on the response for a GET
"sec_master"
Name: questions

Description: the list of knowledge questions

Data Type: JSON array of JSON objects

Note:
  • The caller supplies the id value. However, for PUT or POST methods if id is not provided the server generates a unique id for the question.
  • The parameter question is optional
  • The answer attribute will be obfuscated (replaced by the asterisk symbol "*") on responses.

Example questions:

[
  {
    "id": "1",
    "answer"     : "Smith",
    "question"   : "What is your mother's maiden name?"
  },
  { 
    "id": "2",
    "answer"     : "Bandit",
    "question"   : "What is your Pet's name?"
  }
]
Name: result

Description: An error message that indicates the nature of the failure.

Datatype: String

{ 
    "result": "FBTRBA310E The user knowlege questions
               answer(s) could not be stored because 
               a duplicate question unique identifier 
               [1] was included on the user questions."
}

Example JSON representation of a collection of knowledge questions

The following example shows the JSON representation of a collection of knowledge questions that belong to a user.

{
  "username": "sec_master",
  "questions" : [
               {
                "id"    : "1",
                "answer"  : "******",
                "question"   : "What is your mother's maiden name?"
               },
               {
                "id"    : "2",
                "answer"  : ********,
                "question"   : "What is your Pet's name?"
               }
              ]
}