این متد برای ارسال پیامک به صورت یک به یک می باشد یعنی شما در هر ارسال n پیام متفاوت را به n شماره ی متفاوت ارسال می کنید، این ارسال ها به صورت همزمان بوده و در یک ساعت مشخص به تمام شماره ها ارسال می شود و به تعداد n شماره کد پیگیری به شما باز می گرداند.

{{:: 'controllers.documentation.chooseFramework' | translate }}
PM > Install-Package NikSms.Library.Net
PM > Install-Package NikSms.Library.NetCore
using NikSms.Library.Net.ViewModels; using NikSms.Library.Net.WebApi; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace AwesomeApplication { public class NikSmsApiV1Client { private readonly PublicApiV1 service; public NikSmsApiV1Client(string username, string password, string culture = "fa") { service = new PublicApiV1(username, password, culture); } public async Task<string> PtpSms( string senderNumber, Dictionary<string, string> recepients, DateTime? sendOn = null, int? sendType = null, List<string> yourMessageIds = null ) { return await PtpSms(senderNumber, recepients.Keys.ToList(), recepients.Values.ToList(), sendOn, sendType, yourMessageIds); } public async Task<string> PtpSms( string senderNumber, List<string> numbers, List<string> messages, DateTime? sendOn = null, int? sendType = null, List<string> yourMessageIds = null ) { var result = await service.PtpSms(senderNumber, numbers, messages, sendOn, sendType, yourMessageIds); switch (result.Status) { case LibOperationResultStatus.Success: return result.Data; case LibOperationResultStatus.InvalidModel: throw new Exception("Some required inputs are misssing..."); case LibOperationResultStatus.UnAuthorized: throw new Exception("Some thing is wrong with your account (call support!)"); case LibOperationResultStatus.Failed: throw new Exception("Ooops its our fault!"); default: throw new Exception("You sould not be here... :D"); } } } }
PM > Install-Package NikSms.Library.Net
PM > Install-Package NikSms.Library.NetCore
Imports NikSms.Library.Net.ViewModels Imports NikSms.Library.Net.WebApi Imports System Imports System.Collections.Generic Imports System.Linq Imports System.Threading.Tasks Namespace AwesomeApplication Public Class NikSmsApiV1Client Private ReadOnly service As PublicApiV1 Public Sub New(ByVal username As String, ByVal password As String, ByVal Optional culture As String = "fa") service = New PublicApiV1(username, password, culture) End Sub Public Async Function PtpSms(ByVal senderNumber As String, ByVal recepients As Dictionary(Of String, String), ByVal Optional sendOn As DateTime? = Nothing, ByVal Optional sendType As Integer? = Nothing, ByVal Optional yourMessageIds As List(Of String) = Nothing) As Task(Of String) Return Await PtpSms(senderNumber, recepients.Keys.ToList(), recepients.Values.ToList(), sendOn, sendType, yourMessageIds) End Function Public Async Function PtpSms(ByVal senderNumber As String, ByVal numbers As List(Of String), ByVal messages As List(Of String), ByVal Optional sendOn As DateTime? = Nothing, ByVal Optional sendType As Integer? = Nothing, ByVal Optional yourMessageIds As List(Of String) = Nothing) As Task(Of String) Dim result = Await service.PtpSms(senderNumber, numbers, messages, sendOn, sendType, yourMessageIds) Select Case result.Status Case LibOperationResultStatus.Success Return result.Data Case LibOperationResultStatus.InvalidModel Throw New Exception("Some required inputs are misssing...") Case LibOperationResultStatus.UnAuthorized Throw New Exception("Some thing is wrong with your account (call support!)") Case LibOperationResultStatus.Failed Throw New Exception("Ooops its our fault!") Case Else Throw New Exception("You sould not be here... :D") End Select End Function End Class End Namespace
npm install --save niksms.library.javascript
import { ApiV1, LibOperationResultStatus, StringDictionary } from 'niksms'; export default class NikSmsApiV1Client{ private service: ApiV1 constructor(username: string, password: string, culture: string = "fa"){ this.service = new ApiV1(username, password, culture); } public async PtpSmsAsList( senderNumber: string, numbers: string[], messages: string[], sendOn?: Date | null, sendType?: number | null, yourMessageIds?: string[] ): Promise<string> { const result = await this.service.PtpSmsAsList(senderNumber, numbers, messages, sendOn, sendType, yourMessageIds); switch (result.Status) { case LibOperationResultStatus.Success: return result.Data; case LibOperationResultStatus.InvalidModel: throw new Error("Some required inputs are misssing..."); case LibOperationResultStatus.UnAuthorized: throw new Error("Some thing is wrong with your account (call support!)"); case LibOperationResultStatus.Failed: throw new Error("Ooops its our fault!"); default: throw new Error("You sould not be here... :D"); } } public async PtpSmsAsDictionary( senderNumber: string, recipients: StringDictionary<string>, sendOn?: Date | null, sendType?: number | null, yourMessageIds?: string[] ): Promise<string> { const result = await this.service.PtpSmsAsDictionary(senderNumber, recipients, sendOn, sendType, yourMessageIds); switch (result.Status) { case LibOperationResultStatus.Success: return result.Data; case LibOperationResultStatus.InvalidModel: throw new Error("Some required inputs are misssing..."); case LibOperationResultStatus.UnAuthorized: throw new Error("Some thing is wrong with your account (call support!)"); case LibOperationResultStatus.Failed: throw new Error("Ooops its our fault!"); default: throw new Error("You sould not be here... :D"); } } }
// URL: https://niksms.com/fa/publicapi/PtpSms?username=[username]&password=[password]&senderNumber=[senderNumber]&numbers=[numbers]&message=[message] // METHODS: GET, POST // EXAMPLE: https://niksms.com/fa/publicapi/PtpSms?username=989122399413&password=**********&senderNumber=50004703&numbers=989122399413&message=salam // RESULT: