وب سرویس پیام کوتاه قاصدک

اطلاعات کاربری

این متد برای دریافت اطلاعات کاربری شامل مقدار ریالی اعتبار باقیمانده و تاریخ انقضا حساب کاربری شخص می باشد.

پارامترهای ورودی

پارامترنوعتوضیحروش ارسال پارامتر
ApiKeystring اجباریکلید شناسهHeader

پارامترهای خروجی

پارامترتوضیح
IsSuccessوضعیت پاسخ وب سرویس
StatusCodeکد وضعیت
Messageپیام وضعیت وب سرویس
Creditمقدار موجودی کیف پول
ExpireDateتاریخ انقضا پلن
Planنوع پلن فعال

جدول خطاها

چنانچه درخواست‌های ارسالی شما با خطای خاصی مواجه شد؛ برای آگاهی از دلایل آن می‌توانید از جدول خطاها کمک بگیرید.

نمونه درخواست

                      
                        https://gateway.ghasedak.me/rest/api/v1/WebService/GetAccountInformation
                      
                    

نمونه پاسخ

                      
                        {
                          "Data": {
                            "Credit": 9135538,
                            "ExpireDate": "2024-07-16T10:48:21+03:30",
                            "Plan": "نقره ای"
                          },
                          "IsSuccess": true,
                          "StatusCode": 200,
                          "Message": "با موفقیت انجام شد"
                        }
                      
                    

نمونه کد

                                            
                                              var client = new HttpClient();
                                              client.DefaultRequestHeaders.Add("ApiKey", "your-apiKey");
                                              var request = new HttpRequestMessage(HttpMethod.Get, "https://gateway.ghasedak.me/rest/api/v1/WebService/GetAccountInformation");
                                              var response = await client.SendAsync(request);
                                              response.EnsureSuccessStatusCode();
                                              Console.WriteLine(await response.Content.ReadAsStringAsync());
                                        
                                    
 
                                              
                                                 'https://gateway.ghasedak.me/rest/api/v1/WebService/GetAccountInformation',
                                                  CURLOPT_RETURNTRANSFER => true,
                                                  CURLOPT_ENCODING => '',
                                                  CURLOPT_MAXREDIRS => 10,
                                                  CURLOPT_TIMEOUT => 0,
                                                  CURLOPT_FOLLOWLOCATION => true,
                                                  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                                                  CURLOPT_CUSTOMREQUEST => 'GET',
                                                  CURLOPT_HTTPHEADER => array(
                                                    'accept: text/plain',
                                                    'ApiKey: ' . $apiKey
                                                  ),
                                                ));
                                                
                                                $response = curl_exec($curl);
                                                
                                                curl_close($curl);
                                                echo $response;
                                                ?>
                                              
                                          
 
                                              
                                                OkHttpClient client = new OkHttpClient().newBuilder()
  .build();

MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");

Request request = new Request.Builder()
  .url("https://gateway.ghasedak.me/rest/api/v1/WebService/GetAccountInformation")
  .method("GET", body)
  .addHeader("accept", "text/plain")
  .addHeader("ApiKey", "your-ApiKey") // Replace 'your-ApiKey' with your actual API key
  .build();

Response response = client.newCall(request).execute();
                                              
                                          
 
                                              
                                                var request = require('request');

                                                var options = {
                                                  'method': 'GET',
                                                  'url': 'https://gateway.ghasedak.me/rest/api/v1/WebService/GetAccountInformation',
                                                  'headers': {
                                                    'accept': 'text/plain',
                                                    'ApiKey': 'your-ApiKey' // Replace 'your-ApiKey' with your actual API key
                                                  }
                                                };
                                                
                                                request(options, function (error, response) {
                                                  if (error) throw new Error(error);
                                                  console.log(response.body);
                                                });

                                                  
                                          
 
                                              
                                                import requests

url = "https://gateway.ghasedak.me/rest/api/v1/WebService/GetAccountInformation"

payload = {}
headers = {
    'accept': 'text/plain',
    'ApiKey': 'your-ApiKey'  # Replace 'your-ApiKey' with your actual API key
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

                                              
                                          
 
                                              
                                                package main

                                                import (
                                                  "fmt"
                                                  "io/ioutil"
                                                  "net/http"
                                                )
                                                
                                                func main() {
                                                
                                                  url := "https://gateway.ghasedak.me/rest/api/v1/WebService/GetAccountInformation"
                                                  method := "GET"
                                                
                                                  client := &http.Client{}
                                                  req, err := http.NewRequest(method, url, nil)
                                                
                                                  if err != nil {
                                                    fmt.Println(err)
                                                    return
                                                  }
                                                
                                                  req.Header.Add("accept", "text/plain")
                                                  req.Header.Add("ApiKey", "your-ApiKey") // Replace 'your-ApiKey' with your actual API key
                                                
                                                  res, err := client.Do(req)
                                                  if err != nil {
                                                    fmt.Println(err)
                                                    return
                                                  }
                                                  defer res.Body.Close()
                                                
                                                  body, err := ioutil.ReadAll(res.Body)
                                                  if err != nil {
                                                    fmt.Println(err)
                                                    return
                                                  }
                                                  fmt.Println(string(body))
                                                }


                                              
                                          
 
                                              
                                                curl -X 'GET' \
  'https://gateway.ghasedak.me/rest/api/v1/WebService/GetAccountInformation' \
  --header 'apikey: your-ApiKey'
                                              
                                          

ارسال تکی

از این متد برای ارسال پیامک به صورت تکی و ساده استفاده می‌شود.

پارامترهای ورودی

پارامترنوعتوضیح
ApiKeystring اجباریکلید شناسه
messagestring اجباریمتنی که باید ارسال شود.
lineNumberstring اجباریشماره فرستنده پیام می‌باشد، که اگر قید نشود از بین خطوط اختصاصی شما خط با اولویت بالاتر انتخاب می‌شود.
receptorstring اجباریشماره گیرنده پیام می‌باشد.
sendDatestring, date-timeتاریخ و زمان دقیق ارسال پیام که اگر قید نشود در همان لحظه پیام ارسال می‌شود.
clientReferenceIdstringبرای تعیین شماره‌ای یکتا از طرف کاربر برای هر پیامک به کار می‌رود و پس از ارسال پیامک می‌توان با متد status کلیه اطلاعات پیام ارسال‌شده را دریافت کرد.
udhbooleanبرای تعیین نوع ارسال پیام‌ها که می‌تواند 16 یا 8 بیتی باشد و اگر مقدار true پاس داده شود پیام 16 بیتی و اگر مقدار false داده شود پیام 8 بیتی ارسال خواهد شد. این پارامتر فقط برای اپراتور آسیاتک اعمال می‌شود.

پارامترهای خروجی

پارامترتوضیح
IsSuccessوضعیت پاسخ وب سرویس
StatusCodeکد وضعیت
Receptorشماره گیرنده
LineNumberشماره خطی که پیام را ارسال می‌کند
Costهزینه ارسال پیام
MessageIdشناسه پیام
Messageمتن پیام
SendDateزمان و تاریخ ارسال پیام

جدول خطاها

چنانچه درخواست‌های ارسالی شما با خطای خاصی مواجه شد؛ برای آگاهی از دلایل آن می‌توانید از جدول خطاها کمک بگیرید.

نمونه درخواست

              
              {
                "sendDate": "2024-07-03T07:22:15.842Z",
                "lineNumber": "210002100",
                "receptor": "09*********",
                "message": "test ghasedak",
                "clientReferenceId": "1",
                "udh": true
              }
              
            

نمونه پاسخ

              
              {
                  "Data": {
                      "Receptor": "09*********",
                      "LineNumber": "210002100",
                      "Cost": 1732,
                      "MessageId": "2387933",
                      "Message": "test ghasedak",
                      "SendDate": "2024-07-09T14:01:28.4277539+03:30"
                  },
                  "IsSuccess": true,
                  "StatusCode": 200,
                  "Message": "با موفقیت انجام شد"
              }
              
            

نمونه کد

                            
          using System;
          using System.Net.Http;
          using System.Text;
          using System.Threading.Tasks;
          using Newtonsoft.Json;
          
          public class SmsRequest {
              public string SendDate { get; set; }
              public string LineNumber { get; set; }
              public string Receptor { get; set; }
              public string Message { get; set; }
              public string ClientReferenceId { get; set; }
              public bool Udh { get; set; }
          }
          
          public class Program {
              public static async Task Main(string[] args) {
                  var client = new HttpClient();
                  client.DefaultRequestHeaders.Add("ApiKey","your-apiKey");
                  var request = new HttpRequestMessage(HttpMethod.Post, "https://gateway.ghasedak.me/rest/api/v1/WebService/SendSingleSMS");
          
                  var smsRequest = new SmsRequest {
                      SendDate = "2024-07-03T07:22:15.842Z",
                      LineNumber = "string",
                      Receptor = "string",
                      Message = "string",
                      ClientReferenceId = "string",
                      Udh = true
                  };
          
                  var json = JsonConvert.SerializeObject(smsRequest);
                  var content = new StringContent(json, Encoding.UTF8, "application/json");
                  request.Content = content;
          
                  var response = await client.SendAsync(request);
                  response.EnsureSuccessStatusCode();
                  Console.WriteLine(await response.Content.ReadAsStringAsync());
              }
          }
                            
                          
                            
           'https://gateway.ghasedak.me/rest/api/v1/WebService/SendSingleSMS',
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => '',
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 0,
            CURLOPT_FOLLOWLOCATION => true,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => 'POST',
            CURLOPT_POSTFIELDS =>'{
            "sendDate": "2024-07-03T07:22:15.842Z",
            "lineNumber": "string",
            "receptor": "string",
            "message": "string",
            "clientReferenceId": "string",
            "udh": true
          }',
            CURLOPT_HTTPHEADER => array(
              'Content-Type: application/json',
               'ApiKey: "your-apiKey'
            ),
          ));
          
          $response = curl_exec($curl);
          
          curl_close($curl);
          echo $response;
                            
                          
                            
          import com.google.gson.Gson;
          import okhttp3.*;
          
          import java.io.IOException;
          
          class SmsRequest {
              private String sendDate;
              private String lineNumber;
              private String receptor;
              private String message;
              private String clientReferenceId;
              private boolean udh;
          
              public SmsRequest(String sendDate, String lineNumber, String receptor, String message, String clientReferenceId, boolean udh) {
                  this.sendDate = sendDate;
                  this.lineNumber = lineNumber;
                  this.receptor = receptor;
                  this.message = message;
                  this.clientReferenceId = clientReferenceId;
                  this.udh = udh;
              }
          }
          
          public class Main {
              public static void main(String[] args) throws IOException {
                  OkHttpClient client = new OkHttpClient();
          
                  SmsRequest smsRequest = new SmsRequest(
                          "2024-07-03T07:22:15.842Z",
                          "string",
                          "string",
                          "string",
                          "string",
                          true
                  );
          
                  Gson gson = new Gson();
                  String json = gson.toJson(smsRequest);
          
                  RequestBody body = RequestBody.create(json, MediaType.parse("application/json"));
          
                  Request request = new Request.Builder()
                          .url("https://gateway.ghasedak.me/rest/api/v1/WebService/SendSingleSMS")
                          .post(body)
                          .addHeader("Content-Type", "application/json")
                          .addHeader("ApiKey", "your-apiKey")
                          .build();
          
                  try (Response response = client.newCall(request).execute()) {
                      if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
                      System.out.println(response.body().string());
                  }
              }
          }
                            
                          
                            
          var request = require('request');
          var options = {
            'method': 'POST',
            'url': 'https://gateway.ghasedak.me/rest/api/v1/WebService/SendSingleSMS',
            'headers': {
              'Content-Type': 'application/json',
              'ApiKey: "your-apiKey'
            },
            body: JSON.stringify({
              "sendDate": "2024-07-03T07:22:15.842Z",
              "lineNumber": "string",
              "receptor": "string",
              "message": "string",
              "clientReferenceId": "string",
              "udh": true
            })
          
          };
          request(options, function (error, response) {
            if (error) throw new Error(error);
            console.log(response.body);
          });
                            
                          
                            
          import requests
          import json
          
          url = "https://gateway.ghasedak.me/rest/api/v1/WebService/SendSingleSMS"
          
          payload = json.dumps({
            "sendDate": "2024-07-03T07:22:15.842Z",
            "lineNumber": "string",
            "receptor": "string",
            "message": "string",
            "clientReferenceId": "string",
            "udh": True
          })
          headers = {
            'Content-Type': 'application/json',
            'ApiKey: "your-apiKey'
          }
          
          response = requests.request("POST", url, headers=headers, data=payload)
          
          print(response.text)
                            
                          
                            
          package main
          
          import (
            "bytes"
            "encoding/json"
            "fmt"
            "net/http"
            "io/ioutil"
          )
          
          type SmsRequest struct {
            SendDate         string 'json:"sendDate"'
            LineNumber       string 'json:"lineNumber"'
            Receptor         string 'json:"receptor"'
            Message          string 'json:"message"'
            ClientReferenceId string 'json:"clientReferenceId"'
            Udh              bool   'json:"udh"'
          }
          
          func main() {
            url := "https://gateway.ghasedak.me/rest/api/v1/WebService/SendSingleSMS"
          
            smsRequest := SmsRequest{
              SendDate:         "2024-07-03T07:22:15.842Z",
              LineNumber:       "string",
              Receptor:         "string",
              Message:          "string",
              ClientReferenceId: "string",
              Udh:              true,
            }
          
            jsonData, err := json.Marshal(smsRequest)
            if err != nil {
              fmt.Println("Error marshalling JSON:", err)
              return
            }
          
            req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
            if err != nil {
              fmt.Println("Error creating request:", err)
              return
            }
            req.Header.Set("Content-Type", "application/json")
            req.Header.Set("ApiKey", "your-apiKey")
          
            client := &http.Client{}
            res, err := client.Do(req)
            if err != nil {
              fmt.Println("Error sending request:", err)
              return
            }
            defer res.Body.Close()
          
            body, err := ioutil.ReadAll(res.Body)
            if err != nil {
              fmt.Println("Error reading response:", err)
              return
            }
            fmt.Println(string(body))
          }
                            
                          
                            
          curl -X 'POST' \
          'https://gateway.ghasedak.me/rest/api/v1/WebService/SendSingleSMS' \
          -H 'ApiKey: your-ApiKey' \
          -H 'Content-Type: application/json' \
          --data '{
            "sendDate": "2024-07-03T07:22:15.842Z",
            "lineNumber": "3000****",
            "receptor": "09*********",
            "message": "ارسال پیام تکی از وب سرویس قاصدک",
            "clientReferenceId": "1",
            "udh": false
          }'
                            
                          

