Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api documentation for review flow API #98

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
description: >-
This API is used to read an existing comment for a question set on the Sunbird-inQuiry
Platform.
---

# Read Comment QuestionSet

{% swagger method="get" path="/comment/read/{QuestionSet_Id}" baseUrl="" summary="This API is used to read an existing comment for a question set on the Sunbird-inQuiry Platform." expanded="true" %}
{% swagger-description %}
• The <mark style="color:orange;">/questionset/v1/comment/read/{QuestionSet\_Id}</mark> endpoint executes a request for fetching the read comment data.\
• This API returns the metadata of the question set containing the information related to read comment.\
• The endpoint for reading QuestionSet comment is <mark style="color:orange;">`/questionset/v1/comment/read`</mark>\
• It points to inquiry-api-service (assessment service) - <mark style="color:orange;">/questionset/v4/comment/read/</mark>\
• You need to provide a valid QuestionSet Id value in <mark style="color:orange;">{QuestionSet\_Id}</mark> field of the API URL. \
• It is mandatory to provide values for parameters marked with <mark style="color:red;">\*</mark>\
• Mandatory fields cannot be null or empty.
{% endswagger-description %}

{% swagger-parameter in="path" name="QuestionSet_Id" type="String" required="true" %}
Append a valid Question Set Id To the Request URL
{% endswagger-parameter %}

{% swagger-parameter in="header" name="Content-Type" type="String" required="false" %}
The Content-Type entity is the media type of the resource. Possible media types can be: <mark style="color:green;">Application/json</mark>
{% endswagger-parameter %}

{% swagger-parameter in="header" name="Authorization" type="String" required="true" %}
To make use of the API, you require authorization. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here.\
Set <mark style="color:green;">Bearer \{{api\_key\}}</mark>
{% endswagger-parameter %}

{% swagger-response status="200: OK" description="The "Read Comment Question Set" operation was successfully executed" %}
```javascript
{
"id": "api.questionset.read.comment",
"ver": "3.0",
"ts": "2023-12-06T08:43:11ZZ",
"params": {
"resmsgid": "20954dd1-6b33-4a2f-abff-c41e2607a233",
"msgid": null,
"err": null,
"status": "successful",
"errmsg": null
},
"responseCode": "OK",
"result": {
"comments": [
{
"identifier": "do_11394153349658214411",
"comment": "Comments made by the reviewer-1"
}
]
}
}
```
{% endswagger-response %}

{% swagger-response status="404: Not Found" description="The Read Comment Question Set operation failed! The possible reason for failure is that you may have provided wrong question set ID." %}
```javascript
{
"id": "api.questionset.read.comment",
"ver": "3.0",
"ts": "2023-12-06T08:45:11ZZ",
"params": {
"resmsgid": "41cafaaa-29d9-4d0f-a0c9-d49932018da2",
"msgid": null,
"err": "NOT_FOUND",
"status": "failed",
"errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_11394153349658214412"
},
"responseCode": "RESOURCE_NOT_FOUND",
"result": {
"messages": null
}
}
```
{% endswagger-response %}

{% swagger-response status="500: Internal Server Error" description="Looks like something went wrong! These errors are tracked automatically" %}
```javascript
{
"result": {},
"id": "string",
"ver": "string",
"ts": "string",
"params": {
"resmsgid": "string",
"msgid": "string",
"err": "string",
"status": "string",
"errmsg": "string"
},
"responseCode": "string"
}
```
{% endswagger-response %}
{% endswagger %}

#### Success response schema

<table><thead><tr><th width="223">Attribute</th><th width="121.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>identifier</td><td>String</td><td>Unique Question set Identifier</td></tr><tr><td>comment</td><td>String</td><td>Comments made by the reviewer</td></tr></tbody></table>

#### cURL

**Sample CURL to read comment for QuestionSet**

```shell
curl --location -g --request GET '{{host}}/questionset/v1/comment/read/{{questionSet_id}}' \
--header 'Authorization: Bearer {{api_key}}'
```

Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
---
description: >-
This API will allow the reviewer to save comments as a draft for question set before he clicks on the final publish/reject on the Sunbird-inQuiry
Platform.
---

# Update Comment QuestionSet

{% swagger method="patch" path="/questionset/v1/comment/update" baseUrl="" summary="This API will allow the reviewer to save comments as a draft for question set before he clicks on the final publish/reject on the Sunbird-inQuiry Platform." expanded="true" %}
{% swagger-description %}
• <mark style="color:orange;">/comment/update/</mark> endpoint executes the "Update Comment QuestionSet" request based on parameters provided as metadata in the request body.\
• It points to inquiry-api-service (assessment service) - <mark style="color:orange;">/questionset/v4/comment/update</mark>\
• It is mandatory to provide values for parameters marked with <mark style="color:red;">\*</mark>. \
• Mandatory fields cannot be null or empty.
{% endswagger-description %}

