# Taslak Oluşturur

## Taslak makbuz oluşturur.

> Taslak makbuz oluşturmak için bu ucu kullanabilirsiniz.

```json
{"openapi":"3.0.1","info":{"title":"E-Serbest Meslek Makbuzu API","version":"v1"},"servers":[{"url":"/evoucher"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"API anahtar� giriniz","scheme":"Bearer","bearerFormat":"JWT"}},"schemas":{"CreateDraftCommand":{"type":"object","properties":{"Voucher":{"$ref":"#/components/schemas/VoucherDto"}},"additionalProperties":false},"VoucherDto":{"type":"object","properties":{"VoucherInfo":{"$ref":"#/components/schemas/VoucherInfoDto"},"CompanyInfo":{"$ref":"#/components/schemas/PartyInfoDto"},"CustomerInfo":{"$ref":"#/components/schemas/PartyInfoDto"},"VoucherLines":{"type":"array","items":{"$ref":"#/components/schemas/EVoucherLineDto"},"nullable":true},"Notes":{"type":"array","items":{"type":"string"},"nullable":true}},"additionalProperties":false},"VoucherInfoDto":{"type":"object","properties":{"UUID":{"type":"string","format":"uuid"},"TemplateUUID":{"type":"string","format":"uuid"},"TemplateBase64String":{"type":"string","nullable":true},"VoucherSerieOrNumber":{"type":"string","nullable":true},"IssueDate":{"type":"string","format":"date-time"},"CurrencyCode":{"type":"string","nullable":true},"SendType":{"$ref":"#/components/schemas/SendType"},"ExchangeRate":{"type":"number","format":"double","nullable":true}},"additionalProperties":false},"SendType":{"enum":["KAGIT","ELEKTRONIK"],"type":"string"},"PartyInfoDto":{"type":"object","properties":{"TaxNumber":{"type":"string","nullable":true},"Name":{"type":"string","nullable":true},"TaxOffice":{"type":"string","nullable":true},"PartyIdentifications":{"type":"array","items":{"$ref":"#/components/schemas/IDTypeDto"},"nullable":true},"AgentPartyIdentifications":{"type":"array","items":{"$ref":"#/components/schemas/IDTypeDto"},"nullable":true},"Address":{"type":"string","nullable":true},"District":{"type":"string","nullable":true},"City":{"type":"string","nullable":true},"Country":{"type":"string","nullable":true},"PostalCode":{"type":"string","nullable":true},"Phone":{"type":"string","nullable":true},"Fax":{"type":"string","nullable":true},"Mail":{"type":"string","nullable":true},"WebSite":{"type":"string","nullable":true}},"additionalProperties":false},"IDTypeDto":{"type":"object","properties":{"SchemeID":{"type":"string","nullable":true},"Value":{"type":"string","nullable":true}},"additionalProperties":false},"EVoucherLineDto":{"type":"object","properties":{"Name":{"type":"string","nullable":true},"GrossWage":{"type":"number","format":"double"},"Price":{"type":"number","format":"double"},"KDVPercent":{"type":"number","format":"double"},"KDVTotal":{"type":"number","format":"double"},"Taxes":{"type":"array","items":{"$ref":"#/components/schemas/TaxDto"},"nullable":true},"GVWithholdingPercent":{"type":"number","format":"double"},"GVWithholdingTotal":{"type":"number","format":"double"}},"additionalProperties":false},"TaxDto":{"type":"object","properties":{"TaxCode":{"type":"string","nullable":true},"Total":{"type":"number","format":"double","nullable":true},"Percent":{"type":"number","format":"double","nullable":true},"ReasonCode":{"type":"string","nullable":true},"ReasonDesc":{"type":"string","nullable":true}},"additionalProperties":false},"SendResponse":{"type":"object","properties":{"UUID":{"type":"string","format":"uuid"},"VoucherNumber":{"type":"string","nullable":true}},"additionalProperties":false}}},"paths":{"/Draft/Create":{"post":{"tags":["Draft"],"summary":"Taslak makbuz oluşturur.","description":"Taslak makbuz oluşturmak için bu ucu kullanabilirsiniz.","requestBody":{"description":"","content":{"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/CreateDraftCommand"}},"application/json":{"schema":{"$ref":"#/components/schemas/CreateDraftCommand"}},"text/json":{"schema":{"$ref":"#/components/schemas/CreateDraftCommand"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/CreateDraftCommand"}}}},"responses":{"200":{"description":"Taslak makbuz oluşturur.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendResponse"}}}},"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/evoucher/Draft/Create");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer C08A60FB5055274DC7A658F88B9380F262E1998DAFBD6BA94DBD73951E970876");
request.AddHeader("Content-Type", "application/json");
var body = @"{
  "Voucher": {
    "VoucherInfo": {
      "UUID": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "TemplateUUID": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "TemplateBase64String": "string",
      "VoucherSerieOrNumber": "string",
      "IssueDate": "2023-01-12T10:42:10.067Z",
      "CurrencyCode": "string",
      "SendType": "KAGIT",
      "ExchangeRate": 0
    },
    "CompanyInfo": {
      "TaxNumber": "string",
      "Name": "string",
      "TaxOffice": "string",
      "PartyIdentifications": [
        {
          "SchemeID": "string",
          "Value": "string"
        }
      ],
      "AgentPartyIdentifications": [
        {
          "SchemeID": "string",
          "Value": "string"
        }
      ],
      "Address": "string",
      "District": "string",
      "City": "string",
      "Country": "string",
      "PostalCode": "string",
      "Phone": "string",
      "Fax": "string",
      "Mail": "string",
      "WebSite": "string"
    },
    "CustomerInfo": {
      "TaxNumber": "string",
      "Name": "string",
      "TaxOffice": "string",
      "PartyIdentifications": [
        {
          "SchemeID": "string",
          "Value": "string"
        }
      ],
      "AgentPartyIdentifications": [
        {
          "SchemeID": "string",
          "Value": "string"
        }
      ],
      "Address": "string",
      "District": "string",
      "City": "string",
      "Country": "string",
      "PostalCode": "string",
      "Phone": "string",
      "Fax": "string",
      "Mail": "string",
      "WebSite": "string"
    },
    "VoucherLines": [
      {
        "Name": "string",
        "GrossWage": 0,
        "Price": 0,
        "KDVPercent": 0,
        "KDVTotal": 0,
        "Taxes": [
          {
            "TaxCode": "string",
            "Total": 0,
            "Percent": 0,
            "ReasonCode": "string",
            "ReasonDesc": "string"
          }
        ],
        "GVWithholdingPercent": 0,
        "GVWithholdingTotal": 0
      }
    ],
    "Notes": [
      "string"
    ]
  }
}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
```