ارسال گروهی

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

پارامترهای ورودی

پارامترنوعتوضیحروش ارسال پارامتر
ApiKeystring اجباریکلید شناسهHeader
messagestring اجباریمتنی که باید ارسال شود.JSON body
lineNumberstring اجباریشماره فرستنده پیام می باشد، که اگر قید نشود از بین خطوط اختصاصی شما خط با اولویت بالاتر انتخاب می شود.JSON body
receptorsstring اجباریشماره گیرنده های پیام می باشد.JSON body
clientReferenceIdstring اجباریبرای تعیین شماره ای یکتا از طرف کاربر برای هر پیامک به کار می رود و پس از ارسال پیامک می توان با متد status کلیه اطلاعات پیام ارسال شده را دریافت کرد.JSON body
sendDatestring, date-timeتاریخ و زمان دقیق ارسال پیام که اگر قید نشود در همان لحظه پیام ارسال می شود.JSON body
isVoicebooleanصوتی بودن یا نبودن پیام را مشخص می کند.JSON body
udhbooleanبرای تعیین نوع ارسال پیام ها که می تواند 16 یا 8 بیتی باشد و اگر مقدار true پاس داده شود پیام 16 بیتی و اگر مقدار false داده شود پیام 8 بیتی ارسال خواهد شد همچنین لازم به ذکر است این پارامتر فقط برای اپراتور آسیاتک اعمال می شود.JSON body

پارامترهای خروجی

پارامترتوضیح
IsSuccessوضعیت پاسخ وب سرویس
StatusCodeکد وضعیت
Messageپیام وضعیت وب سرویس
Receptorشماره گیرنده
MessageIdشناسه پیام ارسالی به گیرنده
LineNumberشماره خطی که پیام را ارسال می کند
Costهزینه ارسال پیام
Messageمتن پیام
SendDateزمان و تاریخ ارسال پیام

جدول خطاها

چنانچه درخواست‌های ارسالی شما با خطای خاصی مواجه شد؛ برای آگاهی از دلایل آن می‌توانید از جدول خطاها کمک بگیرید.

نمونه درخواست

              
            {
              "sendDate": "2024-07-03T11:56:28.720Z",
              "lineNumber": "210002100",
              "receptors": [
                "0939*******","0996*******"
              ],
              "message": "test dotnet package bulk",
              "clientReferenceId": "1",
              "isVoice": true,
              "udh": true
            }
              
            

نمونه پاسخ

              
            {
              "Data": {
                "Cost": 3537,
                "LineNumber": "210002100",
                "Receptors": [
                  {
                    "Receptor": "0939*******",
                    "MessageId": "4248"
                  },
                  {
                    "Receptor": "0996*******",
                    "MessageId": "4249"
                  }
                ],
                "Message": "test dotnet package bulk",
                "SendDate": "2024-07-09T14:01:36.6632614+03:30",
              },
              "IsSuccess": true,
              "StatusCode": 200,
              "Message": "با موفقیت انجام شد"
            }
              
            

نمونه کد

                            
                              using System;
                              using System.Net.Http;
                              using System.Text;
                              using System.Threading.Tasks;
                              using Newtonsoft.Json;
            
                              public class BulkSmsRequest
                              {
                                  public string SendDate { get; set; }
                                  public string LineNumber { get; set; }
                                  public string[] Receptors { get; set; }
                                  public string Message { get; set; }
                                  public string ClientReferenceId { get; set; }
                                  public bool IsVoice { get; set; }
                                  public bool Udh { get; set; }
                              }
            
                              public class Program
                              {
                                  public static async Task Main(string[] args)
                                  {
                                      var client = new HttpClient();
                                      client.DefaultRequestHeaders.Add("ApiKey", "your-apiKey");
                                      var request = new HttpRequestMessage(HttpMethod.Post, "https://gateway.ghasedak.me/rest/api/v1/WebService/SendBulkSMS");
            
                                      var bulkSmsRequest = new BulkSmsRequest
                                      {
                                          SendDate = "2024-07-03T11:56:28.720Z",
                                          LineNumber = "string",
                                          Receptors = new[] { "string" },
                                          Message = "string",
                                          ClientReferenceId = "string",
                                          IsVoice = true,
                                          Udh = true
                                      };
            
                                      var json = JsonConvert.SerializeObject(bulkSmsRequest);
                                      var content = new StringContent(json, Encoding.UTF8, "application/json");
                                      request.Content = content;
            
                                      var response = await client.SendAsync(request);
                                      response.EnsureSuccessStatusCode();
                                      Console.WriteLine(await response.Content.ReadAsStringAsync());
                                  }
                              }
                            
                          
                            
                               'https://gateway.ghasedak.me/rest/api/v1/WebService/SendBulkSMS',
                                CURLOPT_RETURNTRANSFER => true,
                                CURLOPT_ENCODING => '',
                                CURLOPT_MAXREDIRS => 10,
                                CURLOPT_TIMEOUT => 0,
                                CURLOPT_FOLLOWLOCATION => true,
                                CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                                CURLOPT_CUSTOMREQUEST => 'POST',
                                CURLOPT_POSTFIELDS =>'{
                                "sendDate": "2024-07-03T11:56:28.720Z",
                                "lineNumber": "string",
                                "receptors": [
                                  "string"
                                ],
                                "message": "string",
                                "clientReferenceId": "string",
                                "isVoice": true,
                                "udh": true
                              }',
                                CURLOPT_HTTPHEADER => array(
                                  'Content-Type: application/json',
                                  'ApiKey: "your-apiKey'
                                ),
                              ));
            
                              $response = curl_exec($curl);
            
                              curl_close($curl);
                              echo $response;
                            
                          
                            
                              import com.google.gson.Gson;
                              import okhttp3.*;
            
                              import java.io.IOException;
            
                              class BulkSmsRequest {
                                  private String sendDate;
                                  private String lineNumber;
                                  private String[] receptors;
                                  private String message;
                                  private String clientReferenceId;
                                  private boolean isVoice;
                                  private boolean udh;
            
                                  public BulkSmsRequest(String sendDate, String lineNumber, String[] receptors, String message, String clientReferenceId, boolean isVoice, boolean udh) {
                                      this.sendDate = sendDate;
                                      this.lineNumber = lineNumber;
                                      this.receptors = receptors;
                                      this.message = message;
                                      this.clientReferenceId = clientReferenceId;
                                      this.isVoice = isVoice;
                                      this.udh = udh;
                                  }
            
                                  // Getters and setters can be added if needed
                              }
            
                              public class Main {
                                  public static void main(String[] args) throws IOException {
                                      OkHttpClient client = new OkHttpClient();
            
                                      BulkSmsRequest bulkSmsRequest = new BulkSmsRequest(
                                              "2024-07-03T11:56:28.720Z",
                                              "string",
                                              new String[]{"string"},
                                              "string",
                                              "string",
                                              true,
                                              true
                                      );
            
                                      Gson gson = new Gson();
                                      String json = gson.toJson(bulkSmsRequest);
            
                                      RequestBody body = RequestBody.create(json, MediaType.parse("application/json"));
            
                                      Request request = new Request.Builder()
                                              .url("https://gateway.ghasedak.me/rest/api/v1/WebService/SendBulkSMS")
                                              .post(body)
                                              .addHeader("Content-Type", "application/json")
                                              .addHeader("ApiKey", "your-apiKey")
                                              .build();
            
                                      try (Response response = client.newCall(request).execute()) {
                                          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
                                          System.out.println(response.body().string());
                                      }
                                  }
                              }
                            
                          
                            
                              var request = require('request');
                              var options = {
                                'method': 'POST',
                                'url': 'https://gateway.ghasedak.me/rest/api/v1/WebService/SendBulkSMS',
                                'headers': {
                                  'Content-Type': 'application/json',
                                  'ApiKey: "your-apiKey'
                                },
                                body: JSON.stringify({
                                  "sendDate": "2024-07-03T11:56:28.720Z",
                                  "lineNumber": "string",
                                  "receptors": [
                                    "string"
                                  ],
                                  "message": "string",
                                  "clientReferenceId": "string",
                                  "isVoice": true,
                                  "udh": true
                                })
            
                              };
                              request(options, function (error, response) {
                                if (error) throw new Error(error);
                                console.log(response.body);
                              });
                            
                          
                            
                              import requests
                              import json
            
                              url = "https://gateway.ghasedak.me/rest/api/v1/WebService/SendBulkSMS"
            
                              payload = json.dumps({
                                "sendDate": "2024-07-03T11:56:28.720Z",
                                "lineNumber": "string",
                                "receptors": [
                                  "string"
                                ],
                                "message": "string",
                                "clientReferenceId": "string",
                                "isVoice": True,
                                "udh": True
                              })
                              headers = {
                                'Content-Type': 'application/json',
                                'ApiKey: "your-apiKey'
                              }
            
                              response = requests.request("POST", url, headers=headers, data=payload)
            
                              print(response.text)
                            
                          
                            
                              package main
            
                              import (
                                "bytes"
                                "encoding/json"
                                "fmt"
                                "net/http"
                                "io/ioutil"
                              )
            
                              // BulkSmsRequest represents the JSON structure for the bulk SMS request
                              type BulkSmsRequest struct {
                                SendDate         string   'json:"sendDate"'
                                LineNumber       string   'json:"lineNumber"'
                                Receptors        []string 'json:"receptors"'
                                Message          string   'json:"message"'
                                ClientReferenceId string  'json:"clientReferenceId"'
                                IsVoice          bool     'json:"isVoice"'
                                Udh              bool     'json:"udh"'
                              }
            
                              func main() {
                                url := "https://gateway.ghasedak.me/rest/api/v1/WebService/SendBulkSMS"
            
                                // Create an instance of BulkSmsRequest with the necessary data
                                bulkSmsRequest := BulkSmsRequest{
                                  SendDate:         "2024-07-03T11:56:28.720Z",
                                  LineNumber:       "string",
                                  Receptors:        []string{"string"},
                                  Message:          "string",
                                  ClientReferenceId: "string",
                                  IsVoice:          true,
                                  Udh:              true,
                                }
            
                                // Convert BulkSmsRequest to JSON
                                jsonData, err := json.Marshal(bulkSmsRequest)
                                if err != nil {
                                  fmt.Println("Error marshalling JSON:", err)
                                  return
                                }
            
                                // Create a new HTTP request
                                req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
                                if err != nil {
                                  fmt.Println("Error creating request:", err)
                                  return
                                }
                                req.Header.Set("Content-Type", "application/json")
                                req.Header.Set("ApiKey", "your-apiKey")
            
                                // Send the request
                                client := &http.Client{}
                                res, err := client.Do(req)
                                if err != nil {
                                  fmt.Println("Error sending request:", err)
                                  return
                                }
                                defer res.Body.Close()
            
                                // Read the response
                                body, err := ioutil.ReadAll(res.Body)
                                if err != nil {
                                  fmt.Println("Error reading response:", err)
                                  return
                                }
                                fmt.Println(string(body))
                              }
                            
                          
                            
                              curl -X 'POST' \
                                'https://gateway.ghasedak.me/rest/api/v1/WebService/SendBulkSMS' \
                                -H 'ApiKey: your-ApiKey' \
                                -H 'Content-Type: application/json' \
                                --data '{
                                  "sendDate": "2024-07-03T11:56:28.720Z",
                                  "lineNumber": "3000****",
                                  "receptors": [
                                    "0939*******","0996*******"
                                  ],
                                  "message": "ارسال پیام گروهی از وب سرویس قاصدک",
                                  "clientReferenceId": "1",
                                  "isVoice": false,
                                  "udh": false
                                }'
                            
                          

ارسال گروهی نظیر به نظیر

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

پارامترهای ورودی

پارامترنوعتوضیحروش ارسال پارامتر
ApiKeystring اجباریکلید شناسهHeader
lineNumberstring اجباریشماره فرستنده پیام می باشد، که اگر قید نشود از بین خطوط اختصاصی شما خط با اولویت بالاتر انتخاب می شود.JSON body
receptorstring اجباریشماره گیرنده پیام می باشد.JSON body
messagestring اجباریمتنی که باید ارسال شود.JSON body
clientReferenceIdstring اجباریبرای تعیین شماره ای یکتا از طرف کاربر برای هر پیامک به کار می رود و پس از ارسال پیامک می توان با متد status کلیه اطلاعات پیام ارسال شده را دریافت کرد.JSON body
sendDatestring, date-timeتاریخ و زمان دقیق ارسال پیام که اگر قید نشود در همان لحظه پیام ارسال می شود.JSON body
udhbooleanبرای تعیین نوع ارسال پیام ها که می تواند 16 یا 8 بیتی باشد و اگر مقدار true پاس داده شود پیام 16 بیتی و اگر مقدار false داده شود پیام 8 بیتی ارسال خواهد شد همچنین لازم به ذکر است این پارامتر فقط برای اپراتور آسیاتک اعمال می شود.JSON body

پارامترهای خروجی

پارامترتوضیح
IsSuccessوضعیت پاسخ وب سرویس
StatusCodeکد وضعیت
Receptorشماره گیرنده
LineNumberشماره خطی که پیام را ارسال می کند
Costهزینه ارسال پیام
MessageIdشناسه پیام
Messageمتن پیام
SendDateزمان و تاریخ ارسال پیام

جدول خطاها

چنانچه درخواست‌های ارسالی شما با خطای خاصی مواجه شد؛ برای آگاهی از دلایل آن می‌توانید از جدول خطاها کمک بگیرید.

نمونه درخواست

          
      {
        "items": [
          {
            "lineNumber": "210002100",
            "receptor": "09*********",
            "message": "test ghasedek",
            "clientReferenceId": "1",
            "sendDate": "2024-07-03T13:07:58.793Z"
          }
        ],
        "udh": true
      }
          
        

نمونه پاسخ

          
      {
        "isSuccess": true,
        "statusCode": 200,
        "message": "string",
        "data": {
          "items": [
            {
              "lineNumber": "210002100",
              "receptor": "09*********",
              "messageId": "4249",
              "cost": 1732,
              "sendDate": "2024-07-03T13:09:03.465Z",
              "message": "test ghasedak",
            }
          ]
        }
      }
          
        

