$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://callapi.asanak.com/v1/call/voice-file',
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":"USERNAME",
"password":"PASSWORD",
"file_id":"FILE_ID",
"destination": "DESTINATIONS"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
curl --location 'https://callapi.asanak.com/v1/call/voice-file' \
--header 'Content-Type: application/json' \
--data '{
"username":"USERNAME",
"password":"PASSWORD",
"file_id":"FILE_ID",
"destination": "DESTINATIONS"
}'
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://callapi.asanak.com/v1/call/voice-file");
var content = new StringContent("{\r\n \"username\":\"USERNAME\",\r\n \"password\":\"PASSWORD\",\r\n \"file_id\":\"FILE_ID\",\r\n \"destination\": \"DESTINATIONS\"\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\":\"USERNAME\",\r\n \"password\":\"PASSWORD\",\r\n \"file_id\":\"FILE_ID\",\r\n \"destination\": \"DESTINATIONS\"\r\n}");
Request request = new Request.Builder()
.url("https://callapi.asanak.com/v1/call/voice-file")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
import requests
import json
url = "https://callapi.asanak.com/v1/call/voice-file"
payload = json.dumps({
"username": "USERNAME",
"password": "PASSWORD",
"file_id": "FILE_ID",
"destination": "DESTINATIONS"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://callapi.asanak.com/v1/call/voice-file"
method := "POST"
payload := strings.NewReader(`{`+"
"+`
"username":"USERNAME",`+"
"+`
"password":"PASSWORD",`+"
"+`
"file_id":"FILE_ID",`+"
"+`
"destination": "DESTINATIONS"`+"
"+`
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
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))
}
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://callapi.asanak.com/v1/call/voice-file"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\r\n \"username\":\"USERNAME\",\r\n \"password\":\"PASSWORD\",\r\n \"file_id\":\"FILE_ID\",\r\n \"destination\": \"DESTINATIONS\"\r\n}" 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');
let data = JSON.stringify({
"username": "USERNAME",
"password": "PASSWORD",
"file_id": "FILE_ID",
"destination": "DESTINATIONS"
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://callapi.asanak.com/v1/call/voice-file',
headers: {
'Content-Type': 'application/json'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
require "uri"
require "json"
require "net/http"
url = URI("https://callapi.asanak.com/v1/call/voice-file")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"username": "USERNAME",
"password": "PASSWORD",
"file_id": "FILE_ID",
"destination": "DESTINATIONS"
})
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("Content-Type", "application/json".parse()?);
let data = r#"{
"username": "USERNAME",
"password": "PASSWORD",
"file_id": "FILE_ID",
"destination": "DESTINATIONS"
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://callapi.asanak.com/v1/call/voice-file")
.headers(headers)
.json(&json);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}