# Stock Inserts

## POST /Stocks

> Stok ekler.

```json
{"openapi":"3.0.1","info":{"title":"General API","version":"v1"},"servers":[{"url":"/general"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"API anahtar� giriniz","scheme":"Bearer","bearerFormat":"JWT"}},"schemas":{"StockDto":{"type":"object","properties":{"Name":{"type":"string","nullable":true},"UnitCode":{"type":"string","nullable":true},"UnitName":{"type":"string","nullable":true},"Price":{"type":"number","format":"double"},"SellerCode":{"type":"string","nullable":true},"BuyerCode":{"type":"string","nullable":true},"ManufacturerCode":{"type":"string","nullable":true},"IsActive":{"type":"boolean"},"GTIPCode":{"type":"string","nullable":true},"Brand":{"type":"string","nullable":true},"Model":{"type":"string","nullable":true},"Description":{"type":"string","nullable":true},"Note":{"type":"string","nullable":true},"DeliveryCode":{"type":"string","nullable":true},"ShippingCode":{"type":"string","nullable":true},"TaxPercent":{"type":"number","format":"double"}},"additionalProperties":false}}},"paths":{"/Stocks":{"post":{"tags":["Stocks"],"summary":"Stok ekler.","requestBody":{"description":"","content":{"application/json-patch+json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/StockDto"}}},"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/StockDto"}}},"text/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/StockDto"}}},"application/*+json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/StockDto"}}}}},"responses":{"200":{"description":"Stok ekler.","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>"}}}}}}
```

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

```csharp
var client = new RestClient("https://apitest.nilvera.com/general/Stocks");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <API KEY>");
request.AddHeader("Content-Type", "application/json");
var body = @"["Name": "string",
"UnitCode": "string",
"UnitName": "string",
"Price": 0,
"SellerCode": "string",
"BuyerCode": "string",
"ManufacturerCode": "string",
"IsActive": true,
"GTIPCode": "string",
"Brand": "string",
"Model": "string",
"Description": "string",
"Note": "string",
"DeliveryCode": "string",
"ShippingCode": "string",
"TaxPercent": 0]";
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/general/Stocks',
  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 =>'[
  {
    "Name": "string",
    "UnitCode": "string",
    "UnitName": "string",
    "Price": 0,
    "SellerCode": "string",
    "BuyerCode": "string",
    "ManufacturerCode": "string",
    "IsActive": true,
    "GTIPCode": "string",
    "Brand": "string",
    "Model": "string",
    "Description": "string",
    "Note": "string",
    "DeliveryCode": "string",
    "ShippingCode": "string",
    "TaxPercent": 0
  }
]',
  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([
  {
    "Name": "string",
    "UnitCode": "string",
    "UnitName": "string",
    "Price": 0,
    "SellerCode": "string",
    "BuyerCode": "string",
    "ManufacturerCode": "string",
    "IsActive": true,
    "GTIPCode": "string",
    "Brand": "string",
    "Model": "string",
    "Description": "string",
    "Note": "string",
    "DeliveryCode": "string",
    "ShippingCode": "string",
    "TaxPercent": 0
  }
]);

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