نمونه کد

                        
        using System;
        using System.Net.Http;
        using System.Text;
        using System.Threading.Tasks;
        using Newtonsoft.Json;
        using System.Collections.Generic;
        
        public class SmsItem
        {
            public string LineNumber { get; set; }
            public string Receptor { get; set; }
            public string Message { get; set; }
            public string ClientReferenceId { get; set; }
            public string SendDate { get; set; }
        }
        
        public class PairToPairSmsRequest
        {
            public List Items { get; set; }
            public bool Udh { get; set; }
        }
        
        public class Program
        {
            public static async Task Main(string[] args)
            {
                var client = new HttpClient();
                client.DefaultRequestHeaders.Add("ApiKey", "your-apiKey");
                var request = new HttpRequestMessage(HttpMethod.Post, "https://gateway.ghasedak.me/rest/api/v1/WebService/SendPairToPairSMS");
        
                var smsItem = new SmsItem
                {
                    LineNumber = "string",
                    Receptor = "string",
                    Message = "string",
                    ClientReferenceId = "string",
                    SendDate = "2024-07-03T13:07:58.793Z"
                };
        
                var pairToPairSmsRequest = new PairToPairSmsRequest
                {
                    Items = new List { smsItem },
                    Udh = true
                };
        
                var json = JsonConvert.SerializeObject(pairToPairSmsRequest);
                var content = new StringContent(json, Encoding.UTF8, "application/json");
                request.Content = content;
        
                var response = await client.SendAsync(request);
                response.EnsureSuccessStatusCode();
                Console.WriteLine(await response.Content.ReadAsStringAsync());
            }
        }
                        
                      
                        
         'https://gateway.ghasedak.me/rest/api/v1/WebService/SendPairToPairSMS',
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_ENCODING => '',
          CURLOPT_MAXREDIRS => 10,
          CURLOPT_TIMEOUT => 0,
          CURLOPT_FOLLOWLOCATION => true,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
          CURLOPT_CUSTOMREQUEST => 'POST',
          CURLOPT_POSTFIELDS =>'{
          "items": [
            {
              "lineNumber": "string",
              "receptor": "string",
              "message": "string",
              "clientReferenceId": "string",
              "sendDate": "2024-07-03T13:07:58.793Z"
            }
          ],
          "udh": true
        }',
          CURLOPT_HTTPHEADER => array(
            'Content-Type: application/json',
            'ApiKey: "your-apiKey'
          ),
        ));
        
        $response = curl_exec($curl);
        
        curl_close($curl);
        echo $response;
                        
                      
                        
        import com.google.gson.Gson;
        import okhttp3.*;
        
        import java.io.IOException;
        import java.util.ArrayList;
        import java.util.List;
        
        class SmsItem {
            private String lineNumber;
            private String receptor;
            private String message;
            private String clientReferenceId;
            private String sendDate;
        
            public SmsItem(String lineNumber, String receptor, String message, String clientReferenceId, String sendDate) {
                this.lineNumber = lineNumber;
                this.receptor = receptor;
                this.message = message;
                this.clientReferenceId = clientReferenceId;
                this.sendDate = sendDate;
            }
        
            // Getters and setters can be added if needed
        }
        
        class PairToPairSmsRequest {
            private List items;
            private boolean udh;
        
            public PairToPairSmsRequest(List items, boolean udh) {
                this.items = items;
                this.udh = udh;
            }
        
            // Getters and setters can be added if needed
        }
        
        public class Main {
            public static void main(String[] args) throws IOException {
                OkHttpClient client = new OkHttpClient();
        
                SmsItem smsItem = new SmsItem(
                        "string",
                        "string",
                        "string",
                        "string",
                        "2024-07-03T13:07:58.793Z"
                );
        
                List items = new ArrayList<>();
                items.add(smsItem);
        
                PairToPairSmsRequest pairToPairSmsRequest = new PairToPairSmsRequest(items, true);
        
                Gson gson = new Gson();
                String json = gson.toJson(pairToPairSmsRequest);
        
                RequestBody body = RequestBody.create(json, MediaType.parse("application/json"));
        
                Request request = new Request.Builder()
                        .url("https://gateway.ghasedak.me/rest/api/v1/WebService/SendPairToPairSMS")
                        .post(body)
                        .addHeader("Content-Type", "application/json")
                        .addHeader("ApiKey", "your-apiKey")
                        .build();
        
                try (Response response = client.newCall(request).execute()) {
                    if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
                    System.out.println(response.body().string());
                }
            }
        }
                        
                      
                        
        var request = require('request');
        var options = {
          'method': 'POST',
          'url': 'https://gateway.ghasedak.me/rest/api/v1/WebService/SendPairToPairSMS',
          'headers': {
            'Content-Type': 'application/json'
          },
          body: JSON.stringify({
            "items": [
              {
                "lineNumber": "string",
                "receptor": "string",
                "message": "string",
                "clientReferenceId": "string",
                "sendDate": "2024-07-03T13:07:58.793Z"
              }
            ],
            "udh": true
          })
        
        };
        request(options, function (error, response) {
          if (error) throw new Error(error);
          console.log(response.body);
        });
                        
                      
                        
        import requests
        import json
        
        url = "https://gateway.ghasedak.me/rest/api/v1/WebService/SendPairToPairSMS"
        
        payload = json.dumps({
          "items": [
            {
              "lineNumber": "string",
              "receptor": "string",
              "message": "string",
              "clientReferenceId": "string",
              "sendDate": "2024-07-03T13:07:58.793Z"
            }
          ],
          "udh": True
        })
        headers = {
          'Content-Type': 'application/json',
          'ApiKey': "your-apiKey"
        }
        
        response = requests.request("POST", url, headers=headers, data=payload)
        
        print(response.text)
                        
                      
                        
        package main
        
        import (
          "bytes"
          "encoding/json"
          "fmt"
          "net/http"
          "io/ioutil"
        )
        
        // SmsItem represents a single SMS item in the pair-to-pair SMS request
        type SmsItem struct {
          LineNumber       string 'json:"lineNumber"'
          Receptor         string 'json:"receptor"'
          Message          string 'json:"message"'
          ClientReferenceId string 'json:"clientReferenceId"'
          SendDate         string 'json:"sendDate"'
        }
        
        // PairToPairSmsRequest represents the JSON structure for the pair-to-pair SMS request
        type PairToPairSmsRequest struct {
          Items []SmsItem 'json:"items"'
          Udh   bool      'json:"udh"'
        }
        
        func main() {
          url := "https://gateway.ghasedak.me/rest/api/v1/WebService/SendPairToPairSMS"
        
          // Create an instance of SmsItem with the necessary data
          smsItem := SmsItem{
            LineNumber:       "string",
            Receptor:         "string",
            Message:          "string",
            ClientReferenceId: "string",
            SendDate:         "2024-07-03T13:07:58.793Z",
          }
        
          // Create an instance of PairToPairSmsRequest with the necessary data
          pairToPairSmsRequest := PairToPairSmsRequest{
            Items: []SmsItem{smsItem},
            Udh:   true,
          }
        
          // Convert PairToPairSmsRequest to JSON
          jsonData, err := json.Marshal(pairToPairSmsRequest)
          if err != nil {
            fmt.Println("Error marshalling JSON:", err)
            return
          }
        
          // Create a new HTTP request
          req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
          if err != nil {
            fmt.Println("Error creating request:", err)
            return
          }
          req.Header.Set("Content-Type", "application/json")
          req.Header.Set("ApiKey", "your-apiKey")
        
          // Send the request
          client := &http.Client{}
          res, err := client.Do(req)
          if err != nil {
            fmt.Println("Error sending request:", err)
            return
          }
          defer res.Body.Close()
        
          // Read the response
          body, err := ioutil.ReadAll(res.Body)
          if err != nil {
            fmt.Println("Error reading response:", err)
            return
          }
          fmt.Println(string(body))
        }
                        
                      
                        
        curl -X 'POST' \
          'https://gateway.ghasedak.me/rest/api/v1/WebService/SendPairToPairSMS' \
          -H 'ApiKey: your-ApiKey' \
          -H 'Content-Type: application/json' \
          --data '{
            "items": [
              {
                "lineNumber": "10000***",
                "receptor": "0937*****",
                "message": "ارسال پیام نظیر به نظیر از وب سرویس قاصدک",
                "clientReferenceId": "1",
                "sendDate": "2024-07-20T07:18:57.128Z"
              },
               {
                "lineNumber": "10000****",
                "receptor": "0912*****",
                "message": "ارسال پیام دوم نظیر به نظیر از وب سرویس قاصدک",
                "clientReferenceId": "2",
                "sendDate": "2024-07-20T07:18:57.128Z"
              }
            ],
            "udh": false
          }'
                        
                      

ارسال پیامک اعتبار سنجی (OTP)

سرویس اعتبارسنجی به شما این امکان را میدهد که بدون نیاز به داشتن خط خدماتی و طی کردن پروسه زمانبر تهیه آن بتوانید از طریق وب سرویس به راحتی و بالاترین سرعت ممکن پیام های خود مانند: کد فعال سازی،شماره چک و فاکتور،کد قرعه کشی و... را به تمامی کاربران اعم از فیلتر و غیر فیلتر ارسال نمایید. در متن قالب نام برند ،شرکت و یا خدمات خود را حتما ذکر نمایید و حداقل حاوی یک پارامتر %param1% باشد.حداکثر از 10 پارامتر، %param1% ، %param2% , ... , %param10% میتوان استفاده کرد.

پارامترهای ورودی

پارامترنوعتوضیحروش ارسال پارامتر
ApiKeystring اجباریکلید شناسهHeader
receptorsarray اجباریشماره گیرنده های پیام می باشد.JSON body
templateNamestring اجبارینام قالبJSON body
param1string اجباریمقادیری که از سمت شما وارد می شود.JSON body
param2stringمقادیری که از سمت شما وارد می شود.JSON body
param3stringمقادیری که از سمت شما وارد می شود.JSON body
param4stringمقادیری که از سمت شما وارد می شود.JSON body
param5stringمقادیری که از سمت شما وارد می شود.JSON body
param6stringمقادیری که از سمت شما وارد می شود.JSON body
param7stringمقادیری که از سمت شما وارد می شود.JSON body
param8stringمقادیری که از سمت شما وارد می شود.JSON body
param9stringمقادیری که از سمت شما وارد می شود.JSON body
param10stringمقادیری که از سمت شما وارد می شود.JSON body
isVoicebooleanصوتی بودن یا نبودن پیام را مشخص می کند.JSON body
udhbooleanبرای تعیین نوع ارسال پیام ها که می تواند 16 یا 8 بیتی باشد و اگر مقدار true پاس داده شود پیام 16 بیتی و اگر مقدار false داده شود پیام 8 بیتی ارسال خواهد شد.JSON body

پارامترهای خروجی

پارامترتوضیح
IsSuccessوضعیت پاسخ وب سرویس
StatusCodeکد وضعیت
LineNumberشماره خطی که OTP را ارسال می کند
MessageBodyمتن پیام OTP
Receptorشماره گیرنده
Costهزینه ارسال OTP
MessageIdشناسه OTP
SendDateزمان و تاریخ ارسال OTP

جدول خطاها

چنانچه درخواست‌های ارسالی شما با خطای خاصی مواجه شد؛ برای آگاهی از دلایل آن می‌توانید از جدول خطاها کمک بگیرید.

نمونه درخواست

          
            {
              "receptors": [
                {
                  "mobile": "0937****",
                  "clientReferenceId": "1"
                }
              ],
              "templateName": "test2",
              "param1": "12345",
              "isVoice": false,
              "udh": false
            }
          
        

نمونه پاسخ

          
            {
              "Data": {
                "LineNumber": "10002000200101",
                "MessageBody": "کد ورود شما 1234\nشرکت Ghasedak\nلغو11",
                "Items": [
                  {
                    "Receptor": "0939*******",
                    "Cost": 940,
                    "MessageId": "2387931",
                    "SendDate": "2024-07-04T06:20:10.856Z",
                  },
                  {
                    "Receptor": "0996*******",
                    "Cost": 820,
                    "MessageId": "2387932",
                    "SendDate": "2024-07-04T06:20:10.856Z",
                  }
                ],
                "Cost": 1760
              },
              "IsSuccess": true,
              "StatusCode": 200,
              "Message": "با موفقیت انجام شد"
            }
          
        