{% swagger-parameter in="header" name="Content-Type" type="String" required="true" %}
The Content-Type entity is the media type of the resource. Possible media types can be:-<mark style="color:green;">Application/json</mark>
{% endswagger-parameter %}

{% swagger-parameter in="header" name="Authorization" type="String" required="true" %}
All question APIs require authorization for use. Specify the authorization key received from the administrator when placing the request for use of the API.\
Set <mark style="color:green;">Bearer \{{api\_key\}}</mark>
{% endswagger-parameter %}

{% swagger-parameter in="body" name="request" type="Object" required="true" %}
It contains metadata about the comments to be updated for a particular QuestionSet_Id.
{% endswagger-parameter %}

{% swagger-response status="200: OK" description="The Update Comment Question Set operation was successfuly executed." %}
```javascript
{
"id": "api.questionset.update.comment",
"ver": "3.0",
"ts": "2023-12-06T08:40:14ZZ",
"params": {
"resmsgid": "2657c6f8-8554-4efa-9cc5-6c6e656ebf50",
"msgid": null,
"err": null,
"status": "successful",
"errmsg": null
},
"responseCode": "OK",
"result": {
"identifiers": [
"do_11393730666569728019",
"do_11394153349658214411"
]
}
}
```
{% endswagger-response %}

{% swagger-response status="400: Bad Request" description="The 'Update Comment QuestionSet' operation failed ! The possible reason for failure is that the provided identifier does not have a status Review, or it is not Question Set." %}
```javascript
{
"id": "api.questionset.update.comment",
"ver": "3.0",
"ts": "2023-12-06T08:36:09ZZ",
"params": {
"resmsgid": "bea8fce0-b3f5-48e5-8c38-e46be652f010",
"msgid": null,
"err": "ERR_QUESTION_SET_UPDATE_COMMENT",
"status": "failed",
"errmsg": "Node with Identifier do_11394153349658214411 does not have a status Review."
},
"responseCode": "CLIENT_ERROR",
"result": {
"messages": null
}
}
```
{% endswagger-response %}

{% swagger-response status="404: Not Found" description="The Update Comment Question Set operation failed ! The possible reason for failure is that the provided identifier is not a valid Question Set ID." %}
```javascript
{
"id": "api.questionset.update.comment",
"ver": "3.0",
"ts": "2023-12-06T08:40:09ZZ",
"params": {
"resmsgid": "09f9fd7e-af05-4e25-9b1e-559eccd6b1cf",
"msgid": null,
"err": "ERR_QUESTION_SET_ID",
"status": "failed",
"errmsg": "Node with Identifier do_11387792783489433611 is not a Question Set"
},
"responseCode": "RESOURCE_NOT_FOUND",
"result": {
"messages": null
}
}
```
{% endswagger-response %}

{% swagger-response status="500: Internal Server Error" description="Looks like something went wrong! These errors are tracked automatically" %}
```javascript
{
"result": {},
"id": "string",
"ver": "string",
"ts": "string",
"params": {
"resmsgid": "string",
"msgid": "string",
"err": "string",
"status": "string",
"errmsg": "string"
},
"responseCode": "string"
}
```
{% endswagger-response %}
{% endswagger %}

#### Sample Request

```json
{
"request":{
"comments" : [
{
"identifier" : "do_11394153349658214411",
"comment" : "Comments made by reviewer-1"
},
{
"identifier" : "do_11393730666569728019",
"comment" : "Comments made by reviewer-2"
}
]
}
}
```

#### Request schema

<table><thead><tr><th width="168">Attribute</th><th width="111">Type</th><th width="353">Description</th><th>Required</th></tr></thead><tbody><tr><td>identifier</td><td>String</td><td>Represents the unique ID of a Questionset</td><td>Yes</td></tr><tr><td>comment</td><td>String</td><td>Represents the comment made by reviewer</td><td>Yes</td></tr></tbody></table>

#### Success result schema

| Attribute | Type | Description |
|-------------| ------ |----------------------------------|
| identifiers | String | List of all updated identifier |

####

#### cURL

```shell
curl --location -g --request PATCH '{{host}}/questionset/v1/comment/update' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{api_key}}' \
--data-raw '{
"request":{
"comments" : [
{
"identifier" : "do_11394153349658214411",
"comment" : "Comments made by the reviewer-1"
},
{
"identifier" : "do_11393730666569728019",
"comment" : "Comments made by the reviewer-2"
}
]
}
}'
```