ایجاد مخاطب
مستندات فنی
ApiReference
نسخه 1.0
فعال
دسته بندی: پیامک / مخاطبین
API Reference
لیست متدها، ورودیها، خروجیها و نمونه کدها
Post
https://portal.amootsms.com/rest/ContactCreate
ایجاد مخاطب
ContactCreate
این متد برای ایجاد مخاطب جدید در دفترچه تلفن پنل کاربری استفاده میشود.
پارامترها
| نام | نوع | محل | اجباری | آرایه | توضیحات |
|---|---|---|---|---|---|
Token |
String | Header | بله | خیر | توکن ثبت شده در سامانه پیامک آموت |
ContactGroupID |
Long | Body | بله | خیر | کد گروه مخاطب (غیرفعال میباشد - 0 بگذارید) برای برچسب از پارامتر Labels استفاده کنید |
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 |
Labels |
String | Body | بله | بله | لیست عناوین برچسب |
نمونه کدها
Curl
cURL
Request
curl -X POST "https://portal.amootsms.com/rest/ContactCreate" \
-H "Authorization: MyToken" \
-F "Mobile=09120000000" \
-F "FName=" \
-F "LName=" \
-F "ContactGroupID=0" \
-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" \
-F "Active=true"
CSharp
C#
Request
string Token = "MyToken";
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[] CustomText = {"", "", "", "", "", ""};
DateTime?[] CustomDate = {null, null, null};
string[] Labels = {"گروه 1", "گروه 2"};
using (var client = new System.Net.WebClient())
{
client.Headers.Add(System.Net.HttpRequestHeader.Authorization, Token);
var data = new System.Collections.Specialized.NameValueCollection()
{
{ "Mobile", Mobile },
{ "FName", FName },
{ "LName", LName },
{ "GenderType", GenderType.ToString() },
{ "CompanyTitle", CompanyTitle },
{ "JobTitle", JobTitle },
{ "Email", Email },
{ "CityName", CityName },
{ "AddressText", AddressText },
{ "ContactGroupID", ContactGroupID.ToString() },
{ "BornDate", BornDate?.ToString("yyyy-MM-dd") },
{ "AnniversaryDate", AnniversaryDate?.ToString("yyyy-MM-dd") },
{ "CustomText1", CustomText[0] },
{ "CustomText2", CustomText[1] },
{ "CustomText3", CustomText[2] },
{ "CustomText4", CustomText[3] },
{ "CustomText5", CustomText[4] },
{ "CustomText6", CustomText[5] },
{ "CustomDate1", CustomDate[0]?.ToString("yyyy-MM-dd") },
{ "CustomDate2", CustomDate[1]?.ToString("yyyy-MM-dd") },
{ "CustomDate3", CustomDate[2]?.ToString("yyyy-MM-dd") },
{ "Labels", string.Join(",", Labels) },
};
byte[] bytes = client.UploadValues("https://portal.amootsms.com/rest/ContactCreate", data);
string json = System.Text.Encoding.UTF8.GetString(bytes);
}
Python
Python
Request
import requests
url = "https://portal.amootsms.com/rest/ContactCreate"
headers = {"Authorization": "MyToken"}
data = {
"Mobile": "09120000000",
"FName": "",
"LName": "",
"ContactGroupID": 0,
"GenderType": True,
"CompanyTitle": "",
"JobTitle": "",
"Email": "",
"CityName": "",
"AddressText": "",
"BornDate": None,
"AnniversaryDate": None,
"CustomText1": "",
"CustomText2": "",
"CustomText3": "",
"CustomText4": "",
"CustomText5": "",
"CustomText6": "",
"CustomDate1": None,
"CustomDate2": None,
"CustomDate3": None,
"Labels": ["گروه 1", "گروه 2"]
}
response = requests.post(url, headers=headers, data=data)
print(response.text)
Php
PHP
Request
$token = "MyToken";
$data = [
"Mobile" => "09120000000",
"FName" => "",
"LName" => "",
"ContactGroupID" => 0,
"GenderType" => true,
"CompanyTitle" => "",
"JobTitle" => "",
"Email" => "",
"CityName" => "",
"AddressText" => "",
"BornDate" => null,
"AnniversaryDate" => null,
"CustomText1" => "",
"CustomText2" => "",
"CustomText3" => "",
"CustomText4" => "",
"CustomText5" => "",
"CustomText6" => "",
"CustomDate1" => null,
"CustomDate2" => null,
"CustomDate3" => null,
"Labels" => ["گروه 1", "گروه 2"]
];
$ch = curl_init("https://portal.amootsms.com/rest/ContactCreate");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: $token"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;