نمونه کد

                        
                          using System;
                          using System.Net.Http;
                          using System.Text;
                          using System.Threading.Tasks;
                          using Newtonsoft.Json;
      
                          public class SmsRequest
                          {
                              public string Date { get; set; }
                              public Receptor[] Receptors { get; set; }
                              public string TemplateName { get; set; }
                              public string Param1 { get; set; }
                              public bool IsVoice { get; set; }
                              public bool Udh { get; set; }
                          }
      
                          public class Receptor
                          {
                              public string Mobile { get; set; }
                              public string ClientReferenceId { get; set; }
                          }
      
                          public class Program
                          {
                              public static async Task Main(string[] args)
                              {
                                  var client = new HttpClient();
                                  client.DefaultRequestHeaders.Add("ApiKey", "your-apiKey");
                                  var request = new HttpRequestMessage(HttpMethod.Post, "https://gateway.ghasedak.me/rest/api/v1/WebService/SendOtpWithParams");
      
                                  var smsRequest = new SmsRequest
                                  {
                                      Date = "2024-07-04T06:20:10.856Z",
                                      Receptors = new[]
                                      {
                                          new Receptor
                                          {
                                              Mobile = "0937****",
                                              ClientReferenceId = "1"
                                          }
                                      },
                                      TemplateName = "test2",
                                      Param1 = "12345",
                                      IsVoice = false,
                                      Udh = false
                                  };
      
                                  var json = JsonConvert.SerializeObject(smsRequest);
                                  var content = new StringContent(json, Encoding.UTF8, "application/json");
                                  request.Content = content;
      
                                  var response = await client.SendAsync(request);
                                  response.EnsureSuccessStatusCode();
                                  Console.WriteLine(await response.Content.ReadAsStringAsync());
                              }
                          }
                        
                      
                        
                           'https://gateway.ghasedak.me/rest/api/v1/WebService/SendOtpWithParams',
                            CURLOPT_RETURNTRANSFER => true,
                            CURLOPT_ENCODING => '',
                            CURLOPT_MAXREDIRS => 10,
                            CURLOPT_TIMEOUT => 0,
                            CURLOPT_FOLLOWLOCATION => true,
                            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                            CURLOPT_CUSTOMREQUEST => 'POST',
                            CURLOPT_POSTFIELDS =>'{
                            "receptors": [
                              {
                                "mobile": "0937****",
                                "clientReferenceId": "1"
                              }
                            ],
                            "templateName": "test2",
                            "param1": "12345",
                            "isVoice": false,
                            "udh": false
                          }',
                            CURLOPT_HTTPHEADER => array(
                              'Content-Type: application/json',
                              'ApiKey: "your-apiKey'
                            ),
                          ));
      
                          $response = curl_exec($curl);
      
                          curl_close($curl);
                          echo $response;
                        
                      
                        
                          import com.google.gson.Gson;
                          import okhttp3.*;
      
                          import java.io.IOException;
      
                          class Receptor {
                              private String mobile;
                              private String clientReferenceId;
      
                              public Receptor(String mobile, String clientReferenceId) {
                                  this.mobile = mobile;
                                  this.clientReferenceId = clientReferenceId;
                              }
                          }
      
                          class SmsRequest {
                              private long date;
                              private Receptor[] receptors;
                              private String templateName;
                              private String param1;
                              private boolean isVoice;
                              private boolean udh;
      
                              public SmsRequest(long date, Receptor[] receptors, String templateName, String param1, 
                                                boolean isVoice, boolean udh) {
                                  this.date = date;
                                  this.receptors = receptors;
                                  this.templateName = templateName;
                                  this.param1 = param1;
                                  this.isVoice = isVoice;
                                  this.udh = udh;
                              }
                          }
      
                          public class Main {
                              public static void main(String[] args) throws IOException {
                                  OkHttpClient client = new OkHttpClient();
      
                                  Receptor[] receptors = { new Receptor("0937****", "1") };
      
                                  SmsRequest smsRequest = new SmsRequest(
                                          0,
                                          receptors,
                                          "test2",
                                          "12345",
                                          false,
                                          false
                                  );
      
                                  Gson gson = new Gson();
                                  String json = gson.toJson(smsRequest);
      
                                  RequestBody body = RequestBody.create(json, MediaType.parse("application/json"));
      
                                  Request request = new Request.Builder()
                                          .url("https://gateway.ghasedak.me/rest/api/v1/WebService/SendOtpWithParams")
                                          .post(body)
                                          .addHeader("Content-Type", "application/json")
                                          .addHeader("ApiKey", "your-apiKey")
                                          .build();
      
                                  try (Response response = client.newCall(request).execute()) {
                                      if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
                                      System.out.println(response.body().string());
                                  }
                              }
                          }
                        
                      
                        
                          var request = require('request');
                          var options = {
                            'method': 'POST',
                            'url': 'https://gateway.ghasedak.me/rest/api/v1/WebService/SendOtpWithParams',
                            'headers': {
                              'Content-Type': 'application/json',
                              'ApiKey: "your-apiKey'
                            },
                            body: JSON.stringify({
                              "receptors": [
                                {
                                  "mobile": "0937****",
                                  "clientReferenceId": "1"
                                }
                              ],
                              "templateName": "test2",
                              "param1": "12345",
                              "isVoice": false,
                              "udh": false
                            })
      
                          };
                          request(options, function (error, response) {
                            if (error) throw new Error(error);
                            console.log(response.body);
                          });
                        
                      
                        
                          import requests
                          import json
      
                          url = "https://gateway.ghasedak.me/rest/api/v1/WebService/SendOtpWithParams"
      
                          payload = json.dumps({
                            "receptors": [
                              {
                                "mobile": "0937****",
                                "clientReferenceId": "1"
                              }
                            ],
                            "templateName": "test2",
                            "param1": "12345",
                            "isVoice": False,
                            "udh": False
                          })
                          headers = {
                            'Content-Type': 'application/json',
                            'ApiKey: "your-apiKey'
                          }
      
                          response = requests.request("POST", url, headers=headers, data=payload)
      
                          print(response.text)
                        
                      
                        
                          package main
      
                          import (
                            "bytes"
                            "encoding/json"
                            "fmt"
                            "net/http"
                            "io/ioutil"
                          )
      
                          // Receptor represents the structure for the receptor information
                          type Receptor struct {
                            Mobile            string 'json:"mobile"'
                            ClientReferenceId string 'json:"clientReferenceId"'
                          }
      
                          // SmsRequest represents the JSON structure for the SMS request
                          type SmsRequest struct {
                            Date        int       'json:"date"'
                            Receptors   []Receptor 'json:"receptors"'
                            TemplateName string    'json:"templateName"'
                            Param1      string    'json:"param1"'
                            IsVoice     bool      'json:"isVoice"'
                            Udh         bool      'json:"udh"'
                          }
      
                          func main() {
                            url := "https://gateway.ghasedak.me/rest/api/v1/WebService/SendOtpWithParams"
      
                            // Create an instance of SmsRequest with the necessary data
                            smsRequest := SmsRequest{
                              Date: 0,
                              Receptors: []Receptor{
                                {
                                  Mobile:            "0937****",
                                  ClientReferenceId: "1",
                                },
                              },
                              TemplateName: "test2",
                              Param1:       "12345",
                              IsVoice:      false,
                              Udh:          false,
                            }
      
                            // Convert SmsRequest to JSON
                            jsonData, err := json.Marshal(smsRequest)
                            if err != nil {
                              fmt.Println("Error marshalling JSON:", err)
                              return
                            }
      
                            // Create a new HTTP request
                            req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
                            if err != nil {
                              fmt.Println("Error creating request:", err)
                              return
                            }
                            req.Header.Set("Content-Type", "application/json")
                            req.Header.Set("ApiKey", "your-apiKey")
      
                            // Send the request
                            client := &http.Client{}
                            res, err := client.Do(req)
                            if err != nil {
                              fmt.Println("Error sending request:", err)
                              return
                            }
                            defer res.Body.Close()
      
                            // Read the response
                            body, err := ioutil.ReadAll(res.Body)
                            if err != nil {
                              fmt.Println("Error reading response:", err)
                              return
                            }
                            fmt.Println(string(body))
                          }
                        
                      
                        
                          curl -X 'POST' \
                            'https://gateway.ghasedak.me/rest/api/v1/WebService/SendOtpWithParams' \
                            -H 'ApiKey: your-ApiKey' \
                            -H 'Content-Type: application/json' \
                            --data '{
                              "receptors": [
                                {
                                  "mobile": "0937****",
                                  "clientReferenceId": "1"
                                }
                              ],
                              "templateName": "test2",
                              "param1": "12345",
                              "isVoice": false,
                              "udh": false
                            }'
                        
                      

ارسال پیامک OTP جدید

این سرویس به شما امکان ارسال پیامک‌های OTP را با استفاده از وب سرویس به کاربران مختلف می‌دهد. این پیام‌ها می‌توانند شامل کدهای فعال‌سازی، چک‌های شماره‌ای، فاکتورها و موارد مشابه باشند.

پارامترهای ورودی

پارامترنوعتوضیحروش ارسال پارامتر
ApiKeystring اجباریکلید شناسهHeader
mobilestring اجباریشماره گیرنده پیامJSON body
clientReferenceIdstring اجباریشماره یکتای کاربر برای هر پیامک جهت پیگیریJSON body
templateNamestring اجبارینام قالبJSON body
paramstring اجبارینام پارامتر ورودیJSON body
valuestring اجباریمقدار پارامتر ورودیJSON body
sendDatestring , date-timeتاریخ و زمان دقیق ارسال پیام که اگر قید نشود در همان لحظه OTP ارسال می شود.JSON body
udhbooleanنوع ارسال پیام (16 یا 8 بیتی). برای اپراتور آسیاتک اعمال می‌شود.JSON body

پارامترهای خروجی

پارامترتوضیح
IsSuccessوضعیت پاسخ وب سرویس
StatusCodeکد وضعیت
MessageBodyمتن پیام OTP
LineNumberشماره خطی که OTP را ارسال می کند
Receptorشماره گیرنده
Costهزینه ارسال OTP
MessageIdشناسه OTP
SendDateزمان و تاریخ ارسال OTP
TotalCostهزینه کلی ارسال OTP

جدول خطاها

چنانچه درخواست‌های ارسالی شما با خطای خاصی مواجه شد؛ برای آگاهی از دلایل آن می‌توانید از جدول خطاها کمک بگیرید.

نمونه درخواست

          
      {
        "sendDate": "2024-07-04T07:48:52.900Z",
        "receptors": [
          {
            "mobile": "0919*******",
            "clientReferenceId": "1"
          }
        ],
        "templateName": "Test",
        "inputs": [
          {
            "param": "Company",
            "value": "GHasedak"
          }
        ],
        "udh": true
      }
          
        

نمونه پاسخ

          
      {
        "Data": {
          "LineNumber": "10002000200101",
          "MessageBody": " کد تایید شما 1234 می باشد\nبه سایت Maedeh خوش آمدید",
          "Items": [
            {
              "Receptor": "0939*******",
              "Cost": 940,
              "MessageId": "2387934",
              "SendDate": "2024-07-04T06:20:10.856Z",
            },
            {
              "Receptor": "0996*******",
              "Cost": 820,
              "MessageId": "2387935",
              "SendDate": "2024-07-04T06:20:10.856Z",
            }
          ],
          "Cost": 1760
        },
        "IsSuccess": true,
        "StatusCode": 200,
        "Message": "با موفقیت انجام شد"
      }
          
        

