# Publish QuestionSet

## This API is used to publish the question set on the Sunbird-inQuiry Platform.

<mark style="color:green;">`POST`</mark> `/questionset/v1/publish/QuestionSet_Id`

• <mark style="color:orange;">/publish/QuestionSet\_Id</mark> endpoint executes the "Publish 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/publish/QuestionSet\_Id</mark>\
• It is mandatory to provide values for parameters marked with <mark style="color:red;">\*</mark>\
• Mandatory fields cannot be null or empty.\ <mark style="color:green;">•</mark> <mark style="color:orange;">Asynchronous flink job : async-questionset-publish will takes care of the publishing activity.</mark>

#### Path Parameters

| Name            | Type   | Description                                       |
| --------------- | ------ | ------------------------------------------------- |
| QuestionSet\_Id | String | Append a valid Question Set Id To the Request URL |

#### Headers

| Name                                            | Type   | Description                                                                                                                                                                                                                    |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | String | The Content-Type entity is the media type of the resource. Possible media types can be: <mark style="color:green;">Application/json</mark>                                                                                     |
| Authorization<mark style="color:red;">\*</mark> | String | <p>All content APIs require authorization for use. Specify the authorization key received from the administrator when placing the request for use of the API.<br>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 | Object | The body is the representation of the resource object for publishing question set |

{% tabs %}
{% tab title="200: OK QuestionSet publish operation was successfully executed." %}

```javascript
{
  "id": "api.questionset.publish",
  "ver": "3.0",
  "ts": "2021-02-03T09:39:14ZZ",
  "params": {
    "resmsgid": "62f7e310-39e1-4287-bc9f-f8e6ac5f5bd3",
    "msgid": null,
    "err": null,
    "status": "successful",
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "message": "Question is successfully sent for Publish",
    "identifier": "do_113208323801554944120"
  }
}
```

{% endtab %}

{% tab title="404: Not Found QuestionSet Send for publish operation failed !The possible reason for failure is that you may have provided wrong questionset id." %}

```javascript
{
  "id": "api.questionset.publish",
  "ver": "3.0",
  "ts": "2021-02-03T09:39:14ZZ",
  "params": {
    "resmsgid": "62f7e310-39e1-4287-bc9f-f8e6ac5f5bd3",
    "msgid": null,
    "err": null,
    "status": "successful",
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "message": "Question is successfully sent for Publish",
    "identifier": "do_113208323801554944120"
  }
}
```

{% endtab %}

{% tab title="500: Internal Server Error Looks like something went wrong! We track these errors automatically" %}

```javascript
{
  "result": {},
  "id": "string",
  "ver": "string",
  "ts": "string",
  "params": {
    "resmsgid": "string",
    "msgid": "string",
    "err": "string",
    "status": "string",
    "errmsg": "string"
  },
  "responseCode": "string"
}
```

{% endtab %}
{% endtabs %}

#### Request Sample

```json
{
  "request": {
    "questionset": {
      "lastPublishedBy": "ae94b68c-a535-4dce-8e7a-fb9662b0ad68"
    }
  }
}
```

#### Success result schema

<table><thead><tr><th width="183">Attribute</th><th width="141.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>identidier</td><td>String</td><td>Unique Question identifier</td></tr><tr><td>message</td><td>String</td><td>Publish success message</td></tr></tbody></table>

#### cURL

```shell
curl --location -g --request POST '{{host}}/questionset/v1/publish/{{questionSet_id}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{api_key}}' \
--header 'X-Channel-Id: {{channel_id}}' \
--data-raw '{
  "request": {
    "questionset": {}
  }
}'
```


---

# 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/v1/questionset-apis/publish-questionset.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.
