API KULLANIMI
4VIO API kullanımı çok kolaydır. API kaynaklı sorunlarla uğraşmak yerine kendi kodunuz ile ilgilenmeniz için zaman kazandırır. Yapmanız gereken tek şey kullandığınız API'den gelen cevapla ne yapmak istediğinizi belirlemek.
API Adresleri ve Desteklenen Biçimler
API |
API URL |
Biçim |
Örnek Çıktı |
IP API |
https://api.4vio.com/ip/v1 |
text |
8.8.8.8 |
IP API |
https://api.4vio.com/ip/v1/json |
json |
{"ip":"8.8.8.8","ip_country":"US"} |
IP API |
https://api.4vio.com/ip/v1/jsonp |
jsonp |
GetIP({"ip":"8.8.8.8","ip_country":"US"}); |
FDP API |
https://api.4vio.com/fdp/v1 |
json |
- |
OSINT API |
https://api.4vio.com/osint/v1 |
json |
- |
CTI API |
https://api.4vio.com/cti/v1 |
json |
- |
Hata Kodları
Kod |
İsim |
Açıklama |
101 |
Invalid access token |
Erişim için kullanılan token hatalı ya da iptal edilmiş. |
102 |
Access token has expired |
Token süresi dolmuş, yeni token alınmalı. |
103 |
API permission denied |
İzin yok ya da izin kaldırılmış. |
113 |
Invalid email address |
Geçersiz e-posta adresi. |
201 |
Rate limit exceeded |
Belirli bir zamanda çok fazla istek gönderildi. |
803 |
No records found |
Kayıt bulunamadı. |
KOD ÖRNEKLERİ
Bash
#!/bin/bash
ip=$(curl -s https://api.4vio.com/ip/v1)
echo "IP: $ip"
C#
using System;
using System.Net;
namespace ipapi.Examples {
class Program {
public static void Main (string[] args) {
WebClient webClient = new WebClient();
string publicIp = webClient.DownloadString("https://api.4vio.com/ip/v1");
Console.WriteLine("IP: {0}", publicIp);
}
}
}
Go
package main
import (
"io/ioutil"
"net/http"
"os"
)
func main() {
res, _ := http.Get("https://api.4vio.com/ip/v1")
ip, _ := ioutil.ReadAll(res.Body)
os.Stdout.Write(ip)
}
Java
try (java.util.Scanner s = new java.util.Scanner(new java.net.URL("https://api.4vio.com/ip/v1").openStream(), "UTF-8").useDelimiter("\\A")) {
System.out.println("IP " + s.next());
} catch (java.io.IOException e) {
e.printStackTrace();
}
Javascript
<script type="application/javascript">
function GetIP(json) {
document.write("IP: ", json.ip, " - Country: ", json.ip_country);
}
</script>
<script type="application/javascript" src="https://api.4vio.com/ip/v1/jsonp"></script>
jQuery
<script type="application/javascript">
$(function() {
$.getJSON("https://api.4vio.com/ip/v1/jsonp",
function(json) {
document.write("IP: ", json.ip);
}
);
});
</script>
Lisp
;This example requires the drakma http package installed.
;It can be found here: http://www.weitz.de/drakma
(let ((stream
(drakma:http-request "https://api.4vio.com/ip/v1" :want-stream t)))
(let ((public-ip (read-line stream)))
(format t "IP: ~A" public-ip)))
Lua
http.Fetch("https://api.4vio.com/ip/v1", function(body) print("IP: " .. body ) end
Objective-C
NSURL *url = [NSURL URLWithString:@"https://api.4vio.com/ip/v1"];
NSString *ipAddress = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];
NSLog(@"IP: %@", ipAddress);
Scala
val addr = scala.io.Source.fromURL("https://api.4vio.com/ip/v1").mkString
println(s"IP: $addr")
Perl
use strict;
use warnings;
use LWP::UserAgent;
my $ua = new LWP::UserAgent();
my $ip = $ua->get('https://api.4vio.com/ip/v1')->content;
print 'IP: '. $ip;
PHP
<?php
$ip = file_get_contents('https://api.4vio.com/ip/v1');
echo "IP: " . $ip;
?>
PowerShell
$ip = Invoke-RestMethod -Uri 'https://api.4vio.com/ip/v1/json'
"IP: $($ip.ip)"
Python
# This example requires the requests library be installed. You can learn more
# about the Requests library here: http://docs.python-requests.org/en/latest/
from requests import get
ip = get('https://api.4vio.com/ip/v1').text
print('IP: {}'.format(ip))
Ruby
require "net/http"
ip = Net::HTTP.get(URI("https://api.4vio.com/ip/v1"))
puts "IP: " + ip
VB.NET
Dim httpClient As New System.Net.Http.HttpClient
Dim ip As String = Await httpClient.GetStringAsync("https://api.4vio.com/ip/v1")
Console.WriteLine($"IP: {ip}")