درگاه احراز هویت آنلاین

مشاهده سرویس ها

سرویس های هوش مصنوعی

مشاهده سرویس ها

سرویس های استعلامی

مشاهده سرویس ها

سرویس های احراز هویت

مشاهده سرویس ها

صدور امضا دیجیتال

مشاهده سرویس ها

استعلام اطلاعات شرکت

مشاهده سرویس ها

سرویس نئوبانک

مشاهده سرویس ها

سجام آنلاین

بزودی

شارژ و بسته اینترنتی

بزودی

کارگر و کارفرما

بزودی

قوه قضائیه هوشمند

بزودی

سرویس دریافت توکن



برای فراخوانی این سرویس مراحل زیر را طی کنید:
۱-متد فراخوانی سرویس POST می باشد.


  https://api.itsaaz.ir/identity/token
        

  Post
        

  Content-Type: application/x-www-form-urlencoded
        

  grant_type= "password" 
  client_id= "ekyc"
  Client_secret= "f63026a9-912d-8978-ac80-4ae5d63db1ac" 
  username= "test"
  password= "t_86574213@T"
        

  {
    "access_token": "توکن",
    "expires_in": مدت استفاده,
    "token_type": "نوع توکن",
    "refresh_token": "رفرش توکن",
    "scope": "محدوده"
  }        
        

پارامترهای ورودی

ردیف پارامتر ورودی نوع ورودی توضیحات
1 Grant_type String
2 Client_id String
3 Client_secret String
4 username String
4 password String

