REST services for knowledge questions
We can use REST services to manage knowledge questions. Users can perform self care management operations to retrieve, create, update, and delete knowledge questions. We 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.
- 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.
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 registered for a user
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.
Attribute Examples Name: username Description: the username
Data type: String 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
- 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?" } ] }Parent topic: Developing for Advanced Access Control