نمونه کد

                        
                          using System;
                          using System.Net.Http;
                          using System.Text;
                          using System.Threading.Tasks;
                          using Newtonsoft.Json;
      
                          public class Receptor
                          {
                              public string Mobile { get; set; }
                              public string ClientReferenceId { get; set; }
                          }
      
                          public class Input
                          {
                              public string Param { get; set; }
                              public string Value { get; set; }
                          }
      
                          public class SmsRequest
                          {
                              public string SendDate { get; set; }
                              public Receptor[] Receptors { get; set; }
                              public string TemplateName { get; set; }
                              public Input[] Inputs { get; set; }
                              public bool Udh { get; set; }
                          }
      
                          public class Program
                          {
                              public static async Task Main(string[] args)
                              {
                                  var client = new HttpClient();
                                  client.DefaultRequestHeaders.Add("ApiKey", "your-apiKey");
                                  var request = new HttpRequestMessage(HttpMethod.Post, "https://gateway.ghasedak.me/rest/api/v1/WebService/SendOtpSMS");
      
                                  var smsRequest = new SmsRequest
                                  {
                                      SendDate = "2024-07-04T07:41:15.992Z",
                                      Receptors = new[]
                                      {
                                          new Receptor
                                          {
                                              Mobile = "string",
                                              ClientReferenceId = "string"
                                          }
                                      },
                                      TemplateName = "string",
                                      Inputs = new[]
                                      {
                                          new Input
                                          {
                                              Param = "string",
                                              Value = "string"
                                          }
                                      },
                                      Udh = true
                                  };
      
                                  var json = JsonConvert.SerializeObject(smsRequest);
                                  var content = new StringContent(json, Encoding.UTF8, "application/json");
                                  request.Content = content;
      
                                  var response = await client.SendAsync(request);
                                  response.EnsureSuccessStatusCode();
                                  Console.WriteLine(await response.Content.ReadAsStringAsync());
                              }
                          }
                        
                      
                        
                           'https://gateway.ghasedak.me/rest/api/v1/WebService/SendOtpSMS',
                            CURLOPT_RETURNTRANSFER => true,
                            CURLOPT_ENCODING => '',
                            CURLOPT_MAXREDIRS => 10,
                            CURLOPT_TIMEOUT => 0,
                            CURLOPT_FOLLOWLOCATION => true,
                            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                            CURLOPT_CUSTOMREQUEST => 'POST',
                            CURLOPT_POSTFIELDS =>'{
                            "sendDate": "2024-07-04T07:41:15.992Z",
                            "receptors": [
                              {
                                "mobile": "string",
                                "clientReferenceId": "string"
                              }
                            ],
                            "templateName": "string",
                            "inputs": [
                              {
                                "param": "string",
                                "value": "string"
                              }
                            ],
                            "udh": true
                          }',
                            CURLOPT_HTTPHEADER => array(
                              'Content-Type: application/json',
                              'ApiKey: "your-apiKey'
                            ),
                          ));
      
                          $response = curl_exec($curl);
      
                          curl_close($curl);
                          echo $response;
                        
                      
                        
                          import com.google.gson.Gson;
                          import okhttp3.*;
      
                          import java.io.IOException;
      
                          class Receptor {
                              private String mobile;
                              private String clientReferenceId;
      
                              public Receptor(String mobile, String clientReferenceId) {
                                  this.mobile = mobile;
                                  this.clientReferenceId = clientReferenceId;
                              }
      
                              // Getters and setters can be added if needed
                          }
      
                          class Input {
                              private String param;
                              private String value;
      
                              public Input(String param, String value) {
                                  this.param = param;
                                  this.value = value;
                              }
      
                              // Getters and setters can be added if needed
                          }
      
                          class SmsRequest {
                              private String sendDate;
                              private Receptor[] receptors;
                              private String templateName;
                              private Input[] inputs;
                              private boolean udh;
      
                              public SmsRequest(String sendDate, Receptor[] receptors, String templateName, Input[] inputs, boolean udh) {
                                  this.sendDate = sendDate;
                                  this.receptors = receptors;
                                  this.templateName = templateName;
                                  this.inputs = inputs;
                                  this.udh = udh;
                              }
      
                              // Getters and setters can be added if needed
                          }
      
                          public class Main {
                              public static void main(String[] args) throws IOException {
                                  OkHttpClient client = new OkHttpClient();
      
                                  Receptor[] receptors = { new Receptor("string", "string") };
                                  Input[] inputs = { new Input("string", "string") };
      
                                  SmsRequest smsRequest = new SmsRequest(
                                          "2024-07-04T07:41:15.992Z",
                                          receptors,
                                          "string",
                                          inputs,
                                          true
                                  );
      
                                  Gson gson = new Gson();
                                  String json = gson.toJson(smsRequest);
      
                                  RequestBody body = RequestBody.create(json, MediaType.parse("application/json"));
      
                                  Request request = new Request.Builder()
                                          .url("https://gateway.ghasedak.me/rest/api/v1/WebService/SendOtpSMS")
                                          .post(body)
                                          .addHeader("Content-Type", "application/json")
                                          .addHeader("ApiKey", "your-apiKey")
                                          .build();
      
                                  try (Response response = client.newCall(request).execute()) {
                                      if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
                                      System.out.println(response.body().string());
                                  }
                              }
                          }
                        
                      
                        
                          var request = require('request');
                          var options = {
                            'method': 'POST',
                            'url': 'https://gateway.ghasedak.me/rest/api/v1/WebService/SendOtpSMS',
                            'headers': {
                              'Content-Type': 'application/json',
                              'ApiKey: "your-apiKey'
                            },
                            body: JSON.stringify({
                              "sendDate": "2024-07-04T07:41:15.992Z",
                              "receptors": [
                                {
                                  "mobile": "string",
                                  "clientReferenceId": "string"
                                }
                              ],
                              "templateName": "string",
                              "inputs": [
                                {
                                  "param": "string",
                                  "value": "string"
                                }
                              ],
                              "udh": true
                            })
      
                          };
                          request(options, function (error, response) {
                            if (error) throw new Error(error);
                            console.log(response.body);
                          });
                        
                      
                        
                          import requests
                          import json
      
                          url = "https://gateway.ghasedak.me/rest/api/v1/WebService/SendOtpSMS"
      
                          payload = json.dumps({
                            "sendDate": "2024-07-04T07:41:15.992Z",
                            "receptors": [
                              {
                                "mobile": "string",
                                "clientReferenceId": "string"
                              }
                            ],
                            "templateName": "string",
                            "inputs": [
                              {
                                "param": "string",
                                "value": "string"
                              }
                            ],
                            "udh": True
                          })
                          headers = {
                            'Content-Type': 'application/json',
                            'ApiKey: "your-apiKey'
                          }
      
                          response = requests.request("POST", url, headers=headers, data=payload)
      
                          print(response.text)
                        
                      
                        
                          package main
      
                          import (
                            "bytes"
                            "encoding/json"
                            "fmt"
                            "net/http"
                            "io/ioutil"
                          )
      
                          // Receptor represents the structure for the receptor information
                          type Receptor struct {
                            Mobile            string 'json:"mobile"'
                            ClientReferenceId string 'json:"clientReferenceId"'
                          }
      
                          // Input represents the structure for the input parameters
                          type Input struct {
                            Param string 'json:"param"'
                            Value string 'json:"value"'
                          }
      
                          // SmsRequest represents the JSON structure for the SMS request
                          type SmsRequest struct {
                            SendDate    string     'json:"sendDate"'
                            Receptors   []Receptor 'json:"receptors"'
                            TemplateName string    'json:"templateName"'
                            Inputs      []Input    'json:"inputs"'
                            Udh         bool       'json:"udh"'
                          }
      
                          func main() {
                            url := "https://gateway.ghasedak.me/rest/api/v1/WebService/SendOtpSMS"
      
                            // Create an instance of SmsRequest with the necessary data
                            smsRequest := SmsRequest{
                              SendDate: "2024-07-04T07:41:15.992Z",
                              Receptors: []Receptor{
                                {
                                  Mobile:            "string",
                                  ClientReferenceId: "string",
                                },
                              },
                              TemplateName: "string",
                              Inputs: []Input{
                                {
                                  Param: "string",
                                  Value: "string",
                                },
                              },
                              Udh: true,
                            }
      
                            // Convert SmsRequest to JSON
                            jsonData, err := json.Marshal(smsRequest)
                            if err != nil {
                              fmt.Println("Error marshalling JSON:", err)
                              return
                            }
      
                            // Create a new HTTP request
                            req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
                            if err != nil {
                              fmt.Println("Error creating request:", err)
                              return
                            }
                            req.Header.Set("Content-Type", "application/json")
                            req.Header.Set("ApiKey", "your-apiKey")
      
                            // Send the request
                            client := &http.Client{}
                            res, err := client.Do(req)
                            if err != nil {
                              fmt.Println("Error sending request:", err)
                              return
                            }
                            defer res.Body.Close()
      
                            // Read the response
                            body, err := ioutil.ReadAll(res.Body)
                            if err != nil {
                              fmt.Println("Error reading response:", err)
                              return
                            }
                            fmt.Println(string(body))
                          }
                        
                      
                        
                          curl -X 'POST' \
                            'https://gateway.ghasedak.me/rest/api/v1/WebService/SendOtpSMS' \
                            -H 'ApiKey: your-ApiKey' \
                            -H 'Content-Type: application/json' \
                            --data '{
                              "sendDate": "2024-07-04T07:41:15.992Z",
                              "receptors": [
                                {
                                  "mobile": "string",
                                  "clientReferenceId": "string"
                                }
                              ],
                              "templateName": "string",
                              "inputs": [
                                {
                                  "param": "string",
                                  "value": "string"
                                }
                              ],
                              "udh": true
                            }'
                        
                      

دریافت پارامترهای قالب OTP

از این متد برای گرفتن پارامتر های قالب اعتبار سنجی استفاده می‌شود.

پارامترهای ورودی

پارامترنوعتوضیحروش ارسال پارامتر
ApiKeystring اجباریکلید شناسهHeader
TemplateNamestring اجبارینام قالبQuery parameter

پارامترهای خروجی

پارامترتوضیح
IsSuccessوضعیت پاسخ وب سرویس
StatusCodeکد وضعیت
Messageپیام وضعیت وب سرویس
Paramsنام پارامترها
Messageپیام OTP

جدول خطاها

چنانچه درخواست‌های ارسالی شما با خطای خاصی مواجه شد؛ برای آگاهی از دلایل آن می‌توانید از جدول خطاها کمک بگیرید.

نمونه درخواست

          
            https://gateway.ghasedak.me/rest/api/v1/WebService/GetOtpTemplateParameters?TemplateName=test
          
        

نمونه پاسخ

          
            {
              "Data": {
                "Params": ["Code", "Name"],
                "Message": "کد تایید شما %Code% می‌باشد\nبه سایت %Name% خوش آمدید"
              },
              "IsSuccess": true,
              "StatusCode": 200,
              "Message": "با موفقیت انجام شد"
            }
          
        

