+90 (216) 222 25 25

FaxMAX API

FaxMAX

Online Fax Sistemi Giriş(Login)


Metod
 Core.login

Her API çağrısında kullanıcı kodu ve şifre göndermemek için login olmalısınız.

Sisteme bu API metodu ile başarılı şeklide login olduktan sonra, artık API çağrılarında kullanmak üzere dönülen TOKEN verisini kullanabilirsiniz.

JSON olarak şu şekilde bilgiler gönderilir:
{
    "jsonrpc":"2.0",
    "id":"fe012e8c-2d2f-47da-b7bb-9d90ee611eb4",
    "method":"Core.login",
    "params":{
        "username": "KULLANICIKODU",
        "password": "ŞİFRE",
    }
}

Yukarıdaki JSON Verisini(string olarak) aşağıdaki şekilde gönderebilirsiniz:

 
curl -s -k -i -X POST -F data=JSON VERİSİ 'https://DOMAIN/api/v1'
         
 import json
import requests
r = requests.post('https://DOMAIN/api/v1',
                  data={'data': JSON VERİSİ}, verify=False)
print r.status_code, r.text
             
 $ch = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_URL => "https://DOMAIN/api/v1",
    CURLOPT_HEADER => true,
    CURLOPT_POST => 1,
    CURLOPT_POSTFIELDS => array( "data" => JSON VERİSİ )) ), CURLOPT_RETURNTRANSFER => true ));
$result = curl_exec($ch);
curl_close($ch);
echo $result;  
 private async void Button_Click(object sender, RoutedEventArgs e)
{
    HttpStringContent stringContent = new HttpStringContent( JSON VERİSİ,
        UnicodeEncoding.Utf8, "application/json");
    HttpClient client = new HttpClient();
    HttpResponseMessage response = await client.PostAsync( "https://DOMAIN/api/v1", stringContent);
    string responseBody = await response.Content.ReadAsStringAsync();
    Console.WriteLine (responseBody);
}
 
 import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.EntityUtils;
import java.io.File;
import org.apache.http.conn.ssl.*;
import org.apache.http.impl.client.*;
import java.security.cert.X509Certificate;
import java.security.cert.CertificateException;
import org.apache.http.conn.scheme.*;
import org.apache.http.impl.conn.tsccm.*;
import org.apache.http.conn.*;

//export CLASSPATH=./httpcomponents-client-4.5.1/lib/*:.

public class ApiSendFax {
	public static void main(String[] args) throws Exception {
        /* Patch ssl hostname validation */
        SSLSocketFactory sf = new SSLSocketFactory(new TrustStrategy(){
            @Override
            public boolean isTrusted(X509Certificate[] chain,
                    String authType) throws CertificateException {
                return true;
            }
        }, new AllowAllHostnameVerifier());

        SchemeRegistry registry = new SchemeRegistry();
        registry.register(new Scheme("https",8444, sf));
        ClientConnectionManager ccm = new ThreadSafeClientConnManager(registry);
        /* end of patch */

        CloseableHttpClient httpclient =  new DefaultHttpClient(ccm);
        try {
            HttpPost httppost = new HttpPost("https://DOMAIN/api/v1");
            httppost.setEntity(new StringEntity(JSON VERİSİ, ContentType.create("application/json")));
            CloseableHttpResponse response = httpclient.execute(httppost);
            try {
                System.out.println(response.getStatusLine());
                HttpEntity resEntity = response.getEntity();
                if (resEntity != null) {
                    System.out.println("Response content length: " + resEntity.getContentLength());
                }
                EntityUtils.consume(resEntity);
            } finally {
                response.close();
            }
        } finally {
            httpclient.close();
        }
    }
}
 
 $.ajax({
    async: true,
    type: 'POST',
    dataType: 'json',
    url: "https://DOMAIN/api/v1",
    data: JSON VERİSİ,
    cache: false,
    success: function(data, textStatus, jqXHR){
        console.log(data.result);
    },
    // JSON-RPC Server could return non-200 on error
    error: function(jqXHR, textStatus, errorThrown){
    }
});
 
 func main() {
    var jsonStr = []byte(JSON VERİSİ)
    req, err := http.NewRequest("POST", "https://DOMAIN/api/v1", bytes.NewBuffer(jsonStr))
    req.Header.Set("Content-Type", "application/json")
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()
    fmt.Println("response Status:", resp.Status)
    fmt.Println("response Headers:", resp.Header)
    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println("response Body:", string(body))
} 

JSON içeriği
Parametre Zorunlu? Açıklama
username Evet Kullanıcı Kodu
password Evet Şifre

Login Cevabı

Yukarıdaki örnekteki CURL isteğine şu şekilde cevap alırsınız:

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 458
Date: Tue, 05 Jan 2016 12:05:31 GMT
{
  "id": "fe012e8c-2d2f-47da-b7bb-9d90ee611eb4",
  "jsonrpc": "2.0",
  "result": {
    "domain_config": {
      "domain": "faxmax.net",
      "id": "5de3de0c-1a0d-442b-ae03-f468c8c533d3",
      "is_default_domain": true,
      "site_brand": "FaxMax.net",
      "theme_color": "teal"
    },
    "first_name": "",
    "lang_code": "tr",
    "last_name": "",
    "params": {
      "ask_perm_for_tray_notifications": false,
      "mail_on_failed_incoming_fax": true,
      "mail_on_failed_outgoing_fax": true,
      "mail_on_new_fax": true
    },
    "permissions": {
        KULLANICININ HAKLARI
    },
    "token": TOKEN VERİSİ,
    "username": KULLANICI KODU,
    "user_id":KULLANICI ID'si
  }
} 
Login Cevabı
Parametre Açıklama
domain_config Bu kısım aktif domain bilgilerini içerir
first_name Kullanıcının Adı
last_name Kullanıcının Soyadı
lang_code Kullanıcını iki karakter dil kodu
params Kullanıcının arayüz ayarları
token Sonraki API çağrılarında kullanılacak TOKEN verisi
username Login'de kullanılan kullanıcı kodu
BİZE YAZIN
BİZE YAZIN
 
*
*
*