# Reject Question

## This API is used to reject the questions on the Sunbird-inQuiry Platform.

<mark style="color:red;">`DELETE`</mark> `/question/v2/reject/{question_id}`

• *<mark style="color:orange;">/question/v2/reject/{</mark>*<mark style="color:orange;">question\_id</mark>*<mark style="color:orange;">}</mark>* endpoint executes the "Reject Question" request based on parameters provided as metadata in the request body\
• This API is used to send back the question to the creator by the reviewer. The API changes the question object status from review to draft.\
• It points to inquiry-api-service (assessment service) - <mark style="color:orange;">/question/v5/reject</mark>\
• It is mandatory to provide values for parameters marked with <mark style="color:red;">\*</mark>.\
• Mandatory fields cannot be null or empty.

#### Path Parameters

| Name                                           | Type   | Description                                   |
| ---------------------------------------------- | ------ | --------------------------------------------- |
| question\_id<mark style="color:red;">\*</mark> | String | Append a valid Question ID To the Request URL |

#### Headers

| Name                                            | Type   | Description                                                                                                                                                                                                                                                     |
| ----------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | <p>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.</p><p>Set <mark style="color:green;">Bearer {{api\_key}}</mark></p> |
| x-channel-id                                    | String | Unique identification number associated with a root organization.                                                                                                                                                                                               |

#### Request Body

| Name                                      | Type   | Description                                 |
| ----------------------------------------- | ------ | ------------------------------------------- |
| request<mark style="color:red;">\*</mark> | Object | Metadata about the question to be rejected. |

{% tabs %}
{% tab title="200: OK The Reject Question operation was successfully executed" %}

```json
{
  "id": "api.question.reject",
  "ver": "5.0",
  "ts": "2023-06-29T03:37:12ZZ",
  "params": {
    "resmsgid": "70dc4cef-b7d0-4794-ae78-e80cc85b4770",
    "msgid": null,
    "err": null,
    "status": "successful",
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "identifier": "do_11336893480941158415",
    "versionKey": "1634627965206"
  }
}
```

{% endtab %}

{% tab title="400: Bad Request The Reject Question operation was unsuccessful. You may have missed providing input for a mandatory parameter.'" %}

```javascript
{
  "id": "api.question.reject",
  "ver": "5.0",
  "ts": "2023-06-29T03:37:12ZZ",
  "params": {
    "resmsgid": "415e19d2-01e3-4690-b5c7-040316c56f5b",
    "msgid": null,
    "err": "ERR_QUESTION_REJECT",
    "status": "failed",
    "errmsg": "Question is not in Review state for identifier: do_11336893480941158415"
  },
  "responseCode": "CLIENT_ERROR",
  "result": {
    "messages": null
  }
}
```

{% endtab %}

{% tab title="404: Not Found The Reject Question operation failed. The possible reason for failure is that you may have provided wrong question ID" %}

```javascript
{
  "id": "api.question.reject",
  "ver": "5.0",
  "ts": "2023-06-29T03:37:12ZZ",
  "params": {
    "resmsgid": "da7af22e-bdce-48f0-8743-f50fa6c2cd21",
    "msgid": null,
    "err": "NOT_FOUND",
    "status": "failed",
    "errmsg": "Error! Node(s) does not Exist. | [Invalid Node Id.]: do_11336893480941158908"
  },
  "responseCode": "RESOURCE_NOT_FOUND",
  "result": {
    "messages": null
  }
}
```

{% endtab %}

{% tab title="500: Internal Server Error Looks like something went wrong! These errors are tracked automatically." %}

```javascript
{
  "id": "api.question.reject",
  "ver": "5.0",
  "ts": "2023-06-29T03:37:12ZZ",
  "params": {
    "resmsgid": "f234a6f0-3ac4-11eb-b0a2-8d5c9f561887",
    "msgid": null,
    "status": "failed",
    "err": null,
    "errmsg": null
  },
  "responseCode": "SERVER_ERROR",
  "result": {}
}
```

{% endtab %}
{% endtabs %}

#### Success result schema

<table><thead><tr><th width="189.33333333333331">Attribute</th><th width="142">Type</th><th>Description</th></tr></thead><tbody><tr><td>identifier</td><td>String</td><td>Unique Question identifier</td></tr><tr><td>versionKey</td><td>String</td><td>Unique version key for question</td></tr></tbody></table>

#### cURL

```shell
curl --location -g --request POST '{{host}}/question/v2/reject/{{question_id}}' \
--header 'Authorization: Bearer {{api_key}}' \
--header 'X-Channel-ID: {{channel_id}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "request": {
        "question": {
            "rejectComment":"Rejected for testing"
        }
    }
}'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://inquiry.sunbird.org/learn/product-and-developer-guide/question-and-question-set-service/apis/v2/question-apis/reject-question.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
