ویرایش مخاطب
مستندات فنی
ApiReference
نسخه 1.0
فعال
دسته بندی: پیامک / مخاطبین
API Reference
لیست متدها، ورودیها، خروجیها و نمونه کدها
Post
https://portal.amootsms.com/rest/ContactEdit
ویرایش مخاطب
ContactEdit
از طریق این متد می توانید با وارد کردن اطلاعات مخاطب ، آن شخص را در دفترچه تلفن پنل کاربری ویرایش و ذخیره نمائید.
پارامترها
| نام | نوع | محل | اجباری | آرایه | توضیحات |
|---|---|---|---|---|---|
Token |
String | Header | بله | خیر | توکن ثبت شده در سامانه پیامک آموت |
ContactID |
Long | Body | بله | خیر | کد مخاطب جهت ویرایش |
ContactGroupID |
Long | Body | بله | خیر | کد گروه مخاطب |
Active |
Bool | Body | بله | خیر | فعال |
Mobile |
String | Body | بله | خیر | شماره همراه مخاطب |
FName |
String | Body | بله | خیر | نام |
LName |
String | Body | بله | خیر | نام خانوادگی |
GenderType |
Bool | Body | بله | خیر | False = خانم , True = آقا |
CompanyTitle |
String | Body | بله | خیر | عنوان شرکت |
JobTitle |
String | Body | بله | خیر | عنوان سمت/شغل |
Email |
String | Body | بله | خیر | ایمیل |
CityName |
String | Body | بله | خیر | نام شهر |
AddressText |
String | Body | بله | خیر | آدرس |
BornDate |
DateTime | Body | بله | خیر | تاریخ تولد |
AnniversaryDate |
DateTime | Body | بله | خیر | تاریخ سالگرد |
CustomText1 |
String | Body | بله | خیر | فیلد سفارشی 1 |
CustomText2 |
String | Body | بله | خیر | فیلد سفارشی 2 |
CustomText3 |
String | Body | بله | خیر | فیلد سفارشی 3 |
CustomText4 |
String | Body | بله | خیر | فیلد سفارشی 4 |
CustomText5 |
String | Body | بله | خیر | فیلد سفارشی 5 |
CustomText6 |
String | Body | بله | خیر | فیلد سفارشی 6 |
CustomDate1 |
DateTime | Body | بله | خیر | تاریخ سفارشی 1 |
CustomDate2 |
DateTime | Body | بله | خیر | تاریخ سفارشی 2 |
CustomDate3 |
DateTime | Body | بله | خیر | تاریخ سفارشی 3 |
نمونه کدها
Curl
cURL
Request
curl -X POST "https://portal.amootsms.com/rest/ContactEdit" \
-H "Authorization: MyToken" \
-F "ContactID=0" \
-F "ContactGroupID=0" \
-F "Active=true" \
-F "Mobile=09120000000" \
-F "FName=" \
-F "LName=" \
-F "GenderType=true" \
-F "CompanyTitle=" \
-F "JobTitle=" \
-F "Email=" \
-F "CityName=" \
-F "AddressText=" \
-F "BornDate=" \
-F "AnniversaryDate=" \
-F "CustomText1=" \
-F "CustomText2=" \
-F "CustomText3=" \
-F "CustomText4=" \
-F "CustomText5=" \
-F "CustomText6=" \
-F "CustomDate1=" \
-F "CustomDate2=" \
-F "CustomDate3=" \
-F "Labels[]=گروه 1" \
-F "Labels[]=گروه 2"
CSharp
C#
Request
string Token = "MyToken";
long ContactID = 0;
long ContactGroupID = 0;
bool Active = true;
string Mobile = "09120000000";
string FName = "";
string LName = "";
bool GenderType = true;
string CompanyTitle = "";
string JobTitle = "";
string Email = "";
string CityName = "";
string AddressText = "";
DateTime? BornDate = null;
DateTime? AnniversaryDate = null;
string CustomText1 = "";
string CustomText2 = "";
string CustomText3 = "";
string CustomText4 = "";
string CustomText5 = "";
string CustomText6 = "";
DateTime? CustomDate1 = null;
DateTime? CustomDate2 = null;
DateTime? CustomDate3 = null;
string[] Labels = new []{"گروه 1","گروه 2"};
using (var client = new System.Net.WebClient())
{
client.Headers.Add(System.Net.HttpRequestHeader.Authorization, Token);
var data = new System.Collections.Specialized.NameValueCollection()
{
{ "ContactID", ContactID.ToString() },
{ "ContactGroupID", ContactGroupID.ToString() },
{ "Active", Active.ToString() },
{ "Mobile", Mobile },
{ "FName", FName },
{ "LName", LName },
{ "GenderType", GenderType.ToString() },
{ "CompanyTitle", CompanyTitle },
{ "JobTitle", JobTitle },
{ "Email", Email },
{ "CityName", CityName },
{ "AddressText", AddressText },
{ "BornDate", BornDate?.ToString("yyyy-MM-dd") },
{ "AnniversaryDate", AnniversaryDate?.ToString("yyyy-MM-dd") },
{ "CustomText1", CustomText1 },
{ "CustomText2", CustomText2 },
{ "CustomText3", CustomText3 },
{ "CustomText4", CustomText4 },
{ "CustomText5", CustomText5 },
{ "CustomText6", CustomText6 },
{ "CustomDate1", CustomDate1?.ToString("yyyy-MM-dd") },
{ "CustomDate2", CustomDate2?.ToString("yyyy-MM-dd") },
{ "CustomDate3", CustomDate3?.ToString("yyyy-MM-dd") },
{ "Labels", string.Join(",", Labels) }
};
byte[] bytes = client.UploadValues("https://portal.amootsms.com/rest/ContactEdit", data);
string json = System.Text.Encoding.UTF8.GetString(bytes);
System.Console.WriteLine(json);
}
Python
Python
Request
import requests
url = "https://portal.amootsms.com/rest/ContactEdit"
headers = {"Authorization": "MyToken"}
data = {
"ContactID": 0,
"ContactGroupID": 0,
"Active": True,
"Mobile": "09120000000",
"FName": "",
"LName": "",
"GenderType": True,
"CompanyTitle": "",
"JobTitle": "",
"Email": "",
"CityName": "",
"AddressText": "",
"BornDate": None, # yyyy-MM-dd
"AnniversaryDate": None,
"CustomText1": "",
"CustomText2": "",
"CustomText3": "",
"CustomText4": "",
"CustomText5": "",
"CustomText6": "",
"CustomDate1": None,
"CustomDate2": None,
"CustomDate3": None,
"Labels": ["گروه 1", "گروه 2"],
}
r = requests.post(url, headers=headers, data=data)
print(r.text)
Php
PHP
Request
$Token = "MyToken";
$Labels = ["گروه 1", "گروه 2"];
$data = [
"ContactID" => 0,
"ContactGroupID" => 0,
"Active" => true,
"Mobile" => "09120000000",
"FName" => "",
"LName" => "",
"GenderType" => true,
"CompanyTitle" => "",
"JobTitle" => "",
"Email" => "",
"CityName" => "",
"AddressText" => "",
"BornDate" => null,
"AnniversaryDate" => null,
"CustomText1" => "",
"CustomText2" => "",
"CustomText3" => "",
"CustomText4" => "",
"CustomText5" => "",
"CustomText6" => "",
"CustomDate1" => null,
"CustomDate2" => null,
"CustomDate3" => null,
"Labels" => implode(",", $Labels)
];
$ch = curl_init("https://portal.amootsms.com/rest/ContactEdit");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ["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.nio.charset.StandardCharsets;
public class ContactEdit {
public static void main(String[] args) throws Exception {
String token = "MyToken";
String urlString = "https://portal.amootsms.com/rest/ContactEdit";
String data = String.join("&",
"ContactID=0",
"ContactGroupID=0",
"Active=true",
"Mobile=09120000000",
"FName=",
"LName=",
"GenderType=true",
"CompanyTitle=",
"JobTitle=",
"Email=",
"CityName=",
"AddressText=",
"BornDate=",
"AnniversaryDate=",
"CustomText1=",
"CustomText2=",
"CustomText3=",
"CustomText4=",
"CustomText5=",
"CustomText6=",
"CustomDate1=",
"CustomDate2=",
"CustomDate3=",
"Labels=گروه 1,گروه 2"
);
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", token);
conn.setDoOutput(true);
try (OutputStream os = conn.getOutputStream()) {
os.write(data.getBytes(StandardCharsets.UTF_8));
}
try (BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8))) {
String line; StringBuilder sb = new StringBuilder();
while ((line = br.readLine()) != null) sb.append(line);
System.out.println(sb.toString());
}
}
}