# Creates a Answer to the Despatch

## POST /Purchase/SendAnswer

> İrsaliyeye yanıt verir.

```json
{"openapi":"3.0.1","info":{"title":"E-Despatch API","version":"v1"},"servers":[{"url":"/edespatch"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"API anahtar� giriniz","scheme":"Bearer","bearerFormat":"JWT"}},"schemas":{"PurchaseDespatchSendAnswerCommand":{"type":"object","properties":{"DespatchUUID":{"type":"string","format":"uuid"},"DespatchAnswerLines":{"type":"array","items":{"$ref":"#/components/schemas/DespatchAnswerLineDto"},"nullable":true},"Notes":{"type":"array","items":{"type":"string"},"nullable":true},"Serie":{"type":"string","nullable":true},"DeliveryDateTime":{"type":"string","format":"date-time"},"TemplateUUID":{"type":"string","format":"uuid"},"AcceptAll":{"type":"boolean"},"RejectAll":{"type":"boolean"}},"additionalProperties":false},"DespatchAnswerLineDto":{"type":"object","properties":{"Index":{"type":"integer","format":"int32"},"Received":{"$ref":"#/components/schemas/UnitCodeValueDto"},"Short":{"$ref":"#/components/schemas/UnitCodeValueDto"},"Rejected":{"$ref":"#/components/schemas/UnitCodeValueDto"},"Oversupply":{"$ref":"#/components/schemas/UnitCodeValueDto"},"RejectReason":{"type":"string","nullable":true},"SellerCode":{"type":"string","nullable":true},"Name":{"type":"string","nullable":true},"Description":{"type":"string","nullable":true},"QuantityPrice":{"type":"number","format":"double"},"LineTotal":{"type":"number","format":"double"}},"additionalProperties":false},"UnitCodeValueDto":{"type":"object","properties":{"UnitCode":{"type":"string","nullable":true},"Value":{"type":"number","format":"double"}},"additionalProperties":false}}},"paths":{"/Purchase/SendAnswer":{"post":{"tags":["Purchase"],"summary":"İrsaliyeye yanıt verir.","requestBody":{"description":"","content":{"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/PurchaseDespatchSendAnswerCommand"}},"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseDespatchSendAnswerCommand"}},"text/json":{"schema":{"$ref":"#/components/schemas/PurchaseDespatchSendAnswerCommand"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/PurchaseDespatchSendAnswerCommand"}}}},"responses":{"200":{"description":"İrsaliyeye yanıt verir.","content":{"application/json":{"schema":{"type":"string"}}}},"400":{"description":"Geçersiz İstek | Gönderdiğiniz istekte geçersiz veriler bulunduğu anlamında gelmektedir | Detaylar için <a target=\"_blank\" href=\"https://developer.nilvera.com/hata-kodlari#badrequest-400\">tıklayınız</a>"},"403":{"description":"Yetkisiz Erişim | Bu uca erişmek için gerekli yetkiye sahip olmadığınız durumda dönülür"},"404":{"description":"Parametrede belirtilen kayıt bulunamadığında dönülür | Detaylar için <a target=\"_blank\" href=\"https://developer.nilvera.com/hata-kodlari#notfound-404\">tıklayınız</a>"},"409":{"description":"Gönderdiğiniz istek sistemde daha önce bulunduğunda dönülür | Detaylar için <a target=\"_blank\" href=\"https://developer.nilvera.com/hata-kodlari#conflict-409\">tıklayınız</a>"},"422":{"description":"Gönderdiğiniz istek geçerli fakat iş kuralları gereği geçersiz değerler içerdiğinde dönülür | Detaylar için <a target=\"_blank\" href=\"https://developer.nilvera.com/hata-kodlari#unprocessableentity-422\">tıklayınız</a>"}}}}}}
```

{% tabs %}
{% tab title="C#" %}

```csharp
var client = new RestClient("https://apitest.nilvera.com/edespatch/Purchase/SendAnswer");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <API KEY>");
request.AddHeader("Content-Type", "application/json");
var body = @"{"DespatchUUID": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"DespatchAnswerLines"": [ {
      "Index": 0,
      "Received": {
        "UnitCode": "string",
        "Value": 0
      },
      "Short": {
        "UnitCode": "string",
        "Value": 0
      },
      "Rejected": {
        "UnitCode": "string",
        "Value": 0
      },
      "Oversupply": {
        "UnitCode": "string",
        "Value": 0
      },
      "RejectReason": "string",
      "SellerCode": "string",
      "Name": "string",
      "Description": "string",
      "QuantityPrice": 0,
      "LineTotal": 0
    }
  ],
  "Notes": [
    "string"
  ],
  "Serie": "string",
  "DeliveryDateTime": "2023-01-10T10:49:12.247Z",
  "TemplateUUID": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "AcceptAll": true,
  "RejectAll": true; }
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
```

{% endtab %}

{% tab title="PHP - cURL" %}

<pre class="language-php"><code class="lang-php">&#x3C;?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://apitest.nilvera.com/edespatch/Purchase/SendAnswer',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
  "DespatchUUID": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "DespatchAnswerLines": [
    {
      "Index": 0,
      "Received": {
        "UnitCode": "string",
        "Value": 0
      },
      "Short": {
        "UnitCode": "string",
        "Value": 0
      },
      "Rejected": {
        "UnitCode": "string",
        "Value": 0
      },
      "Oversupply": {
        "UnitCode": "string",
        "Value": 0
      },
      "RejectReason": "string",
      "SellerCode": "string",
      "Name": "string",
      "Description": "string",
      "QuantityPrice": 0,
      "LineTotal": 0
    }
  ],
  "Notes": [
    "string"
  ],
  "Serie": "string",
  "DeliveryDateTime": "2023-01-10T10:49:12.247Z",
  "TemplateUUID": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "AcceptAll": true,
  "RejectAll": true
<strong>}',
</strong>  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer &#x3C;API KEY>',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
</code></pre>

{% endtab %}

{% tab title="NodeJs - Axios" %}

```javascript
var axios = require('axios');
var data = JSON.stringify({
  "DespatchUUID": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "DespatchAnswerLines": [
    {
      "Index": 0,
      "Received": {
        "UnitCode": "string",
        "Value": 0
      },
      "Short": {
        "UnitCode": "string",
        "Value": 0
      },
      "Rejected": {
        "UnitCode": "string",
        "Value": 0
      },
      "Oversupply": {
        "UnitCode": "string",
        "Value": 0
      },
      "RejectReason": "string",
      "SellerCode": "string",
      "Name": "string",
      "Description": "string",
      "QuantityPrice": 0,
      "LineTotal": 0
    }
  ],
  "Notes": [
    "string"
  ],
  "Serie": "string",
  "DeliveryDateTime": "2023-01-10T10:49:12.247Z",
  "TemplateUUID": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "AcceptAll": true,
  "RejectAll": true
});

var config = {
  method: 'post',
  url: 'https://apitest.nilvera.com/edespatch/Purchase/SendAnswer',
  headers: { 
    'Authorization': 'Bearer <API KEY>', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
```

{% endtab %}
{% endtabs %}
