در حال دریافت اطلاعات...

تغییر عنوان برچسب مخاطبین

مستندات فنی
ApiReference نسخه 1.0 فعال
دسته بندی: پیامک / مخاطبین
API Reference
لیست متدها، ورودی‌ها، خروجی‌ها و نمونه کدها
Post https://portal.amootsms.com/rest/ContactChangeLabel

تغییر عنوان برچسب مخاطبین

ContactChangeLabel
Rest فعال

با استفاده از این متد می‌توان عنوان برچسب تمام مخاطبین همان برچسب را تغییر داد

پارامترها
نام نوع محل اجباری آرایه توضیحات
Token String Header بله خیر توکن ثبت شده در سامانه پیامک آموت
FromLabel String Body بله خیر برچسب فعلی
ToLabel String Body بله خیر برچسب جدید
نمونه کدها
Curl cURL
Request
curl --location 'https://portal.amootsms.com/rest/ContactChangeLabel' \
--header 'Authorization: MyToken1234' \
--header 'Content-Type: application/json' \
--data '{
    "FromLabel":"برچسب فعلی",
    "ToLabel":"برچسب جدید"
}'
CSharp C#
Request
string Token = "MyToken";
string FromLabel = "OldLabel";
string ToLabel = "NewLabel";

using (var client = new System.Net.WebClient())
{
    client.Headers.Add(System.Net.HttpRequestHeader.Authorization, Token);

    var data = new System.Collections.Specialized.NameValueCollection()
    {
        { "FromLabel", FromLabel },
        { "ToLabel", ToLabel }
    };

    byte[] bytes = client.UploadValues("https://portal.amootsms.com/rest/ContactChangeLabel", data);
    string json = System.Text.Encoding.UTF8.GetString(bytes);
    Console.WriteLine(json); // خروجی JSON
}
Python Python
Request
import requests

Token = "MyToken"
FromLabel = "OldLabel"
ToLabel = "NewLabel"

url = "https://portal.amootsms.com/rest/ContactChangeLabel"
headers = {
    "Authorization": Token
}
data = {
    "FromLabel": FromLabel,
    "ToLabel": ToLabel
}

response = requests.post(url, headers=headers, data=data)
print(response.text)  # خروجی JSON
Php PHP
Request
$Token = "MyToken";
$FromLabel = "OldLabel";
$ToLabel = "NewLabel";

$data = array(
    "FromLabel" => $FromLabel,
    "ToLabel" => $ToLabel
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://portal.amootsms.com/rest/ContactChangeLabel");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: $Token"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

echo $response; // خروجی JSON
Java Java
Request
import java.io.*;
import java.net.*;
import java.net.URLEncoder;

public class ContactChangeLabelExample {
    public static void main(String[] args) throws Exception {
        String Token = "MyToken";
        String FromLabel = "OldLabel";
        String ToLabel = "NewLabel";

        String data = "FromLabel=" + URLEncoder.encode(FromLabel, "UTF-8") +
                      "&ToLabel=" + URLEncoder.encode(ToLabel, "UTF-8");

        URL url = new URL("https://portal.amootsms.com/rest/ContactChangeLabel");
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("POST");
        conn.setRequestProperty("Authorization", Token);
        conn.setDoOutput(true);

        conn.getOutputStream().write(data.getBytes("UTF-8"));

        BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        StringBuilder response = new StringBuilder();
        String line;
        while ((line = in.readLine()) != null) {
            response.append(line);
        }
        in.close();
        System.out.println(response.toString()); // خروجی JSON
    }
}
لطفا میزکار خود را انتخاب کنید