{% endtab %}

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

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://apitest.nilvera.com/evoucher/Draft/Create',
  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 =>'{
  "Voucher": {
    "VoucherInfo": {
      "UUID": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "TemplateUUID": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "TemplateBase64String": "string",
      "VoucherSerieOrNumber": "string",
      "IssueDate": "2023-01-12T10:42:10.067Z",
      "CurrencyCode": "string",
      "SendType": "KAGIT",
      "ExchangeRate": 0
    },
    "CompanyInfo": {
      "TaxNumber": "string",
      "Name": "string",
      "TaxOffice": "string",
      "PartyIdentifications": [
        {
          "SchemeID": "string",
          "Value": "string"
        }
      ],
      "AgentPartyIdentifications": [
        {
          "SchemeID": "string",
          "Value": "string"
        }
      ],
      "Address": "string",
      "District": "string",
      "City": "string",
      "Country": "string",
      "PostalCode": "string",
      "Phone": "string",
      "Fax": "string",
      "Mail": "string",
      "WebSite": "string"
    },
    "CustomerInfo": {
      "TaxNumber": "string",
      "Name": "string",
      "TaxOffice": "string",
      "PartyIdentifications": [
        {
          "SchemeID": "string",
          "Value": "string"
        }
      ],
      "AgentPartyIdentifications": [
        {
          "SchemeID": "string",
          "Value": "string"
        }
      ],
      "Address": "string",
      "District": "string",
      "City": "string",
      "Country": "string",
      "PostalCode": "string",
      "Phone": "string",
      "Fax": "string",
      "Mail": "string",
      "WebSite": "string"
    },
    "VoucherLines": [
      {
        "Name": "string",
        "GrossWage": 0,
        "Price": 0,
        "KDVPercent": 0,
        "KDVTotal": 0,
        "Taxes": [
          {
            "TaxCode": "string",
            "Total": 0,
            "Percent": 0,
            "ReasonCode": "string",
            "ReasonDesc": "string"
          }
        ],
        "GVWithholdingPercent": 0,
        "GVWithholdingTotal": 0
      }
    ],
    "Notes": [
      "string"
    ]
  }
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer <API KEY>',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

{% endtab %}

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

```javascript
var axios = require('axios');
var data = JSON.stringify({
  "Voucher": {
    "VoucherInfo": {
      "UUID": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "TemplateUUID": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "TemplateBase64String": "string",
      "VoucherSerieOrNumber": "string",
      "IssueDate": "2023-01-12T10:42:10.067Z",
      "CurrencyCode": "string",
      "SendType": "KAGIT",
      "ExchangeRate": 0
    },
    "CompanyInfo": {
      "TaxNumber": "string",
      "Name": "string",
      "TaxOffice": "string",
      "PartyIdentifications": [
        {
          "SchemeID": "string",
          "Value": "string"
        }
      ],
      "AgentPartyIdentifications": [
        {
          "SchemeID": "string",
          "Value": "string"
        }
      ],
      "Address": "string",
      "District": "string",
      "City": "string",
      "Country": "string",
      "PostalCode": "string",
      "Phone": "string",
      "Fax": "string",
      "Mail": "string",
      "WebSite": "string"
    },
    "CustomerInfo": {
      "TaxNumber": "string",
      "Name": "string",
      "TaxOffice": "string",
      "PartyIdentifications": [
        {
          "SchemeID": "string",
          "Value": "string"
        }
      ],
      "AgentPartyIdentifications": [
        {
          "SchemeID": "string",
          "Value": "string"
        }
      ],
      "Address": "string",
      "District": "string",
      "City": "string",
      "Country": "string",
      "PostalCode": "string",
      "Phone": "string",
      "Fax": "string",
      "Mail": "string",
      "WebSite": "string"
    },
    "VoucherLines": [
      {
        "Name": "string",
        "GrossWage": 0,
        "Price": 0,
        "KDVPercent": 0,
        "KDVTotal": 0,
        "Taxes": [
          {
            "TaxCode": "string",
            "Total": 0,
            "Percent": 0,
            "ReasonCode": "string",
            "ReasonDesc": "string"
          }
        ],
        "GVWithholdingPercent": 0,
        "GVWithholdingTotal": 0
      }
    ],
    "Notes": [
      "string"
    ]
  }
});

var config = {
  method: 'post',
  url: 'https://apitest.nilvera.com/evoucher/Draft/Create',
  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 %}