نمونه کد

                        
                          var client = new HttpClient();
                          client.DefaultRequestHeaders.Add("ApiKey", "your-apiKey");
                          var request = new HttpRequestMessage(HttpMethod.Get, "https://gateway.ghasedak.me/rest/api/v1/WebService/GetOtpTemplateParameters?TemplateName=test");
                          var response = await client.SendAsync(request);
                          response.EnsureSuccessStatusCode();
                          Console.WriteLine(await response.Content.ReadAsStringAsync());
                        
                      
                        
                           'https://gateway.ghasedak.me/rest/api/v1/WebService/GetOtpTemplateParameters?TemplateName=test',
                            CURLOPT_RETURNTRANSFER => true,
                            CURLOPT_ENCODING => '',
                            CURLOPT_MAXREDIRS => 10,
                            CURLOPT_TIMEOUT => 0,
                            CURLOPT_FOLLOWLOCATION => true,
                            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                            CURLOPT_CUSTOMREQUEST => 'GET',
                            CURLOPT_HTTPHEADER => array(
                              'ApiKey: your-apiKey'
                            ),
                          ));
                          $response = curl_exec($curl);
                          curl_close($curl);
                          echo $response;
                        
                      
                        
                          OkHttpClient client = new OkHttpClient().newBuilder()
                            .build();
                          MediaType mediaType = MediaType.parse("text/plain");
                          RequestBody body = RequestBody.create(mediaType, "");
                          Request request = new Request.Builder()
                            .url("https://gateway.ghasedak.me/rest/api/v1/WebService/GetOtpTemplateParameters?TemplateName=test")
                            .method("GET", body)
                            .addHeader("ApiKey", "your-apiKey")
                            .build();
                          Response response = client.newCall(request).execute();
                        
                      
                        
                          var request = require('request');
                          var options = {
                            'method': 'GET',
                            'url': 'https://gateway.ghasedak.me/rest/api/v1/WebService/GetOtpTemplateParameters?TemplateName=test',
                            'headers': {
                              'ApiKey: "your-apiKey'
                            }
                          };
                          request(options, function (error, response) {
                            if (error) throw new Error(error);
                            console.log(response.body);
                          });
                        
                      
                        
                          import requests
                          url = "https://gateway.ghasedak.me/rest/api/v1/WebService/GetOtpTemplateParameters?TemplateName=test"
                          payload = {}
                          headers = {
                            'ApiKey: "your-apiKey'
                          }
                          response = requests.request("GET", url, headers=headers, data=payload)
                          print(response.text)
                        
                      
                        
                          package main
                          import (
                            "fmt"
                            "net/http"
                            "io/ioutil"
                          )
                          func main() {
                            url := "https://gateway.ghasedak.me/rest/api/v1/WebService/GetOtpTemplateParameters?TemplateName=test"
                            method := "GET"
                            client := &http.Client {}
                            req, err := http.NewRequest(method, url, nil)
                            if err != nil {
                              fmt.Println(err)
                              return
                            }
                            req.Header.Add("ApiKey", "your-apiKey")
                            res, err := client.Do(req)
                            if err != nil {
                              fmt.Println(err)
                              return
                            }
                            defer res.Body.Close()
                            body, err := ioutil.ReadAll(res.Body)
                            if err != nil {
                              fmt.Println("Error reading response:", err)
                              return
                            }
                            fmt.Println(string(body))
                          }
                        
                      
                        
                          curl -X 'GET' \
                            'https://gateway.ghasedak.me/rest/api/v1/WebService/GetOtpTemplateParameters?TemplateName=test' \
                            -H 'accept: */*' \
                            -H 'ApiKey: your-apiKey'
                        
                      

وضعیت پیام های ارسالی

برای دریافت وضعیت پیامک ارسالی به گیرنده از این متد استفاده می‌شود. کاربر می‌تواند با هر بار فراخوانی این متد وضعیت 100 پیامک را دریافت کند.

پارامترهای ورودی

پارامترنوعتوضیحروش ارسال پارامتر
ApiKeystring اجباریکلید شناسهHeader
Idsarray[string] اجباریشناسه پیامک که با ( , ) ازهم جدا می‌شوند.Query parameter
Typeinteger اجبارینوع id پیام را مشخص می‌کند ( 1 برای messageid و 2 برای checkid )Query parameter

پارامترهای خروجی

پارامترتوضیح
IsSuccessوضعیت پاسخ وب سرویس
StatusCodeکد وضعیت
MessageIdشناسه پیام
clientReferenceIdبرای تعیین شماره‌ای یکتا از طرف کاربر برای هر پیامک به کار می‌رود و پس از ارسال پیامک می‌توان با متد status کلیه اطلاعات OTP ارسال شده را دریافت کرد.
Messageمتن پیام
LineNumberشماره خط ارسال پیام
Senderفرستنده
Receptorگیرنده
Statusوضعیت پیام
Priceهزینه پیام
SendDateتاریخ ارسال پیام

جدول خطاها

چنانچه درخواست‌های ارسالی شما با خطای خاصی مواجه شد؛ برای آگاهی از دلایل آن می‌توانید از جدول خطاها کمک بگیرید.

نمونه درخواست

          
            https://gateway.ghasedak.me/rest/api/v1/WebService/CheckSmsStatus?Ids=string&Type=1
          
        

نمونه پاسخ

          
            {
              "Data": [
                {
                  "MessageId": "2387931",
                  "ClientReferenceId": "testOldOtp2",
                  "Message": "کد ورود شما 1234\nشرکت Ghasedak\nلغو11",
                  "LineNumber": "10002000200101",
                  "Receptor": "09396387926",
                  "Status": 6,
                  "Price": 940,
                  "SendDate": "2024-07-09T14:01:02.193563"
                },
                {
                  "MessageId": "4248",
                  "ClientReferenceId": "testbulk",
                  "Message": "test dotnet package bulk",
                  "LineNumber": "210002100",
                  "Receptor": "09396387926",
                  "Status": 0,
                  "Price": 1805,
                  "SendDate": "2024-07-09T14:01:36.6632614"
                }
              ],
              "IsSuccess": true,
              "StatusCode": 200,
              "Message": "با موفقیت انجام شد"
            }
          
        

نمونه کد

                        
                          var client = new HttpClient();
                          client.DefaultRequestHeaders.Add("ApiKey", "your-apiKey");
                          var request = new HttpRequestMessage(HttpMethod.Get, "https://gateway.ghasedak.me/rest/api/v1/WebService/CheckSmsStatus?Ids=string&Type=1");
                          var response = await client.SendAsync(request);
                          response.EnsureSuccessStatusCode();
                          Console.WriteLine(await response.Content.ReadAsStringAsync());
                        
                      
                        
                           'https://gateway.ghasedak.me/rest/api/v1/WebService/CheckSmsStatus?Ids=string&Type=1',
                            CURLOPT_RETURNTRANSFER => true,
                            CURLOPT_ENCODING => '',
                            CURLOPT_MAXREDIRS => 10,
                            CURLOPT_TIMEOUT => 0,
                            CURLOPT_FOLLOWLOCATION => true,
                            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                            CURLOPT_CUSTOMREQUEST => 'GET',
                            CURLOPT_HTTPHEADER => array(
                              'ApiKey: your-apiKey'
                            ),
                          ));
                          $response = curl_exec($curl);
                          curl_close($curl);
                          echo $response;
                        
                      
                        
                          OkHttpClient client = new OkHttpClient().newBuilder()
                            .build();
                          MediaType mediaType = MediaType.parse("text/plain");
                          RequestBody body = RequestBody.create(mediaType, "");
                          Request request = new Request.Builder()
                            .url("https://gateway.ghasedak.me/rest/api/v1/WebService/CheckSmsStatus?Ids=string&Type=1")
                            .method("GET", body)
                            .addHeader("ApiKey", "your-apiKey")
                            .build();
                          Response response = client.newCall(request).execute();
                        
                      
                        
                          var request = require('request');
                          var options = {
                            'method': 'GET',
                            'url': 'https://gateway.ghasedak.me/rest/api/v1/WebService/CheckSmsStatus?Ids=string&Type=1',
                            'headers': {
                              'ApiKey: "your-apiKey'
                            }
                          };
                          request(options, function (error, response) {
                            if (error) throw new Error(error);
                            console.log(response.body);
                          });
                        
                      
                        
                          import requests
                          url = "https://gateway.ghasedak.me/rest/api/v1/WebService/CheckSmsStatus?Ids=string&Type=1"
                          payload = {}
                          headers = {
                            'ApiKey: "your-apiKey'
                          }
                          response = requests.request("GET", url, headers=headers, data=payload)
                          print(response.text)
                        
                      
                        
                          package main
                          import (
                            "fmt"
                            "net/http"
                            "io/ioutil"
                          )
                          func main() {
                            url := "https://gateway.ghasedak.me/rest/api/v1/WebService/CheckSmsStatus?Ids=string&Type=1"
                            method := "GET"
                            client := &http.Client {}
                            req, err := http.NewRequest(method, url, nil)
                            if err != nil {
                              fmt.Println(err)
                              return
                            }
                            req.Header.Add("ApiKey", "your-apiKey")
                            res, err := client.Do(req)
                            if err != nil {
                              fmt.Println(err)
                              return
                            }
                            defer res.Body.Close()
                            body, err := ioutil.ReadAll(res.Body)
                            if err != nil {
                              fmt.Println("Error reading response:", err)
                              return
                            }
                            fmt.Println(string(body));
                          }
                        
                      
                        
                          curl -X 'GET' \
                            'https://gateway.ghasedak.me/rest/api/v1/WebService/CheckSmsStatus?Ids=string&Type=1' \
                            -H 'accept: */*' \
                            -H 'ApiKey: your-apiKey'
                        
                      

پیام های دریافتی

از این متد برای گرفتن لیست پیام های دریافتی استفاده می‌شود، به ازای هر بار فراخوانی این متد 100 پیام بازگردانده می‌شود.

پارامترهای ورودی

پارامترنوعتوضیحروش ارسال پارامتر
ApiKeystring اجباریکلید شناسهHeader
LineNumberstring اجباریشماره خطQuery parameter
IsReadboolean اجباریاگر (0) وارد شود پیام های خوانده نشده و اگر (1) وارد شود پیام های خوانده شده بر می‌گردد.Query parameter

پارامترهای خروجی

پارامترتوضیح
IsSuccessوضعیت پاسخ وب سرویس
StatusCodeکد وضعیت
Idشناسه پیام
Messageمتن پیام
Senderفرستنده
LineNumberشماره خط ارسال پیام
ReceiveDateزمان و تاریخ دریافت پیام

جدول خطاها

چنانچه درخواست‌های ارسالی شما با خطای خاصی مواجه شد؛ برای آگاهی از دلایل آن می‌توانید از جدول خطاها کمک بگیرید.

نمونه درخواست

    
      https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmses?LineNumber=090000&IsRead=true
    
  

نمونه پاسخ

    
      {
        "Data": {
          "Items": [
            {
              "Id": 12,
              "Message": "test rec",
              "Sender": "0933*******",
              "LineNumber": "210002100",
              "ReceiveDate": "2023-02-14T16:15:53+03:30"
            },
            {
              "Id": 11,
              "Message": "ssss",
              "Sender": "0937*******",
              "LineNumber": "210002100",
              "ReceiveDate": "2023-02-14T16:15:53+03:30"
            }
          ]
        },
        "IsSuccess": true,
        "StatusCode": 200,
        "Message": "با موفقیت انجام شد"
      }
    
  

