$url = 'https://sms.asanak.ir/webservice/v2rest/template';
$curl = curl_init($url);
curl_setopt_array($curl, array(
  CURLOPT_URL => $url,
  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 =>'{
    "username": "required",
    "password": "required",
    "template_id": "",
    "destination": "",
    "parameters": "",
    "send_to_blacklist": ""
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
    'Accept: application/json'
  ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
                 
                
                    curl --location 'https://sms.asanak.ir/webservice/v2rest/template' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
    "username": "required",
    "password": "required",
    "template_id": "",
    "destination": "",
    "parameters": "",
    "send_to_blacklist": ""
}'
                 
                
                    var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://sms.asanak.ir/webservice/v2rest/template");
request.Headers.Add("Accept", "application/json");
var content = new StringContent("{\r\n    \"username\": \"required\",\r\n    \"password\": \"required\",\r\n    \"template_id\": \"\",\r\n    \"destination\": \"\",\r\n    \"parameters\": \"\",\r\n    \"send_to_blacklist\": \"\"\r\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
                 
                
                    OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"username\": \"required\",\r\n    \"password\": \"required\",\r\n    \"template_id\": \"\",\r\n    \"destination\": \"\",\r\n    \"parameters\": \"\",\r\n    \"send_to_blacklist\": \"\"\r\n}");
Request request = new Request.Builder()
  .url("https://sms.asanak.ir/webservice/v2rest/template")
  .method("POST", body)
  .addHeader("Accept", "application/json")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
                 
                
                    import requests
import json
url = "https://sms.asanak.ir/webservice/v2rest/template"
payload = json.dumps({
  "username": "required",
  "password": "required",
  "template_id": "",
  "destination": "",
  "parameters": "",
  "send_to_blacklist": ""
})
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
                 
                
                    package main
import (
  "fmt"
  "bytes"
  "mime/multipart"
  "net/http"
  "io"
)
func main() {
  url := "https://sms.asanak.ir/webservice/v2rest/template"
  method := "POST"
  payload := &bytes.Buffer{}
  writer := multipart.NewWriter(payload)
  _ = writer.WriteField("username", "your-username")
  _ = writer.WriteField("password", "your-password")
  _ = writer.WriteField("source", "9821XXXXX")
  _ = writer.WriteField("message", "تست ارسال پیامک خدماتی")
  _ = writer.WriteField("destination", "0912XXXXXXX")
  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.Set("Content-Type", writer.FormDataContentType())
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()
  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
                 
                
                    
#import 
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://sms.asanak.ir/webservice/v2rest/template"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];
NSDictionary *headers = @{
  @"Accept": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSArray *parameters = @[
  @{ @"name": @"username", @"value": @"your-username" }, 
  @{ @"name": @"password", @"value": @"your-password" }, 
  @{ @"name": @"source", @"value": @"9821XXXXX" }, 
  @{ @"name": @"message", @"value": @"تست ارسال پیامک خدماتی" }, 
  @{ @"name": @"destination", @"value": @"0912XXXXXXX" } 
];
NSString *boundary = @"----WebKitFormBoundary7MA4YWxkTrZu0gW";
NSError *error;
NSMutableString *body = [NSMutableString string];
for (NSDictionary *param in parameters) {
  [body appendFormat:@"--%@\r\n", boundary];
  [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);
                 
                
                    const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();
data.append('username', 'your-username');
data.append('password', 'your-password');
data.append('source', '9821XXXXX');
data.append('message', 'تست ارسال پیامک خدماتی');
data.append('destination', '0912XXXXXXX');
let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://sms.asanak.ir/webservice/v2rest/template',
  headers: { 
    'Accept': 'application/json', 
    ...data.getHeaders()
  },
  data : data
};
axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
                 
                
                    require "uri"
require "net/http"
url = URI("https://sms.asanak.ir/webservice/v2rest/template")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
form_data = [['username', 'your-username'],['password', 'your-password'],['source', '9821XXXXX'],['message', 'تست ارسال پیامک خدماتی'],['destination', '0912XXXXXXX']]
request.set_form form_data, 'multipart/form-data'
response = https.request(request)
puts response.read_body
                 
                
                    #[tokio::main]
async fn main() -> Result<(), Box> {
    let client = reqwest::Client::builder()
        .build()?;
    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("Accept", "application/json".parse()?);
    let form = reqwest::multipart::Form::new()
        .text("username", "your-username")
        .text("password", "your-password")
        .text("source", "9821XXXXX")
        .text("message", "تست ارسال پیامک خدماتی")
        .text("destination", "0912XXXXXXX");
    let request = client.request(reqwest::Method::POST, "https://sms.asanak.ir/webservice/v2rest/template")
        .headers(headers)
        .multipart(form);
    let response = request.send().await?;
    let body = response.text().await?;
    println!("{}", body);
    Ok(())
}