# Raise An Attestation

## Making a Claim

<mark style="color:green;">`POST`</mark> `/api/v1/send`

#### Headers

| Name                                           | Type   | Description                                                                                                                              |
| ---------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| content-type<mark style="color:red;">\*</mark> | String | Set to `application/json`                                                                                                                |
| authorization                                  | String | Set to `Bearer {access-token}` if roles in schema of which attestation is to raised does not contain `anonymous` else token can be empty |

#### Request Body

| Name                                  | Type   | Description            |
| ------------------------------------- | ------ | ---------------------- |
| ...<mark style="color:red;">\*</mark> | Object | The value of the claim |

{% tabs %}
{% tab title="200: OK Success Response of attestation sent" %}

```json
{
    "id": "sunbird-rc.registry.send",
    "ver": "1.0",
    "ets": 1668756344546,
    "params": {
        "resmsgid": "",
        "msgid": "d1ff3fa8-fac8-4b4b-a2a9-6910d395bfde",
        "err": "",
        "status": "SUCCESSFUL",
        "errmsg": ""
    },
    "responseCode": "OK",
    "result": {
        "attestationOSID": "1-c809dccf-4d93-453f-a110-d04443f5d679"
    }
}
```

{% endtab %}
{% endtabs %}

Sample Request Body

```json
{
  "entityName": "Teacher",
  "entityId": "{id}",
  "name": "schoolAffiliation" // attestation name
   "propertiesOSID": { // OSIDs of properties to be attested
   }
}
```

\
\
If you retrieve the entity by the [Retrieve Entity API Endpoint](https://github.com/Sunbird-RC/community/blob/v0.0.14/api-reference/attestation-api/broken-reference/README.md), you can see the `id` field in `osid`

### Usage

#### cURL

```shell
curl --location --request POST '{registry-url}/api/v1/send' \
--header 'Authorization: Bearer {access-token}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "entityName": "Teacher",
  "entityId": "{id}",
  "name": "schoolAffiliation"
}'
```

#### HTTPie

```shell
printf '{
  "entityName": "Teacher",
  "entityId": "{id}",
  "name": "schoolAffiliation"
}'| http POST '{registry-url}/api/v1/send' \
 Authorization:'Bearer {access-token}' \
 Content-Type:'application/json' \
```

`{registry-url}` is usually [http://localhost:{port}](https://rc.sunbird.org/v0.0.14/api-reference/attestation-api/http:/localhost:{port}). The port can be found under the `registry` section in the `docker-compose.yml` file and is usually `8081`


---

# 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://rc.sunbird.org/v0.0.14/api-reference/attestation-api/raise-an-attestation.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.