نمونه کد


  var client = new RestClient("https://api.itsaaz.ir/identity/token");
  client.Timeout = -1;
  var request = new RestRequest(Method.POST);
  request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
  request.AddParameter("grant_type", "password");
  request.AddParameter("client_id", "test");
  request.AddParameter("Client_secret", "66c0af3a-ff89-8390-3b07-cf88a25e5f3f");
  request.AddParameter("username", "test");
  request.AddParameter("password", "t_86574213@H");
  IRestResponse response = client.Execute(request);
  Console.WriteLine(response.Content);
        

  curl --location --request POST 'https://api.itsaaz.ir/identity/token' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'grant_type=password' \
  --data-urlencode 'client_id=test' \
  --data-urlencode 'Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f' \
  --data-urlencode 'username=test' \
  --data-urlencode 'password=t_86574213@H'
        

  var headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
  };
  var request = http.Request('POST', Uri.parse('https://api.itsaaz.ir/identity/token'));
  request.bodyFields = {
    'grant_type': 'password',
    'client_id': 'test',
    'Client_secret': '66c0af3a-ff89-8390-3b07-cf88a25e5f3f',
    'username': 'test',
    'password': 't_86574213@H'
  };
  request.headers.addAll(headers);
  
  http.StreamedResponse response = await request.send();
  
  if (response.statusCode == 200) {
    print(await response.stream.bytesToString());
  }
  else {
    print(response.reasonPhrase);
  }
          
        

  package main

  import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
  )
  
  func main() {
  
    url := "https://api.itsaaz.ir/identity/token"
    method := "POST"
  
    payload := strings.NewReader("grant_type=password&client_id=test&Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f&username=test&password=t_86574213%40H")
  
    client := &http.Client {
    }
    req, err := http.NewRequest(method, url, payload)
  
    if err != nil {
      fmt.Println(err)
      return
    }
    req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
  
    res, err := client.Do(req)
    if err != nil {
      fmt.Println(err)
      return
    }
    defer res.Body.Close()
  
    body, err := ioutil.ReadAll(res.Body)
    if err != nil {
      fmt.Println(err)
      return
    }
    fmt.Println(string(body))
  }
        

  POST /identity/token HTTP/1.1
  Host: api.itsaaz.ir
  Content-Type: application/x-www-form-urlencoded
  Content-Length: 123
  
  grant_type=password&client_id=test&Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f&username=test&password=t_86574213%40H
        

    OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
  RequestBody body = RequestBody.create(mediaType, "grant_type=password&client_id=test&Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f&username=test&password=t_86574213@H");
  Request request = new Request.Builder()
    .url("https://api.itsaaz.ir/identity/token")
    .method("POST", body)
    .addHeader("Content-Type", "application/x-www-form-urlencoded")
    .build();
  Response response = client.newCall(request).execute();

            

  Unirest.setTimeouts(0, 0);
  HttpResponse<String> response = Unirest.post("https://api.itsaaz.ir/identity/token")
    .header("Content-Type", "application/x-www-form-urlencoded")
    .field("grant_type", "password")
    .field("client_id", "test")
    .field("Client_secret", "66c0af3a-ff89-8390-3b07-cf88a25e5f3f")
    .field("username", "test")
    .field("password", "t_86574213@H")
    .asString();
  
  
            

  var myHeaders = new Headers();
  myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
  
  var urlencoded = new URLSearchParams();
  urlencoded.append("grant_type", "password");
  urlencoded.append("client_id", "test");
  urlencoded.append("Client_secret", "66c0af3a-ff89-8390-3b07-cf88a25e5f3f");
  urlencoded.append("username", "test");
  urlencoded.append("password", "t_86574213@H");
  
  var requestOptions = {
    method: 'POST',
    headers: myHeaders,
    body: urlencoded,
    redirect: 'follow'
  };
  
  fetch("https://api.itsaaz.ir/identity/token", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));
            

  var settings = {
    "url": "https://api.itsaaz.ir/identity/token",
    "method": "POST",
    "timeout": 0,
    "headers": {
      "Content-Type": "application/x-www-form-urlencoded"
    },
    "data": {
      "grant_type": "password",
      "client_id": "test",
      "Client_secret": "66c0af3a-ff89-8390-3b07-cf88a25e5f3f",
      "username": "test",
      "password": "t_86574213@H"
    }
  };

  $.ajax(settings).done(function (response) {
    console.log(response);
  });
            

  var data = "grant_type=password&client_id=test&Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f&username=test&password=t_86574213%40H";

  var xhr = new XMLHttpRequest();
  xhr.withCredentials = true;
  
  xhr.addEventListener("readystatechange", function() {
    if(this.readyState === 4) {
      console.log(this.responseText);
    }
  });
  
  xhr.open("POST", "https://api.itsaaz.ir/identity/token");
  xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  
  xhr.send(data);
            

  CURL *curl;
  CURLcode res;
  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
    curl_easy_setopt(curl, CURLOPT_URL, "https://api.itsaaz.ir/identity/token");
    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
    curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
    struct curl_slist *headers = NULL;
    headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
    const char *data = "grant_type=password&client_id=test&Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f&username=test&password=t_86574213%40H";
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
    res = curl_easy_perform(curl);
  }
  curl_easy_cleanup(curl);
  

        

  var axios = require('axios');
  var qs = require('qs');
  var data = qs.stringify({
    'grant_type': 'password',
    'client_id': 'test',
    'Client_secret': '66c0af3a-ff89-8390-3b07-cf88a25e5f3f',
    'username': 'test',
    'password': 't_86574213@H' 
  });
  var config = {
    method: 'post',
    url: 'https://api.itsaaz.ir/identity/token',
    headers: { 
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data : data
  };
  
  axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });
  
  
            

  var https = require('follow-redirects').https;
  var fs = require('fs');
  
  var qs = require('querystring');
  
  var options = {
    'method': 'POST',
    'hostname': 'api.itsaaz.ir',
    'path': '/identity/token',
    'headers': {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    'maxRedirects': 20
  };
  
  var req = https.request(options, function (res) {
    var chunks = [];
  
    res.on("data", function (chunk) {
      chunks.push(chunk);
    });
  
    res.on("end", function (chunk) {
      var body = Buffer.concat(chunks);
      console.log(body.toString());
    });
  
    res.on("error", function (error) {
      console.error(error);
    });
  });
  
  var postData = qs.stringify({
    'grant_type': 'password',
    'client_id': 'test',
    'Client_secret': '66c0af3a-ff89-8390-3b07-cf88a25e5f3f',
    'username': 'test',
    'password': 't_86574213@H'
  });
  
  req.write(postData);
  
  req.end();
            

  var request = require('request');
  var options = {
    'method': 'POST',
    'url': 'https://api.itsaaz.ir/identity/token',
    'headers': {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    form: {
      'grant_type': 'password',
      'client_id': 'test',
      'Client_secret': '66c0af3a-ff89-8390-3b07-cf88a25e5f3f',
      'username': 'test',
      'password': 't_86574213@H'
    }
  };
  request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
  });
  
  
            

  var unirest = require('unirest');
  var req = unirest('POST', 'https://api.itsaaz.ir/identity/token')
    .headers({
      'Content-Type': 'application/x-www-form-urlencoded'
    })
    .send('grant_type=password')
    .send('client_id=test')
    .send('Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f')
    .send('username=test')
    .send('password=t_86574213@H')
    .end(function (res) { 
      if (res.error) throw new Error(res.error); 
      console.log(res.raw_body);
    });
  
  
            

  #import <Foundation/Foundation.h>

  dispatch_semaphore_t sema = dispatch_semaphore_create(0);
  
  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.itsaaz.ir/identity/token"]
    cachePolicy:NSURLRequestUseProtocolCachePolicy
    timeoutInterval:10.0];
  NSDictionary *headers = @{
    @"Content-Type": @"application/x-www-form-urlencoded"
  };
  
  [request setAllHTTPHeaderFields:headers];
  NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"grant_type=password" dataUsingEncoding:NSUTF8StringEncoding]];
  [postData appendData:[@"&client_id=test" dataUsingEncoding:NSUTF8StringEncoding]];
  [postData appendData:[@"&Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f" dataUsingEncoding:NSUTF8StringEncoding]];
  [postData appendData:[@"&username=test" dataUsingEncoding:NSUTF8StringEncoding]];
  [postData appendData:[@"&password=t_86574213@H" dataUsingEncoding:NSUTF8StringEncoding]];
  [request setHTTPBody:postData];
  
  [request setHTTPMethod:@"POST"];
  
  NSURLSession *session = [NSURLSession sharedSession];
  NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
  completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
    if (error) {
      NSLog(@"%@", error);
      dispatch_semaphore_signal(sema);
    } else {
      NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
      NSError *parseError = nil;
      NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
      NSLog(@"%@",responseDictionary);
      dispatch_semaphore_signal(sema);
    }
  }];
  [dataTask resume];
  dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);     
        

  open Lwt
  open Cohttp
  open Cohttp_lwt_unix

  let postData = ref "grant_type=password&client_id=test&Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f&username=test&password=t_86574213%40H";;
  
  let reqBody = 
    let uri = Uri.of_string "https://api.itsaaz.ir/identity/token" in
    let headers = Header.init ()
      |> fun h -> Header.add h "Content-Type" "application/x-www-form-urlencoded"
    in
    let body = Cohttp_lwt.Body.of_string !postData in
  
    Client.call ~headers ~body `POST uri >>= fun (_resp, body) ->
    body |> Cohttp_lwt.Body.to_string >|= fun body -> body
  
  let () =
    let respBody = Lwt_main.run reqBody in
    print_endline (respBody)
        

  <?php

  $curl = curl_init();
  
  curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.itsaaz.ir/identity/token',
    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 => 'grant_type=password&client_id=test&Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f&username=test&password=t_86574213%40H',
    CURLOPT_HTTPHEADER => array(
      'Content-Type: application/x-www-form-urlencoded'
    ),
  ));
  
  $response = curl_exec($curl);
  
  curl_close($curl);
  echo $response;
  
            

  <?php
  require_once 'HTTP/Request2.php';
  $request = new HTTP_Request2();
  $request->setUrl('https://api.itsaaz.ir/identity/token');
  $request->setMethod(HTTP_Request2::METHOD_POST);
  $request->setConfig(array(
    'follow_redirects' => TRUE
  ));
  $request->setHeader(array(
    'Content-Type' => 'application/x-www-form-urlencoded'
  ));
  $request->addPostParameter(array(
    'grant_type' => 'password',
    'client_id' => 'test',
    'Client_secret' => '66c0af3a-ff89-8390-3b07-cf88a25e5f3f',
    'username' => 'test',
    'password' => 't_86574213@H'
  ));
  try {
    $response = $request->send();
    if ($response->getStatus() == 200) {
      echo $response->getBody();
    }
    else {
      echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
      $response->getReasonPhrase();
    }
  }
  catch(HTTP_Request2_Exception $e) {
    echo 'Error: ' . $e->getMessage();
  }
            

  <?php
  $client = new http\Client;
  $request = new http\Client\Request;
  $request->setRequestUrl('https://api.itsaaz.ir/identity/token');
  $request->setRequestMethod('POST');
  $body = new http\Message\Body;
  $body->append(new http\QueryString(array(
    'grant_type' => 'password',
    'client_id' => 'test',
    'Client_secret' => '66c0af3a-ff89-8390-3b07-cf88a25e5f3f',
    'username' => 'test',
    'password' => 't_86574213@H')));$request->setBody($body);
  $request->setOptions(array());
  $request->setHeaders(array(
    'Content-Type' => 'application/x-www-form-urlencoded'
  ));
  $client->enqueue($request)->send();
  $response = $client->getResponse();
  echo $response->getBody();
  
            

  $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
  $headers.Add("Content-Type", "application/x-www-form-urlencoded")

  $body = "grant_type=password&client_id=test&Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f&username=test&password=t_86574213%40H"

  $response = Invoke-RestMethod 'https://api.itsaaz.ir/identity/token' -Method 'POST' -Headers $headers -Body $body
  $response | ConvertTo-Json
        

  import http.client

  conn = http.client.HTTPSConnection("api.itsaaz.ir")
  payload = 'grant_type=password&client_id=test&Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f&username=test&password=t_86574213%40H'
  headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
  }
  conn.request("POST", "/identity/token", payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode("utf-8"))
            

  import requests

  url = "https://api.itsaaz.ir/identity/token"

  payload='grant_type=password&client_id=test&Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f&username=test&password=t_86574213%40H'
  headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)

            

  require "uri"
  require "net/http"

  url = URI("https://api.itsaaz.ir/identity/token")

  https = Net::HTTP.new(url.host, url.port)
  https.use_ssl = true

  request = Net::HTTP::Post.new(url)
  request["Content-Type"] = "application/x-www-form-urlencoded"
  request.body = "grant_type=password&client_id=test&Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f&username=test&password=t_86574213%40H"

  response = https.request(request)
  puts response.read_body
      
        

  http --ignore-stdin --form --follow --timeout 3600 POST 'https://api.itsaaz.ir/identity/token' \
  'grant_type'='password' \
  'client_id'='test' \
  'Client_secret'='66c0af3a-ff89-8390-3b07-cf88a25e5f3f' \
  'username'='test' \
  'password'='t_86574213@H' \
  Content-Type:'application/x-www-form-urlencoded'
            

  wget --no-check-certificate --quiet \
    --method POST \
    --timeout=0 \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --body-data 'grant_type=password&client_id=test&Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f&username=test&password=t_86574213%40H' \
    'https://api.itsaaz.ir/identity/token'
            

  import Foundation
  #if canImport(FoundationNetworking)
  import FoundationNetworking
  #endif

  var semaphore = DispatchSemaphore (value: 0)

  let parameters = "grant_type=password&client_id=test&Client_secret=66c0af3a-ff89-8390-3b07-cf88a25e5f3f&username=test&password=t_86574213%40H"
  let postData =  parameters.data(using: .utf8)

  var request = URLRequest(url: URL(string: "https://api.itsaaz.ir/identity/token")!,timeoutInterval: Double.infinity)
  request.addValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")

  request.httpMethod = "POST"
  request.httpBody = postData

  let task = URLSession.shared.dataTask(with: request) { data, response, error in 
    guard let data = data else {
      print(String(describing: error))
      semaphore.signal()
      return
    }
    print(String(data: data, encoding: .utf8)!)
    semaphore.signal()
  }

  task.resume()
  semaphore.wait()
      
        


سرویس دریافت اطلاعات روی کارت ملی(OCR):


۱-متد فراخوانی سرویس POST می باشد.
2- پس از فراخوانی سرویس، اطلاعات کاربر مطابق آنچه در جدول پارامتر های خروجی نمایش داده شده است، ارسال می شود.
3-در این سرویس با استفاده از سیستم پردازش تصویر دیتای کاربر از روی عکس کارت ملی دریافت می شود:


  https://api.itsaaz.ir/ai/nationalfront
        

      

  Post
        
      

  accept: application/json
  Authorization: Bearer YOUR-TOKEN
  Content-Type: multipart/form-data
        
      

  NationalCardFrontSideImage=@"/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg"
        
      

  {
    "data": {
      "result": نتیجه,
      "firstName": "نام",
      "lastName": "نام خانوادگی",
      "fatherName": "نام پدر",
      "nationalCode": "کدملی",
      "birthDate": "تاریخ تولد",
      "expirationDate": "تاریخ انقضا",
      "facePhoto": عکس صورت,
      "city": "شهر",
      "province": "استان"
    },
    "meta": null,
    "error": null
  }
        
      

پارامترهای ورودی

ردیف پارامتر ورودی نوع ورودی توضیحات
1 NationalCardFrontSideImage File تصویر روی کارت ملی

نمونه کد


  var client = new RestClient("https://api.itsaaz.ir/ai/nationalfront");
  client.Timeout = -1;
  var request = new RestRequest(Method.POST);
  request.AddHeader("accept", "application/json");
  request.AddHeader("Authorization", "Bearer YOUR-TOKEN");
  request.AddHeader("Content-Type", "multipart/form-data");
  request.AddParameter("OrderId", "");
  request.AddFile("NationalCardFrontSideImage", "/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg");
  IRestResponse response = client.Execute(request);
  Console.WriteLine(response.Content);
        

  curl --location --request POST 'https://api.itsaaz.ir/ai/nationalfront' \
  --header 'accept: application/json' \
  --header 'Authorization: Bearer YOUR-TOKEN' \
  --header 'Content-Type: multipart/form-data' \
  --form 'OrderId=""' \
  --form 'NationalCardFrontSideImage=@"/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg"'
        

  var headers = {
    'accept': 'application/json',
    'Authorization': 'Bearer YOUR-TOKEN',
    'Content-Type': 'multipart/form-data'
  };
  var request = http.MultipartRequest('POST', Uri.parse('https://api.itsaaz.ir/ai/nationalfront'));
  request.fields.addAll({
    'OrderId': ''
  });
  request.files.add(await http.MultipartFile.fromPath('NationalCardFrontSideImage', '/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg'));
  request.headers.addAll(headers);
  
  http.StreamedResponse response = await request.send();
  
  if (response.statusCode == 200) {
    print(await response.stream.bytesToString());
  }
  else {
    print(response.reasonPhrase);
  }
  
          
        

package main

import (
  "fmt"
  "bytes"
  "mime/multipart"
  "os"
  "path/filepath"
  "io"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.itsaaz.ir/ai/nationalfront"
  method := "POST"

  payload := &bytes.Buffer{}
  writer := multipart.NewWriter(payload)
  _ = writer.WriteField("OrderId", "")
  file, errFile2 := os.Open("/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg")
  defer file.Close()
  part2,
         errFile2 := writer.CreateFormFile("NationalCardFrontSideImage",filepath.Base("/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg"))
  _, errFile2 = io.Copy(part2, file)
  if errFile2 != nil {
    fmt.Println(errFile2)
    return
  }
  err := writer.Close()
  if err != nil {
    fmt.Println(err)
    return
  }


  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("accept", "application/json")
  req.Header.Add("Authorization", "Bearer YOUR-TOKEN")
  req.Header.Add("Content-Type", "multipart/form-data")

  req.Header.Set("Content-Type", writer.FormDataContentType())
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
        

  POST /ai/nationalfront HTTP/1.1
  Host: api.itsaaz.ir
  accept: application/json
  Authorization: Bearer YOUR-TOKEN
  Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
  Content-Length: 335
  
  ----WebKitFormBoundary7MA4YWxkTrZu0gW
  Content-Disposition: form-data; name="OrderId"
  
  
  ----WebKitFormBoundary7MA4YWxkTrZu0gW
  Content-Disposition: form-data; name="NationalCardFrontSideImage"; filename="WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg"
  Content-Type: <Content-Type header here>
  
  (data)
  ----WebKitFormBoundary7MA4YWxkTrZu0gW
  
        

    OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse("multipart/form-data");
  RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
    .addFormDataPart("OrderId","")
    .addFormDataPart("NationalCardFrontSideImage","WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg",
      RequestBody.create(MediaType.parse("application/octet-stream"),
      new File("/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg")))
    .build();
  Request request = new Request.Builder()
    .url("https://api.itsaaz.ir/ai/nationalfront")
    .method("POST", body)
    .addHeader("accept", "application/json")
    .addHeader("Authorization", "Bearer YOUR-TOKEN")
    .addHeader("Content-Type", "multipart/form-data")
    .build();
  Response response = client.newCall(request).execute();
            

  Unirest.setTimeouts(0, 0);
  HttpResponse<String> response = Unirest.post("https://api.itsaaz.ir/ai/nationalfront")
    .header("accept", "application/json")
    .header("Authorization", "Bearer YOUR-TOKEN")
    .header("Content-Type", "multipart/form-data")
    .field("OrderId", "")
    .field("file", new File("/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg"))
    .asString();
  
            

  var myHeaders = new Headers();
  myHeaders.append("accept", "application/json");
  myHeaders.append("Authorization", "Bearer YOUR-TOKEN");
  myHeaders.append("Content-Type", "multipart/form-data");
  
  var formdata = new FormData();
  formdata.append("OrderId", "");
  formdata.append("NationalCardFrontSideImage", fileInput.files[0], "WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg");
  
  var requestOptions = {
    method: 'POST',
    headers: myHeaders,
    body: formdata,
    redirect: 'follow'
  };
  
  fetch("https://api.itsaaz.ir/ai/nationalfront", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));
            

  var form = new FormData();
  form.append("OrderId", "");
  form.append("NationalCardFrontSideImage", fileInput.files[0], "WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg");
  
  var settings = {
    "url": "https://api.itsaaz.ir/ai/nationalfront",
    "method": "POST",
    "timeout": 0,
    "headers": {
      "accept": "application/json",
      "Authorization": "Bearer YOUR-TOKEN",
      "Content-Type": "multipart/form-data"
    },
    "processData": false,
    "mimeType": "multipart/form-data",
    "contentType": false,
    "data": form
  };
  
  $.ajax(settings).done(function (response) {
    console.log(response);
  });
            

  var data = new FormData();
  data.append("OrderId", "");
  data.append("NationalCardFrontSideImage", fileInput.files[0], "WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg");
   
  var xhr = new XMLHttpRequest();
  xhr.withCredentials = true;
  
  xhr.addEventListener("readystatechange", function() {
    if(this.readyState === 4) {
      console.log(this.responseText);
    }
  });
  
  xhr.open("POST", "https://api.itsaaz.ir/ai/nationalfront");
  xhr.setRequestHeader("accept", "application/json");
  xhr.setRequestHeader("Authorization", "Bearer YOUR-TOKEN");
  xhr.setRequestHeader("Content-Type", "multipart/form-data");
  
  xhr.send(data);
            

  CURL *curl;
  CURLcode res;
  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
    curl_easy_setopt(curl, CURLOPT_URL, "https://api.itsaaz.ir/ai/nationalfront");
    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
    curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
    struct curl_slist *headers = NULL;
    headers = curl_slist_append(headers, "accept: application/json");
    headers = curl_slist_append(headers, "Authorization: Bearer YOUR-TOKEN");
    headers = curl_slist_append(headers, "Content-Type: multipart/form-data");
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
    curl_mime *mime;
    curl_mimepart *part;
    mime = curl_mime_init(curl);
    part = curl_mime_addpart(mime);
    curl_mime_name(part, "OrderId");
    curl_mime_data(part, "", CURL_ZERO_TERMINATED);
    part = curl_mime_addpart(mime);
    curl_mime_name(part, "NationalCardFrontSideImage");
    curl_mime_filedata(part, "/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg");
    curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime);
    res = curl_easy_perform(curl);
    curl_mime_free(mime);
  }
  curl_easy_cleanup(curl);
  

        

  var axios = require('axios');
  var FormData = require('form-data');
  var fs = require('fs');
  var data = new FormData();
  data.append('OrderId', '');
  data.append('NationalCardFrontSideImage', fs.createReadStream('/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg'));
  
  var config = {
    method: 'post',
    url: 'https://api.itsaaz.ir/ai/nationalfront',
    headers: { 
      'accept': 'application/json', 
      'Authorization': 'Bearer YOUR-TOKEN', 
      'Content-Type': 'multipart/form-data', 
      ...data.getHeaders()
    },
    data : data
  };
  
  axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });
  
            

  var https = require('follow-redirects').https;
  var fs = require('fs');
  
  var options = {
    'method': 'POST',
    'hostname': 'api.itsaaz.ir',
    'path': '/ai/nationalfront',
    'headers': {
      'accept': 'application/json',
      'Authorization': 'Bearer YOUR-TOKEN',
      'Content-Type': 'multipart/form-data'
    },
    'maxRedirects': 20
  };
  
  var req = https.request(options, function (res) {
    var chunks = [];
  
    res.on("data", function (chunk) {
      chunks.push(chunk);
    });
  
    res.on("end", function (chunk) {
      var body = Buffer.concat(chunks);
      console.log(body.toString());
    });
  
    res.on("error", function (error) {
      console.error(error);
    });
  });
  
  var postData = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"OrderId\"\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"NationalCardFrontSideImage\"; filename=\"WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg\"\r\nContent-Type: \"{Insert_File_Content_Type}\"\r\n\r\n" + fs.readFileSync('/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg') + "\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--";
  
  req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
  
  req.write(postData);
  
  req.end();
            

  var request = require('request');
  var fs = require('fs');
  var options = {
    'method': 'POST',
    'url': 'https://api.itsaaz.ir/ai/nationalfront',
    'headers': {
      'accept': 'application/json',
      'Authorization': 'Bearer YOUR-TOKEN',
      'Content-Type': 'multipart/form-data'
    },
    formData: {
      'OrderId': '',
      'NationalCardFrontSideImage': {
        'value': fs.createReadStream('/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg'),
        'options': {
          'filename': 'WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg',
          'contentType': null
        }
      }
    }
  };
  request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
  });
  
            

  var unirest = require('unirest');
  var req = unirest('POST', 'https://api.itsaaz.ir/ai/nationalfront')
    .headers({
      'accept': 'application/json',
      'Authorization': 'Bearer YOUR-TOKEN',
      'Content-Type': 'multipart/form-data'
    })
    .field('OrderId', '')
    .attach('file', '/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg')
    .end(function (res) { 
      if (res.error) throw new Error(res.error); 
      console.log(res.raw_body);
    });
  
  
            

  #import <Foundation/Foundation.h>

  dispatch_semaphore_t sema = dispatch_semaphore_create(0);
  
  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.itsaaz.ir/ai/nationalfront"]
    cachePolicy:NSURLRequestUseProtocolCachePolicy
    timeoutInterval:10.0];
  NSDictionary *headers = @{
    @"accept": @"application/json",
    @"Authorization": @"Bearer YOUR-TOKEN",
    @"Content-Type": @"multipart/form-data"
  };
  
  [request setAllHTTPHeaderFields:headers];
  NSArray *parameters = @[
    @{ @"name": @"OrderId", @"value": @"" }, 
    @{ @"name": @"NationalCardFrontSideImage", @"fileName": @"/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg" } 
  ];
  
  NSString *boundary = @"----WebKitFormBoundary7MA4YWxkTrZu0gW";
  NSError *error;
  NSMutableString *body = [NSMutableString string];
  
  for (NSDictionary *param in parameters) {
    [body appendFormat:@"--%@\r\n", boundary];
    if (param[@"fileName"]) {
      [body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
      [body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
      [body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
      if (error) {
        NSLog(@"%@", error);
      }
    } else {
      [body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
      [body appendFormat:@"%@", param[@"value"]];
    }
  }
  [body appendFormat:@"\r\n--%@--\r\n", boundary];
  NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
  [request setHTTPBody:postData];
  
  [request setHTTPMethod:@"POST"];
  
  NSURLSession *session = [NSURLSession sharedSession];
  NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
  completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
    if (error) {
      NSLog(@"%@", error);
      dispatch_semaphore_signal(sema);
    } else {
      NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
      NSError *parseError = nil;
      NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
      NSLog(@"%@",responseDictionary);
      dispatch_semaphore_signal(sema);
    }
  }];
  [dataTask resume];
  dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
        

  open Lwt
  open Cohttp
  open Cohttp_lwt_unix
  
  let parameters = [|
    [| ("name", "OrderId"); ("value", "") |];
    [| ("name", "NationalCardFrontSideImage"); ("fileName", "/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg") |]
  |];;
  let boundary = "----WebKitFormBoundary7MA4YWxkTrZu0gW";;
  let postData = ref "";;
  
  for x = 0 to Array.length parameters - 1 do
    let (_, paramName) = parameters.(x).(0) in
    let (paramType, _) = parameters.(x).(1) in
    let accum = "--" ^ boundary ^ "\r\n" ^ "Content-Disposition: form-data; name=\"" ^ paramName ^ "\"" in
    if paramType = "value" then (
      let (_, paramValue) = parameters.(x).(1) in
      postData := if Array.length parameters.(x) == 3 then (
        let (_, contentType) = parameters.(x).(2) in
        !postData ^ accum ^ "\r\n" ^ "Content-Type: " ^ contentType ^ "\r\n\r\n" ^ paramValue ^ "\r\n"
      ) else (
        !postData ^ accum ^ "\r\n\r\n" ^ paramValue ^ "\r\n"
      );
    )
    else if paramType = "fileName" then (
      let (_, filepath) = parameters.(x).(1) in
      postData := !postData ^ accum ^ "; filename=\""^ filepath ^"\"\r\n";
      let ch = open_in filepath in
        let fileContent = really_input_string ch (in_channel_length ch) in
        close_in ch;
      postData := !postData ^ "Content-Type: {content-type header}\r\n\r\n"^ fileContent ^"\r\n";
    )
  done;;
  postData := !postData ^ "--" ^ boundary ^ "--"
  
  let reqBody = 
    let uri = Uri.of_string "https://api.itsaaz.ir/ai/nationalfront" in
    let headers = Header.init ()
      |> fun h -> Header.add h "accept" "application/json"
      |> fun h -> Header.add h "Authorization" "Bearer YOUR-TOKEN"
      |> fun h -> Header.add h "Content-Type" "multipart/form-data"
      |> fun h -> Header.add h "content-type" "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
    in
    let body = Cohttp_lwt.Body.of_string !postData in
  
    Client.call ~headers ~body `POST uri >>= fun (_resp, body) ->
    body |> Cohttp_lwt.Body.to_string >|= fun body -> body
  
  let () =
    let respBody = Lwt_main.run reqBody in
    print_endline (respBody)
        

  <?php

  $curl = curl_init();
  
  curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.itsaaz.ir/ai/nationalfront',
    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 => array('OrderId' => '','NationalCardFrontSideImage'=> new CURLFILE('/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg')),
    CURLOPT_HTTPHEADER => array(
      'accept: application/json',
      'Authorization: Bearer YOUR-TOKEN',
      'Content-Type: multipart/form-data'
    ),
  ));
  
  $response = curl_exec($curl);
  
  curl_close($curl);
  echo $response;
  
            

  <?php
  require_once 'HTTP/Request2.php';
  $request = new HTTP_Request2();
  $request->setUrl('https://api.itsaaz.ir/ai/nationalfront');
  $request->setMethod(HTTP_Request2::METHOD_POST);
  $request->setConfig(array(
    'follow_redirects' => TRUE
  ));
  $request->setHeader(array(
    'accept' => 'application/json',
    'Authorization' => 'Bearer YOUR-TOKEN',
    'Content-Type' => 'multipart/form-data'
  ));
  $request->addPostParameter(array(
    'OrderId' => ''
  ));
  $request->addUpload('NationalCardFrontSideImage', '/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg', 'WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg', '<Content-type header>');
  try {
    $response = $request->send();
    if ($response->getStatus() == 200) {
      echo $response->getBody();
    }
    else {
      echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
      $response->getReasonPhrase();
    }
  }
  catch(HTTP_Request2_Exception $e) {
    echo 'Error: ' . $e->getMessage();
  }
            

  <?php
  $client = new http\Client;
  $request = new http\Client\Request;
  $request->setRequestUrl('https://api.itsaaz.ir/ai/nationalfront');
  $request->setRequestMethod('POST');
  $body = new http\Message\Body;
  $body->addForm(array(
    'OrderId' => ''
  ), array(
      array('name' => 'NationalCardFrontSideImage', 'type' => '<Content-type header>', 'file' => '/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg', 'data' => null)
  ));
  $request->setBody($body);
  $request->setOptions(array());
  $request->setHeaders(array(
    'accept' => 'application/json',
    'Authorization' => 'Bearer YOUR-TOKEN',
    'Content-Type' => 'multipart/form-data'
  ));
  $client->enqueue($request)->send();
  $response = $client->getResponse();
  echo $response->getBody();
  
            

  $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
  $headers.Add("accept", "application/json")
  $headers.Add("Authorization", "Bearer YOUR-TOKEN")
  $headers.Add("Content-Type", "multipart/form-data")
  
  $multipartContent = [System.Net.Http.MultipartFormDataContent]::new()
  $stringHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data")
  $stringHeader.Name = "OrderId"
  $stringContent = [System.Net.Http.StringContent]::new("")
  $stringContent.Headers.ContentDisposition = $stringHeader
  $multipartContent.Add($stringContent)
  
  $multipartFile = '/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg'
  $FileStream = [System.IO.FileStream]::new($multipartFile, [System.IO.FileMode]::Open)
  $fileHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data")
  $fileHeader.Name = "NationalCardFrontSideImage"
  $fileHeader.FileName = "WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg"
  $fileContent = [System.Net.Http.StreamContent]::new($FileStream)
  $fileContent.Headers.ContentDisposition = $fileHeader
  $multipartContent.Add($fileContent)
  
  $body = $multipartContent
  
  $response = Invoke-RestMethod 'https://api.itsaaz.ir/ai/nationalfront' -Method 'POST' -Headers $headers -Body $body
  $response | ConvertTo-Json
        

  import http.client
  import mimetypes
  from codecs import encode
  
  conn = http.client.HTTPSConnection("api.itsaaz.ir")
  dataList = []
  boundary = 'wL36Yn8afVp8Ag7AmP8qZ0SA4n1v9T'
  dataList.append(encode('--' + boundary))
  dataList.append(encode('Content-Disposition: form-data; name=OrderId;'))
  
  dataList.append(encode('Content-Type: {}'.format('text/plain')))
  dataList.append(encode(''))
  
  dataList.append(encode(""))
  dataList.append(encode('--' + boundary))
  dataList.append(encode('Content-Disposition: form-data; name=NationalCardFrontSideImage; filename={0}'.format('WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg')))
  
  fileType = mimetypes.guess_type('/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg')[0] or 'application/octet-stream'
  dataList.append(encode('Content-Type: {}'.format(fileType)))
  dataList.append(encode(''))
  
  with open('/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg', 'rb') as f:
    dataList.append(f.read())
  dataList.append(encode('--'+boundary+'--'))
  dataList.append(encode(''))
  body = b'\r\n'.join(dataList)
  payload = body
  headers = {
    'accept': 'application/json',
    'Authorization': 'Bearer YOUR-TOKEN',
    'Content-Type': 'multipart/form-data',
    'Content-type': 'multipart/form-data; boundary={}'.format(boundary)
  }
  conn.request("POST", "/ai/nationalfront", payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode("utf-8"))
            

  import requests

  url = "https://api.itsaaz.ir/ai/nationalfront"
  
  payload={'OrderId': ''}
  files=[
    ('NationalCardFrontSideImage',('WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg',open('/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg','rb'),'image/jpeg'))
  ]
  headers = {
    'accept': 'application/json',
    'Authorization': 'Bearer YOUR-TOKEN',
    'Content-Type': 'multipart/form-data'
  }
  
  response = requests.request("POST", url, headers=headers, data=payload, files=files)
  
  print(response.text)
  
            

  require "uri"
  require "net/http"
  
  url = URI("https://api.itsaaz.ir/ai/nationalfront")
  
  https = Net::HTTP.new(url.host, url.port)
  https.use_ssl = true
  
  request = Net::HTTP::Post.new(url)
  request["accept"] = "application/json"
  request["Authorization"] = "Bearer YOUR-TOKEN"
  request["Content-Type"] = "multipart/form-data"
  form_data = [['OrderId', ''],['NationalCardFrontSideImage', File.open('/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg')]]
  request.set_form form_data, 'multipart/form-data'
  response = https.request(request)
  puts response.read_body
  
        

  http --ignore-stdin --form --follow --timeout 3600 POST 'https://api.itsaaz.ir/ai/nationalfront' \
  'OrderId'= \
  'NationalCardFrontSideImage'@/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg \
  accept:'application/json' \
  Authorization:'Bearer YOUR-TOKEN' \
  Content-Type:'multipart/form-data'
            

  # wget doesn't support file upload via form data, use curl -F \
  wget --no-check-certificate --quiet \
    --method POST \
    --timeout=0 \
    --header 'accept: application/json' \
    --header 'Authorization: Bearer YOUR-TOKEN' \
    --header 'Content-Type: multipart/form-data' \
    --body-data 'OrderId=' \
     'https://api.itsaaz.ir/ai/nationalfront'
            

  import Foundation
  #if canImport(FoundationNetworking)
  import FoundationNetworking
  #endif
  
  var semaphore = DispatchSemaphore (value: 0)
  
  let parameters = [
    [
      "key": "OrderId",
      "value": "",
      "type": "text"
    ],
    [
      "key": "NationalCardFrontSideImage",
      "src": "/C:/Users/itsaaz/Downloads/WhatsApp Image 2021-06-19 at 5.58.10 PM.jpeg",
      "type": "file"
    ]] as [[String : Any]]
  
  let boundary = "Boundary-\(UUID().uuidString)"
  var body = ""
  var error: Error? = nil
  for param in parameters {
    if param["disabled"] == nil {
      let paramName = param["key"]!
      body += "--\(boundary)\r\n"
      body += "Content-Disposition:form-data; name=\"\(paramName)\""
      if param["contentType"] != nil {
        body += "\r\nContent-Type: \(param["contentType"] as! String)"
      }
      let paramType = param["type"] as! String
      if paramType == "text" {
        let paramValue = param["value"] as! String
        body += "\r\n\r\n\(paramValue)\r\n"
      } else {
        let paramSrc = param["src"] as! String
        let fileData = try NSData(contentsOfFile:paramSrc, options:[]) as Data
        let fileContent = String(data: fileData, encoding: .utf8)!
        body += "; filename=\"\(paramSrc)\"\r\n"
          + "Content-Type: \"content-type header\"\r\n\r\n\(fileContent)\r\n"
      }
    }
  }
  body += "--\(boundary)--\r\n";
  let postData = body.data(using: .utf8)
  
  var request = URLRequest(url: URL(string: "https://api.itsaaz.ir/ai/nationalfront")!,timeoutInterval: Double.infinity)
  request.addValue("application/json", forHTTPHeaderField: "accept")
  request.addValue("Bearer YOUR-TOKEN", forHTTPHeaderField: "Authorization")
  request.addValue("multipart/form-data", forHTTPHeaderField: "Content-Type")
  request.addValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
  
  request.httpMethod = "POST"
  request.httpBody = postData
  
  let task = URLSession.shared.dataTask(with: request) { data, response, error in 
    guard let data = data else {
      print(String(describing: error))
      semaphore.signal()
      return
    }
    print(String(data: data, encoding: .utf8)!)
    semaphore.signal()
  }
  
  task.resume()
  semaphore.wait()
  
        


