> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using Defined Endpoint in Apinizer with API Call

> You can send HTTP requests to endpoints defined in Apinizer using JavaScript. This page contains an example of sending data with PUT method to an endpoint within Apinizer.

```javascript theme={null}
var url = "http://10.1.1.1:30080/apigateway/apinizerlog/InsertLog";
var tarih = new Date().toISOString();
var servisAdi = 'Servis Adı Yazılacak';
var uygulama = 'Uygulama Adı Yazılacak';
var ip = headerMap.get('X-Forwarded-For');
var kullaniciAdi = headerMap.get('username');
var parametre = JSON.stringify(bodyText);
var data = JSON.stringify({
  "Tarih": tarih,
  "ServisAdi": servisAdi,
  "IP": ip,
  "KullaniciAdi": kullaniciAdi,
  "Parametre": parametre,
  "Uygulama": uygulama
});
try {
  var con = new java.net.URL(url).openConnection();
  con.setConnectTimeout(15000);
  con.setReadTimeout(15000);
  con.setRequestMethod("PUT");
  con.setUseCaches(false);
  con.setDoInput(true);
  con.setDoOutput(true);
  con.setRequestProperty("Content-Length", data.length);
  var wr = new java.io.DataOutputStream(con.getOutputStream());
  wr.writeBytes(data);
  wr.flush();
  wr.close();
  con.getResponseCode(); // önemli silinmemesi gerekli
} catch (err) {
}
```

## Example Explanation

This example sends JSON data with PUT method to an endpoint defined within Apinizer. It retrieves IP address and username information from request headers, converts body content to JSON format, and sends it to the specified endpoint.

<Tip>
  The `con.getResponseCode()` call is necessary for the connection to complete and should not be deleted.
</Tip>
