使用Objective C / iPhone发送批量短信
使用Objective C / iPhone将群发短信发送给一组联系人
Objective C / iPhone : API文档
使用Objective C / iPhone发送批量短信
Con este método puede enviar con Objective C / iPhone campañas de SMS Masivo a grupos de contactos que haya creado. Incluya el grupo, el prefijo del país, el remitente, el SMS a enviar. Este método le permite enviar campañas de SMS Masivo sin limite de destinatarios con Objective C / iPhone.
NSString *aclass = @"sms";
NSString *method = @"sendsmstogroup";
NSString *user = @"user";
NSString *password = @"password";
NSString *from = @"Afilnet";
NSString *countrycode = @"34";
NSString *idgroup = @"1";
NSString *sms = @"sms+test";
NSString *scheduledatetime = @"";
NSString *output = @"";
NSString *targetUrl = [NSString stringWithFormat:@"https://www.afilnet.com/api/http/?class=%@&method=%@&user=%@&password=%@&from=%@&countrycode=%@&idgroup=%@&sms=%@&scheduledatetime=%@&output=%@", aclass, method, user, password, from, countrycode, idgroup, sms, scheduledatetime, output]
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setHTTPMethod:@"GET"];
[request setURL:[NSURL URLWithString:targetUrl]];
[[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:
^(NSData * _Nullable data,NSURLResponse * _Nullable response,NSError * _Nullable error) {
NSString *myString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"Data received: %@", myString);
}] resume];
参数 | 描述 | 必修/可选 |
---|---|---|
class=sms | 要求的课程:要求的课程 | 必修 |
method=sendsmstogroup | 请求的类方法:发出请求的类的方法 | 必修 |
user | 您的Afilnet帐户的用户和电子邮件 | 必修 |
password | 您的Afilnet帐户的密码 | 必修 |
from | 发件人 | 必修 |
countrycode | 国家区号 | 必修 |
idgroup | 收件人组标识符 | 必修 |
sms | 短信发送 | 必修 |
scheduledatetime | 交货日期和时间,格式为yyyy-mm-dd hh:mm:ss | 可选的 |
output | 结果的输出格式 | 可选的 |
发出请求时,您将收到以下字段:
- status
-
结果(如果status = success),您将在此处收到以下值:
- id
- count
- credits
-
destinations
- messageid
- destination
- 错误(如果status = error),在这里您将收到错误代码
下面列出了可能的错误代码
码 | 描述 |
---|---|
MISSING_USER | 不包括用户或电子邮件 |
MISSING_PASSWORD | 不包含密码 |
MISSING_CLASS | 不包括课程 |
MISSING_METHOD | 不包括方法 |
MISSING_COMPULSORY_PARAM | 不包括强制参数 |
INCORRECT_USER_PASSWORD | 用户或密码错误 |
INCORRECT_CLASS | 班级不正确 |
INCORRECT_METHOD | 方法不正确 |
NOT_ACCESS_TO_GROUP | 不允许您进入指定的组 |
NO_CREDITS | 您的余额不足 |
参数:
- class : sms
- method : sendsmstogroup
- user : user
- password : password
- from : Afilnet
- countrycode : 34
- idgroup : 1
- sms : sms+test
- scheduledatetime :
- output :
请求:
https://www.afilnet.com/api/http/?class=sms&method=sendsmstogroup&user=user&password=password&from=Afilnet&countrycode=34&idgroup=1&sms=sms+test&scheduledatetime=&output=