سرویس دریافت اطلاعات پشت کارت ملی(OCR):


۱-متد فراخوانی سرویس POST می باشد.
2- پس از فراخوانی سرویس، اطلاعات کاربر مطابق آنچه در جدول پارامتر های خروجی نمایش داده شده است، ارسال می شود.
3-در این سرویس با استفاده از سیستم پردازش تصویر دیتای کاربر از روی عکس کارت ملی دریافت می شود:


  https://api.itsaaz.ir/ai/nationalback
        

      

  Post
        
      

  accept: application/json
  Authorization: Bearer YOUR-TOKEN
  Content-Type: multipart/form-data
        
      

  NationalCardBackSideImage=@"/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif"
        
      

  {
    "data": {
      "result": نتیجه,
      "serialCard": "کد پیگیری",
      "nationalCode": "کد ملی"
    },
    "meta": null,
    "error": null
  }
        
      

پارامترهای ورودی

ردیف پارامتر ورودی نوع ورودی توضیحات
1 NationalCardBackSideImage File تصویر پشت کارت ملی

نمونه کد


  var client = new RestClient("https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide");
  client.Timeout = -1;
  var request = new RestRequest(Method.POST);
  request.AddHeader("accept", "application/json");
  request.AddHeader("Authorization", "Bearer YOUR-TOKEN");
  request.AddHeader("Content-Type", "multipart/form-data");
  request.AddParameter("OrderId", "");
  request.AddFile("NationalCardBackSideImage", "/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif");
  IRestResponse response = client.Execute(request);
  Console.WriteLine(response.Content);
        

  curl --location --request POST 'https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide' \
  --header 'accept: application/json' \
  --header 'Authorization: Bearer YOUR-TOKEN' \
  --header 'Content-Type: multipart/form-data' \
  --form 'OrderId=""' \
  --form 'NationalCardBackSideImage=@"/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif"'
        

  var headers = {
    'accept': 'application/json',
    'Authorization': 'Bearer YOUR-TOKEN',
    'Content-Type': 'multipart/form-data'
  };
  var request = http.MultipartRequest('POST', Uri.parse('https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide'));
  request.fields.addAll({
    'OrderId': ''
  });
  request.files.add(await http.MultipartFile.fromPath('NationalCardBackSideImage', '/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif'));
  request.headers.addAll(headers);
  
  http.StreamedResponse response = await request.send();
  
  if (response.statusCode == 200) {
    print(await response.stream.bytesToString());
  }
  else {
    print(response.reasonPhrase);
  }
          
        

  package main

  import (
    "fmt"
    "bytes"
    "mime/multipart"
    "os"
    "path/filepath"
    "io"
    "net/http"
    "io/ioutil"
  )
  
  func main() {
  
    url := "https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide"
    method := "POST"
  
    payload := &bytes.Buffer{}
    writer := multipart.NewWriter(payload)
    _ = writer.WriteField("OrderId", "")
    file, errFile2 := os.Open("/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif")
    defer file.Close()
    part2,
           errFile2 := writer.CreateFormFile("NationalCardBackSideImage",filepath.Base("/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif"))
    _, errFile2 = io.Copy(part2, file)
    if errFile2 != nil {
      fmt.Println(errFile2)
      return
    }
    err := writer.Close()
    if err != nil {
      fmt.Println(err)
      return
    }
  
  
    client := &http.Client {
    }
    req, err := http.NewRequest(method, url, payload)
  
    if err != nil {
      fmt.Println(err)
      return
    }
    req.Header.Add("accept", "application/json")
    req.Header.Add("Authorization", "Bearer YOUR-TOKEN")
    req.Header.Add("Content-Type", "multipart/form-data")
  
    req.Header.Set("Content-Type", writer.FormDataContentType())
    res, err := client.Do(req)
    if err != nil {
      fmt.Println(err)
      return
    }
    defer res.Body.Close()
  
    body, err := ioutil.ReadAll(res.Body)
    if err != nil {
      fmt.Println(err)
      return
    }
    fmt.Println(string(body))
  }
        

  POST /api/v1/NationalCardInfo/BackSide HTTP/1.1
  Host: api.itsaaz.ir
  accept: application/json
  Authorization: Bearer YOUR-TOKEN
  Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
  Content-Length: 331
  
  ----WebKitFormBoundary7MA4YWxkTrZu0gW
  Content-Disposition: form-data; name="OrderId"
  
  
  ----WebKitFormBoundary7MA4YWxkTrZu0gW
  Content-Disposition: form-data; name="NationalCardBackSideImage"; filename="b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif"
  Content-Type: <Content-type header here>
  
  (data)
  ----WebKitFormBoundary7MA4YWxkTrZu0gW
  
        

    OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse("multipart/form-data");
  RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
    .addFormDataPart("OrderId","")
    .addFormDataPart("NationalCardBackSideImage","b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif",
      RequestBody.create(MediaType.parse("application/octet-stream"),
      new File("/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif")))
    .build();
  Request request = new Request.Builder()
    .url("https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide")
    .method("POST", body)
    .addHeader("accept", "application/json")
    .addHeader("Authorization", "Bearer YOUR-TOKEN")
    .addHeader("Content-Type", "multipart/form-data")
    .build();
  Response response = client.newCall(request).execute();
            

  Unirest.setTimeouts(0, 0);
  HttpResponse<String> response = Unirest.post("https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide")
    .header("accept", "application/json")
    .header("Authorization", "Bearer YOUR-TOKEN")
    .header("Content-Type", "multipart/form-data")
    .field("OrderId", "")
    .field("file", new File("/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif"))
    .asString();
  
            

  var myHeaders = new Headers();
  myHeaders.append("accept", "application/json");
  myHeaders.append("Authorization", "Bearer YOUR-TOKEN");
  myHeaders.append("Content-Type", "multipart/form-data");
  
  var formdata = new FormData();
  formdata.append("OrderId", "");
  formdata.append("NationalCardBackSideImage", fileInput.files[0], "b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif");
  
  var requestOptions = {
    method: 'POST',
    headers: myHeaders,
    body: formdata,
    redirect: 'follow'
  };
  
  fetch("https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));
            

  var form = new FormData();
  form.append("OrderId", "");
  form.append("NationalCardBackSideImage", fileInput.files[0], "b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif");
  
  var settings = {
    "url": "https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide",
    "method": "POST",
    "timeout": 0,
    "headers": {
      "accept": "application/json",
      "Authorization": "Bearer YOUR-TOKEN",
      "Content-Type": "multipart/form-data"
    },
    "processData": false,
    "mimeType": "multipart/form-data",
    "contentType": false,
    "data": form
  };
  
  $.ajax(settings).done(function (response) {
    console.log(response);
  });
            

  var data = new FormData();
  data.append("OrderId", "");
  data.append("NationalCardBackSideImage", fileInput.files[0], "b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif");
   
  var xhr = new XMLHttpRequest();
  xhr.withCredentials = true;
  
  xhr.addEventListener("readystatechange", function() {
    if(this.readyState === 4) {
      console.log(this.responseText);
    }
  });
  
  xhr.open("POST", "https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide");
  xhr.setRequestHeader("accept", "application/json");
  xhr.setRequestHeader("Authorization", "Bearer YOUR-TOKEN");
  xhr.setRequestHeader("Content-Type", "multipart/form-data");
  
  xhr.send(data);
            

  CURL *curl;
  CURLcode res;
  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
    curl_easy_setopt(curl, CURLOPT_URL, "https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide");
    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
    curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
    struct curl_slist *headers = NULL;
    headers = curl_slist_append(headers, "accept: application/json");
    headers = curl_slist_append(headers, "Authorization: Bearer YOUR-TOKEN");
    headers = curl_slist_append(headers, "Content-Type: multipart/form-data");
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
    curl_mime *mime;
    curl_mimepart *part;
    mime = curl_mime_init(curl);
    part = curl_mime_addpart(mime);
    curl_mime_name(part, "OrderId");
    curl_mime_data(part, "", CURL_ZERO_TERMINATED);
    part = curl_mime_addpart(mime);
    curl_mime_name(part, "NationalCardBackSideImage");
    curl_mime_filedata(part, "/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif");
    curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime);
    res = curl_easy_perform(curl);
    curl_mime_free(mime);
  }
  curl_easy_cleanup(curl);
  
        

  var axios = require('axios');
  var FormData = require('form-data');
  var fs = require('fs');
  var data = new FormData();
  data.append('OrderId', '');
  data.append('NationalCardBackSideImage', fs.createReadStream('/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif'));
  
  var config = {
    method: 'post',
    url: 'https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide',
    headers: { 
      'accept': 'application/json', 
      'Authorization': 'Bearer YOUR-TOKEN', 
      'Content-Type': 'multipart/form-data', 
      ...data.getHeaders()
    },
    data : data
  };
  
  axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });
  
            

  var https = require('follow-redirects').https;
  var fs = require('fs');
  
  var options = {
    'method': 'POST',
    'hostname': 'api.itsaaz.ir',
    'path': '/api/v1/NationalCardInfo/BackSide',
    'headers': {
      'accept': 'application/json',
      'Authorization': 'Bearer YOUR-TOKEN',
      'Content-Type': 'multipart/form-data'
    },
    'maxRedirects': 20
  };
  
  var req = https.request(options, function (res) {
    var chunks = [];
  
    res.on("data", function (chunk) {
      chunks.push(chunk);
    });
  
    res.on("end", function (chunk) {
      var body = Buffer.concat(chunks);
      console.log(body.toString());
    });
  
    res.on("error", function (error) {
      console.error(error);
    });
  });
  
  var postData = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"OrderId\"\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"NationalCardBackSideImage\"; filename=\"b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif\"\r\nContent-Type: \"{Insert_File_Content_Type}\"\r\n\r\n" + fs.readFileSync('/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif') + "\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--";
  
  req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
  
  req.write(postData);
  
  req.end();
            

  var request = require('request');
  var fs = require('fs');
  var options = {
    'method': 'POST',
    'url': 'https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide',
    'headers': {
      'accept': 'application/json',
      'Authorization': 'Bearer YOUR-TOKEN',
      'Content-Type': 'multipart/form-data'
    },
    formData: {
      'OrderId': '',
      'NationalCardBackSideImage': {
        'value': fs.createReadStream('/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif'),
        'options': {
          'filename': 'b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif',
          'contentType': null
        }
      }
    }
  };
  request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
  });
  
  
            

  var unirest = require('unirest');
  var req = unirest('POST', 'https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide')
    .headers({
      'accept': 'application/json',
      'Authorization': 'Bearer YOUR-TOKEN',
      'Content-Type': 'multipart/form-data'
    })
    .field('OrderId', '')
    .attach('file', '/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif')
    .end(function (res) { 
      if (res.error) throw new Error(res.error); 
      console.log(res.raw_body);
    });
  
            

  #import <Foundation/Foundation.h>

  dispatch_semaphore_t sema = dispatch_semaphore_create(0);
  
  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide"]
    cachePolicy:NSURLRequestUseProtocolCachePolicy
    timeoutInterval:10.0];
  NSDictionary *headers = @{
    @"accept": @"application/json",
    @"Authorization": @"Bearer YOUR-TOKEN",
    @"Content-Type": @"multipart/form-data"
  };
  
  [request setAllHTTPHeaderFields:headers];
  NSArray *parameters = @[
    @{ @"name": @"OrderId", @"value": @"" }, 
    @{ @"name": @"NationalCardBackSideImage", @"fileName": @"/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif" } 
  ];
  
  NSString *boundary = @"----WebKitFormBoundary7MA4YWxkTrZu0gW";
  NSError *error;
  NSMutableString *body = [NSMutableString string];
  
  for (NSDictionary *param in parameters) {
    [body appendFormat:@"--%@\r\n", boundary];
    if (param[@"fileName"]) {
      [body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
      [body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
      [body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
      if (error) {
        NSLog(@"%@", error);
      }
    } else {
      [body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
      [body appendFormat:@"%@", param[@"value"]];
    }
  }
  [body appendFormat:@"\r\n--%@--\r\n", boundary];
  NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
  [request setHTTPBody:postData];
  
  [request setHTTPMethod:@"POST"];
  
  NSURLSession *session = [NSURLSession sharedSession];
  NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
  completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
    if (error) {
      NSLog(@"%@", error);
      dispatch_semaphore_signal(sema);
    } else {
      NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
      NSError *parseError = nil;
      NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
      NSLog(@"%@",responseDictionary);
      dispatch_semaphore_signal(sema);
    }
  }];
  [dataTask resume];
  dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
        

  open Lwt
  open Cohttp
  open Cohttp_lwt_unix
  
  let parameters = [|
    [| ("name", "OrderId"); ("value", "") |];
    [| ("name", "NationalCardBackSideImage"); ("fileName", "/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif") |]
  |];;
  let boundary = "----WebKitFormBoundary7MA4YWxkTrZu0gW";;
  let postData = ref "";;
  
  for x = 0 to Array.length parameters - 1 do
    let (_, paramName) = parameters.(x).(0) in
    let (paramType, _) = parameters.(x).(1) in
    let accum = "--" ^ boundary ^ "\r\n" ^ "Content-Disposition: form-data; name=\"" ^ paramName ^ "\"" in
    if paramType = "value" then (
      let (_, paramValue) = parameters.(x).(1) in
      postData := if Array.length parameters.(x) == 3 then (
        let (_, contentType) = parameters.(x).(2) in
        !postData ^ accum ^ "\r\n" ^ "Content-Type: " ^ contentType ^ "\r\n\r\n" ^ paramValue ^ "\r\n"
      ) else (
        !postData ^ accum ^ "\r\n\r\n" ^ paramValue ^ "\r\n"
      );
    )
    else if paramType = "fileName" then (
      let (_, filepath) = parameters.(x).(1) in
      postData := !postData ^ accum ^ "; filename=\""^ filepath ^"\"\r\n";
      let ch = open_in filepath in
        let fileContent = really_input_string ch (in_channel_length ch) in
        close_in ch;
      postData := !postData ^ "Content-Type: {content-type header}\r\n\r\n"^ fileContent ^"\r\n";
    )
  done;;
  postData := !postData ^ "--" ^ boundary ^ "--"
  
  let reqBody = 
    let uri = Uri.of_string "https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide" in
    let headers = Header.init ()
      |> fun h -> Header.add h "accept" "application/json"
      |> fun h -> Header.add h "Authorization" "Bearer YOUR-TOKEN"
      |> fun h -> Header.add h "Content-Type" "multipart/form-data"
      |> fun h -> Header.add h "content-type" "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
    in
    let body = Cohttp_lwt.Body.of_string !postData in
  
    Client.call ~headers ~body `POST uri >>= fun (_resp, body) ->
    body |> Cohttp_lwt.Body.to_string >|= fun body -> body
  
  let () =
    let respBody = Lwt_main.run reqBody in
    print_endline (respBody)
        

  <?php

  $curl = curl_init();
  
  curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide',
    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 => array('OrderId' => '','NationalCardBackSideImage'=> new CURLFILE('/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif')),
    CURLOPT_HTTPHEADER => array(
      'accept: application/json',
      'Authorization: Bearer YOUR-TOKEN',
      'Content-Type: multipart/form-data'
    ),
  ));
  
  $response = curl_exec($curl);
  
  curl_close($curl);
  echo $response;
  
            

  <?php
  require_once 'HTTP/Request2.php';
  $request = new HTTP_Request2();
  $request->setUrl('https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide');
  $request->setMethod(HTTP_Request2::METHOD_POST);
  $request->setConfig(array(
    'follow_redirects' => TRUE
  ));
  $request->setHeader(array(
    'accept' => 'application/json',
    'Authorization' => 'Bearer YOUR-TOKEN',
    'Content-Type' => 'multipart/form-data'
  ));
  $request->addPostParameter(array(
    'OrderId' => ''
  ));
  $request->addUpload('NationalCardBackSideImage', '/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif', 'b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif', '<Content-type header>');
  try {
    $response = $request->send();
    if ($response->getStatus() == 200) {
      echo $response->getBody();
    }
    else {
      echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
      $response->getReasonPhrase();
    }
  }
  catch(HTTP_Request2_Exception $e) {
    echo 'Error: ' . $e->getMessage();
  }
            

  <?php
  $client = new http\Client;
  $request = new http\Client\Request;
  $request->setRequestUrl('https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide');
  $request->setRequestMethod('POST');
  $body = new http\Message\Body;
  $body->addForm(array(
    'OrderId' => ''
  ), array(
      array('name' => 'NationalCardBackSideImage', 'type' => '<Content-type header>', 'file' => '/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif', 'data' => null)
  ));
  $request->setBody($body);
  $request->setOptions(array());
  $request->setHeaders(array(
    'accept' => 'application/json',
    'Authorization' => 'Bearer YOUR-TOKEN',
    'Content-Type' => 'multipart/form-data'
  ));
  $client->enqueue($request)->send();
  $response = $client->getResponse();
  echo $response->getBody();
  
  
            

  $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
  $headers.Add("accept", "application/json")
  $headers.Add("Authorization", "Bearer YOUR-TOKEN")
  $headers.Add("Content-Type", "multipart/form-data")
  
  $multipartContent = [System.Net.Http.MultipartFormDataContent]::new()
  $stringHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data")
  $stringHeader.Name = "OrderId"
  $stringContent = [System.Net.Http.StringContent]::new("")
  $stringContent.Headers.ContentDisposition = $stringHeader
  $multipartContent.Add($stringContent)
  
  $multipartFile = '/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif'
  $FileStream = [System.IO.FileStream]::new($multipartFile, [System.IO.FileMode]::Open)
  $fileHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data")
  $fileHeader.Name = "NationalCardBackSideImage"
  $fileHeader.FileName = "b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif"
  $fileContent = [System.Net.Http.StreamContent]::new($FileStream)
  $fileContent.Headers.ContentDisposition = $fileHeader
  $multipartContent.Add($fileContent)
  
  $body = $multipartContent
  
  $response = Invoke-RestMethod 'https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide' -Method 'POST' -Headers $headers -Body $body
  $response | ConvertTo-Json
        

  import http.client
  import mimetypes
  from codecs import encode
  
  conn = http.client.HTTPSConnection("api.itsaaz.ir")
  dataList = []
  boundary = 'wL36Yn8afVp8Ag7AmP8qZ0SA4n1v9T'
  dataList.append(encode('--' + boundary))
  dataList.append(encode('Content-Disposition: form-data; name=OrderId;'))
  
  dataList.append(encode('Content-Type: {}'.format('text/plain')))
  dataList.append(encode(''))
  
  dataList.append(encode(""))
  dataList.append(encode('--' + boundary))
  dataList.append(encode('Content-Disposition: form-data; name=NationalCardBackSideImage; filename={0}'.format('b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif')))
  
  fileType = mimetypes.guess_type('/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif')[0] or 'application/octet-stream'
  dataList.append(encode('Content-Type: {}'.format(fileType)))
  dataList.append(encode(''))
  
  with open('/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif', 'rb') as f:
    dataList.append(f.read())
  dataList.append(encode('--'+boundary+'--'))
  dataList.append(encode(''))
  body = b'\r\n'.join(dataList)
  payload = body
  headers = {
    'accept': 'application/json',
    'Authorization': 'Bearer YOUR-TOKEN',
    'Content-Type': 'multipart/form-data',
    'Content-type': 'multipart/form-data; boundary={}'.format(boundary)
  }
  conn.request("POST", "/api/v1/NationalCardInfo/BackSide", payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode("utf-8"))
            

  import requests

  url = "https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide"
  
  payload={'OrderId': ''}
  files=[
    ('NationalCardBackSideImage',('b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif',open('/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif','rb'),'application/octet-stream'))
  ]
  headers = {
    'accept': 'application/json',
    'Authorization': 'Bearer YOUR-TOKEN',
    'Content-Type': 'multipart/form-data'
  }
  
  response = requests.request("POST", url, headers=headers, data=payload, files=files)
  
  print(response.text)
  
  
            

  require "uri"
  require "net/http"
  
  url = URI("https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide")
  
  https = Net::HTTP.new(url.host, url.port)
  https.use_ssl = true
  
  request = Net::HTTP::Post.new(url)
  request["accept"] = "application/json"
  request["Authorization"] = "Bearer YOUR-TOKEN"
  request["Content-Type"] = "multipart/form-data"
  form_data = [['OrderId', ''],['NationalCardBackSideImage', File.open('/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif')]]
  request.set_form form_data, 'multipart/form-data'
  response = https.request(request)
  puts response.read_body
  
        

  http --ignore-stdin --form --follow --timeout 3600 POST 'https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide' \
  'OrderId'= \
  'NationalCardBackSideImage'@/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif \
  accept:'application/json' \
  Authorization:'Bearer YOUR-TOKEN' \
  Content-Type:'multipart/form-data'
            

  # wget doesn't support file upload via form data, use curl -F \
  wget --no-check-certificate --quiet \
    --method POST \
    --timeout=0 \
    --header 'accept: application/json' \
    --header 'Authorization: Bearer YOUR-TOKEN' \
    --header 'Content-Type: multipart/form-data' \
    --body-data 'OrderId=' \
     'https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide'
            

  import Foundation
  #if canImport(FoundationNetworking)
  import FoundationNetworking
  #endif
  
  var semaphore = DispatchSemaphore (value: 0)
  
  let parameters = [
    [
      "key": "OrderId",
      "value": "",
      "type": "text"
    ],
    [
      "key": "NationalCardBackSideImage",
      "src": "/C:/Users/itsaaz/Desktop/b0cefff6-bebe-4149-b989-11d6b81cebbb.jfif",
      "type": "file"
    ]] as [[String : Any]]
  
  let boundary = "Boundary-\(UUID().uuidString)"
  var body = ""
  var error: Error? = nil
  for param in parameters {
    if param["disabled"] == nil {
      let paramName = param["key"]!
      body += "--\(boundary)\r\n"
      body += "Content-Disposition:form-data; name=\"\(paramName)\""
      if param["contentType"] != nil {
        body += "\r\nContent-Type: \(param["contentType"] as! String)"
      }
      let paramType = param["type"] as! String
      if paramType == "text" {
        let paramValue = param["value"] as! String
        body += "\r\n\r\n\(paramValue)\r\n"
      } else {
        let paramSrc = param["src"] as! String
        let fileData = try NSData(contentsOfFile:paramSrc, options:[]) as Data
        let fileContent = String(data: fileData, encoding: .utf8)!
        body += "; filename=\"\(paramSrc)\"\r\n"
          + "Content-Type: \"content-type header\"\r\n\r\n\(fileContent)\r\n"
      }
    }
  }
  body += "--\(boundary)--\r\n";
  let postData = body.data(using: .utf8)
  
  var request = URLRequest(url: URL(string: "https://api.itsaaz.ir/api/v1/NationalCardInfo/BackSide")!,timeoutInterval: Double.infinity)
  request.addValue("application/json", forHTTPHeaderField: "accept")
  request.addValue("Bearer YOUR-TOKEN", forHTTPHeaderField: "Authorization")
  request.addValue("multipart/form-data", forHTTPHeaderField: "Content-Type")
  request.addValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
  
  request.httpMethod = "POST"
  request.httpBody = postData
  
  let task = URLSession.shared.dataTask(with: request) { data, response, error in 
    guard let data = data else {
      print(String(describing: error))
      semaphore.signal()
      return
    }
    print(String(data: data, encoding: .utf8)!)
    semaphore.signal()
  }
  
  task.resume()
  semaphore.wait()