نمونه کد

                  
                    var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("ApiKey", "your-apiKey");
                    var request = new HttpRequestMessage(HttpMethod.Get, "https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmses?LineNumber=090000&IsRead=true");
                    var response = await client.SendAsync(request);
                    response.EnsureSuccessStatusCode();
                    Console.WriteLine(await response.Content.ReadAsStringAsync());
                  
                
                  
                     'https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmses?LineNumber=090000&IsRead=true',
                      CURLOPT_RETURNTRANSFER => true,
                      CURLOPT_ENCODING => '',
                      CURLOPT_MAXREDIRS => 10,
                      CURLOPT_TIMEOUT => 0,
                      CURLOPT_FOLLOWLOCATION => true,
                      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                      CURLOPT_CUSTOMREQUEST => 'GET',
                      CURLOPT_HTTPHEADER => array(
                        'ApiKey: your-apiKey'
                      ),
                    ));
                    $response = curl_exec($curl);
                    curl_close($curl);
                    echo $response;
                  
                
                  
                    OkHttpClient client = new OkHttpClient().newBuilder()
                      .build();
                    MediaType mediaType = MediaType.parse("text/plain");
                    RequestBody body = RequestBody.create(mediaType, "");
                    Request request = new Request.Builder()
                      .url("https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmses?LineNumber=090000&IsRead=true")
                      .method("GET", body)
                      .addHeader("ApiKey", "your-apiKey")
                      .build();
                    Response response = client.newCall(request).execute();
                  
                
                  
                    var request = require('request');
                    var options = {
                      'method': 'GET',
                      'url': 'https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmses?LineNumber=090000&IsRead=true',
                      'headers': {
                        'ApiKey: "your-apiKey'
                      }
                    };
                    request(options, function (error, response) {
                      if (error) throw new Error(error);
                      console.log(response.body);
                    });
                  
                
                  
                    import requests
                    url = "https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmses?LineNumber=090000&IsRead=true"
                    payload = {}
                    headers = {
                      'ApiKey: "your-apiKey'
                    }
                    response = requests.request("GET", url, headers=headers, data=payload)
                    print(response.text)
                  
                
                  
                    package main
                    import (
                      "fmt"
                      "net/http"
                      "io/ioutil"
                    )
                    func main() {
                      url := "https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmses?LineNumber=090000&IsRead=true"
                      method := "GET"
                      client := &http.Client {}
                      req, err := http.NewRequest(method, url, nil)
                      if err != nil {
                        fmt.Println(err)
                        return
                      }
                      req.Header.Add("ApiKey", "your-apiKey")
                      res, err := client.Do(req)
                      if err != nil {
                        fmt.Println(err)
                        return
                      }
                      defer res.Body.Close()
                      body, err := ioutil.ReadAll(res.Body)
                      if err != nil {
                        fmt.Println("Error reading response:", err)
                        return
                      }
                      fmt.Println(string(body));
                    }
                  
                
                  
                    curl -X 'GET' \
                      'https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmses?LineNumber=090000&IsRead=true' \
                      -H 'accept: */*' \
                      -H 'ApiKey: your-apiKey'
                  
                

پیام های دریافتی به صورت صفحه بندی

از این متد برای گرفتن لیست پیام های دریافتی به صورت صفحه بندی استفاده می‌شود، به ازای هر بار فراخوانی این متد 200 پیام بازگردانده می‌شود.

پارامترهای ورودی

پارامترنوعتوضیحروش ارسال پارامتر
ApiKeystring اجباریکلید شناسهHeader
LineNumberstring اجباریشماره خطQuery parameter
IsReadbooleanاگر (0) وارد شود پیام های خوانده نشده و اگر (1) وارد شود پیام های خوانده شده بر می‌گردد.Query parameter
StartDatestring, date-timeتاریخ و زمان دقیق شروع ارسال پیامQuery parameter
EndDatestring, date-timeتاریخ و زمان دقیق پایان ارسال پیامQuery parameter
PageIndexintegerصفحه مورد نظر را وارد کنید، صفحه اول 1 می‌باشد.Query parameter
PageSizeintegerتعداد پیام بازگشتی در هر صفحه، حداکثر تعداد 200 می‌باشد.Query parameter

پارامترهای خروجی

پارامترتوضیح
IsSuccessوضعیت پاسخ وب سرویس
StatusCodeکد وضعیت
PageIndexشماره صفحه
PageSizeتعداد آیتم‌های موجود در جدول
TotalCountتعداد کل آیتم‌ها
TotalPagesتعداد کل صفحات
HasPreviousPageوجود صفحه قبلی
HasNextPageوجود صفحه بعدی
Idشناسه پیام
Messageمتن پیام
Senderفرستنده
LineNumberشماره خط ارسال پیام
ReceiveDateزمان و تاریخ دریافت پیام

جدول خطاها

چنانچه درخواست‌های ارسالی شما با خطای خاصی مواجه شد؛ برای آگاهی از دلایل آن می‌توانید از جدول خطاها کمک بگیرید.

نمونه درخواست

    
      https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmsesPaging?LineNumber=090000&IsRead=true&StartDate=2024-01-01&EndDate=2024-02-02&PageIndex=10&PageSize=1
    
  

نمونه پاسخ

    
      {
        "isSuccess": true,
        "statusCode": 0,
        "message": "string",
        "data": {
          "pageIndex": 1,
          "pageSize": 10,
          "totalCount": 0,
          "totalPages": 0,
          "hasPreviousPage": false,
          "hasNextPage": false,
          "items": [
            {
              "id": 0,
              "message": "string",
              "sender": "string",
              "lineNumber": "string",
              "receiveDate": "2024-07-02T14:00:34.975Z"
            }
          ]
        }
      }
    
  

نمونه کد

                  
                    var client = new HttpClient();
                    client.DefaultRequestHeaders.Add("ApiKey", "your-apiKey");
                    var request = new HttpRequestMessage(HttpMethod.Get, "https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmsesPaging?LineNumber=090000&IsRead=true&StartDate=2024-01-01&EndDate=2024-02-02&PageIndex=10&PageSize=1");
                    var response = await client.SendAsync(request);
                    response.EnsureSuccessStatusCode();
                    Console.WriteLine(await response.Content.ReadAsStringAsync());
                  
                
                  
                     'https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmsesPaging?LineNumber=090000&IsRead=true&StartDate=2024-01-01&EndDate=2024-02-02&PageIndex=10&PageSize=1',
                      CURLOPT_RETURNTRANSFER => true,
                      CURLOPT_ENCODING => '',
                      CURLOPT_MAXREDIRS => 10,
                      CURLOPT_TIMEOUT => 0,
                      CURLOPT_FOLLOWLOCATION => true,
                      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                      CURLOPT_CUSTOMREQUEST => 'GET',
                      CURLOPT_HTTPHEADER => array(
                        'ApiKey: your-apiKey'
                      ),
                    ));
                    $response = curl_exec($curl);
                    curl_close($curl);
                    echo $response;
                  
                
                  
                    OkHttpClient client = new OkHttpClient().newBuilder()
                      .build();
                    MediaType mediaType = MediaType.parse("text/plain");
                    RequestBody body = RequestBody.create(mediaType, "");
                    Request request = new Request.Builder()
                      .url("https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmsesPaging?LineNumber=090000&IsRead=true&StartDate=2024-01-01&EndDate=2024-02-02&PageIndex=10&PageSize=1")
                      .method("GET", body)
                      .addHeader("ApiKey", "your-apiKey")
                      .build();
                    Response response = client.newCall(request).execute();
                  
                
                  
                    var request = require('request');
                    var options = {
                      'method': 'GET',
                      'url': 'https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmsesPaging?LineNumber=090000&IsRead=true&StartDate=2024-01-01&EndDate=2024-02-02&PageIndex=10&PageSize=1',
                      'headers': {
                        'ApiKey: "your-apiKey'
                      }
                    };
                    request(options, function (error, response) {
                      if (error) throw new Error(error);
                      console.log(response.body);
                    });
                  
                
                  
                    import requests
                    url = "https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmsesPaging?LineNumber=090000&IsRead=true&StartDate=2024-01-01&EndDate=2024-02-02&PageIndex=10&PageSize=1"
                    payload = {}
                    headers = {
                      'ApiKey: "your-apiKey'
                    }
                    response = requests.request("GET", url, headers=headers, data=payload)
                    print(response.text)
                  
                
                  
                    package main
                    import (
                      "fmt"
                      "net/http"
                      "io/ioutil"
                    )
                    func main() {
                      url := "https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmsesPaging?LineNumber=090000&IsRead=true&StartDate=2024-01-01&EndDate=2024-02-02&PageIndex=10&PageSize=1"
                      method := "GET"
                      client := &http.Client {}
                      req, err := http.NewRequest(method, url, nil)
                      if err != nil {
                        fmt.Println(err)
                        return
                      }
                      req.Header.Add("ApiKey", "your-apiKey")
                      res, err := client.Do(req)
                      if err != nil {
                        fmt.Println(err)
                        return
                      }
                      defer res.Body.Close()
                      body, err := ioutil.ReadAll(res.Body)
                      if err != nil {
                        fmt.Println("Error reading response:", err)
                        return
                      }
                      fmt.Println(string(body));
                    }
                  
                
                  
                    curl -X 'GET' \
                      'https://gateway.ghasedak.me/rest/api/v1/WebService/GetReceivedSmsesPaging?LineNumber=090000&IsRead=true&StartDate=2024-01-01&EndDate=2024-02-02&PageIndex=10&PageSize=1' \
                      -H 'accept: */*' \
                      -H 'ApiKey: your-apiKey'
                  
                

جدول موارد خطا

کد خطاتوضیحات
200با موفقیت انجام شد
400پارامتر های ورودی صحیح نمی باشد
400گیرنده وارد نشده است
400عدم وجود لغو11 در انتهای پیام
401کد شناسائی معتبر نمی باشد
401حساب کاربری فعال نمی باشد
402عملیات ناموفق بود
406اطلاعات مالکیت خط تائید نشده است
412امکان دسترسی به خط مورد نظر وجود ندارد
412خط مورد نظر غیرفعال است
412امکان ارسال با خط عمومی وجود ندارد
412اپراتور پیامکی معتبر نمی باشد
412پروایدر معتبر نمی باشد
412امکان دسترسی به سرویس مورد نظر وجود ندارد
412درحال حاضر با این خط تنها امکان ارسال به شماره خود را دارید
412خط منقضی شده است
412شناسه پیام وارد نشده است
412با استفاده از پلن رایگان و خط خدماتی، تنها امکان ارسال پیام به شماره خود را دارید. برای ارسال، نیاز است پلن خود را ارتقاء دهید.
416شناسه IP سرویس مبدا با تنظیمات مطابقت ندارد
418اعتبار شما کافی نمی‌باشد
419تعرفه ارسال معتبر نمی باشد
420استفاده از لینک غیر مجاز در متن پیامک
422پیام به دلیل وجود کاراکتر نامناسب قابل ارسال نیست
426استفاده از این متد نیازمند ارتقاء پلن می‌باشد
428قالب پیام نامعتبر میباشد
429پارامتر یافت نشد
451درخواست تکراری می باشد
413طول پیام بیشتر از 1000 کاراکتر می باشد
413تعداد گیرنده های وارد شده بیش از حد مجاز است
500خطایی رخ داده است