### 1-to-N SMS Sending Example Source: https://docs.vatansms.net/index This endpoint allows sending a single message to multiple phone numbers. The example provided uses PHP with cURL. ```APIDOC ## POST /api/v1/1toN ### Description Sends a single SMS message to multiple recipients. ### Method POST ### Endpoint `https://api.vatansms.net/api/v1/1toN` ### Parameters #### Request Body - **api_id** (string) - Required - Your API ID. - **api_key** (string) - Required - Your API Key. - **sender** (string) - Required - The sender ID (SMS header). - **message_type** (string) - Required - Type of message (e.g., 'normal'). - **message** (string) - Required - The content of the SMS message. - **message_content_type** (string) - Required - Type of message content (e.g., 'bilgi'). - **phones** (array of strings) - Required - An array of phone numbers to send the message to. ### Request Example ```json { "api_id": "API_ID", "api_key": "API_KEY", "sender": "SMSBASLIGINIZ", "message_type": "normal", "message": "Bu bir test mesajıdır.", "message_content_type": "bilgi", "phones": [ "5xxxxxxxxx", "5xxxxxxxxx" ] } ``` ### Response #### Success Response (200) - **response** (string) - The API response, indicating the status of the SMS sending operation. ``` -------------------------------- ### Get User Information with PHP Source: https://docs.vatansms.net/rest-sms-api/user-info This PHP code snippet demonstrates how to make a POST request to the VatanSMS API to retrieve user information. It utilizes cURL to send the 'api_id' and 'api_key' as JSON payload and expects a JSON response. Ensure you have cURL enabled in your PHP installation. ```php "API_ID", "api_key" => "API_KEY" ]; $curl_options = [ CURLOPT_URL => 'https://api.vatansms.net/api/v1/user/information', CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_POSTFIELDS => json_encode($params), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json' ] ]; curl_setopt_array($curl, $curl_options); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` -------------------------------- ### List Blacklisted Numbers (SOAP) Source: https://docs.vatansms.net/soap-sms-api/dark-list This section details the SOAP API method used to retrieve a list of blacklisted phone numbers. It outlines the method name, required parameters, and provides a PHP code example. ```APIDOC ## getBlackList SOAP API ### Description This SOAP API method is used to retrieve a list of blacklisted phone numbers. ### Method SOAP ### Endpoint `https://api.vatansms.net/soap.wsdl` ### Parameters #### SOAP Method - **getBlackList** #### Input Parameters - **api_id** (string) - Required - API ID - **api_key** (string) - Required - API Key ### Request Example (PHP) ```php try { $client = new \SoapClient("https://api.vatansms.net/soap.wsdl", [ 'cache_wsdl' => WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("getBlackList", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY" ]]); print_r($response); } catch (Exception $e) { echo "Error in getBlackList: " . $e->getMessage(); } ``` ### Response #### Success Response (SOAP) - The response will be a SOAP XML object containing the list of blacklisted numbers or an indication of success/failure. #### Response Example (Conceptual XML) ```xml +905XXXXXXXXX +905YYYYYYYYY ``` ``` -------------------------------- ### Rapor Sorgulama - Tarih Bazlı (SOAP) Source: https://docs.vatansms.net/soap-sms-api/report-date This SOAP API method allows you to query SMS sending reports for a specific date range. It requires your API credentials and the start and end dates for the report. ```APIDOC ## ReportBetween SOAP Method ### Description Queries SMS sending reports for a specific date range using the SOAP API. ### Method SOAP ### Endpoint https://api.vatansms.net/soap.wsdl ### Parameters #### Request Parameters (SOAP Body) - **api_id** (string) - Required - Your API ID. - **api_key** (string) - Required - Your API Key. - **start_date** (string) - Required - The start date and time for the report (Format: Y-m-d H:i:s). - **end_date** (string) - Required - The end date and time for the report (Format: Y-m-d H:i:s). ### Request Example ```php WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("ReportBetween", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY", "start_date" => "2025-01-01T00:00:00", "end_date" => "2025-01-31T23:59:59" ]]); print_r($response); } catch (Exception $e) { echo "Error in ReportBetween: " . $e->getMessage(); } ?> ``` ### Response #### Success Response (SOAP) Details of the SMS sending report within the specified date range. The exact structure depends on the WSDL definition. #### Response Example (Example structure, actual response may vary) ```json { "ReportBetweenResult": { "message": "Success", "data": [ { "recipient": "1234567890", "status": "Delivered", "send_time": "2025-01-15 10:00:00" } ] } } ``` ``` -------------------------------- ### Delete Blacklisted Number (SOAP) Source: https://docs.vatansms.net/soap-sms-api/delete-blacklist This section details the SOAP API method for deleting a number from the blacklist. It includes required parameters and a PHP code example. ```APIDOC ## DELETE /soap.wsdl (deleteBlackList) ### Description This SOAP method is used to delete a number from the blacklist via the VatanSMS API. ### Method SOAP ### Endpoint `https://api.vatansms.net/soap.wsdl` ### Parameters #### Request Body (SOAP) - **api_id** (string) - Required - Your API ID. - **api_key** (string) - Required - Your API Key. - **phone** (string) - Required - The phone number to delete from the blacklist. Must be sent in the format 5450000000. ### Request Example ```php WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("deleteBlackList", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY", "phone" => 5450000000 ]]); print_r($response); } catch (Exception $e) { echo "Error in deleteBlackList: " . $e->getMessage(); } ``` ### Response #### Success Response The response will indicate the success or failure of the deletion operation. The exact structure depends on the SOAP service's WSDL definition. #### Response Example (Response structure depends on WSDL definition, typically a SOAP `Body` containing a result element.) ``` -------------------------------- ### Retrieve User Information using SOAP API in PHP Source: https://docs.vatansms.net/soap-sms-api/user-info This snippet demonstrates how to query user account information using the SOAP UserInformation method. It requires your API ID and API Key. Error handling is included. ```php WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("UserInformation", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY" ]]); print_r($response); } catch (Exception $e) { echo "Error in UserInformation: " . $e->getMessage(); } ?> ``` -------------------------------- ### SOAP ile 1-N SMS Gönderimi (PHP) Source: https://docs.vatansms.net/soap-sms-api/1n-sms SOAP API kullanarak tek bir mesajı birden fazla numaraya göndermek için kullanılır. Bu örnek, `OnetoNSms` metodunu çağırarak SMS gönderimini gerçekleştirir. API kimlik bilgileri ve mesaj detayları parametre olarak verilir. Hata yönetimi için try-catch bloğu kullanılmıştır. ```php WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("OnetoNSms", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY", "sender" => "VATANSMS", "message_type" => "turkce", "message" => "Test mesajı", "phones" => "905450000000,905450000001", "send_time" => null ]]); print_r($response); } catch (Exception $e) { echo "Error in OnetoNSms: " . $e->getMessage(); } ?> ``` -------------------------------- ### SOAP ReportDetail Sorgulama - PHP Source: https://docs.vatansms.net/soap-sms-api/report-detail SOAP API kullanarak SMS gönderim raporlarının detaylarını sorgulamak için PHP örneği. Bu kod, SoapClient'ı kullanarak ReportDetail metodunu çağırır ve yanıtı yazdırır. Hata yönetimi için try-catch bloğu içerir. ```php WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("ReportDetail", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY", "report_id" => 123456, "page" => 1, "pageSize" => 20 ]]); print_r($response); } catch (Exception $e) { echo "Error in ReportDetail: " . $e->getMessage(); } ?> ``` -------------------------------- ### N-N SMS Gönderimi (PHP SOAP) - VatanSMS API Source: https://docs.vatansms.net/soap-sms-api/nn-sms PHP'nin SoapClient sınıfını kullanarak NtoNSms metodunu çağırmak için kullanılır. API kimlik bilgileri, gönderici, mesaj tipi ve alıcı bilgileri parametre olarak verilir. Hata yönetimi için try-catch bloğu kullanılmıştır. ```php WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("NtoNSms", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY", "sender" => "VATANSMS", "message_type" => "turkce", "phones" => [{"phone":"905450000000","message":"Test mesajı 1"},{"phone":"905450000001","message":"Test mesajı 2"}], "send_time" => null ]]); print_r($response); } catch (Exception $e) { echo "Error in NtoNSms: " . $e->getMessage(); } ``` ``` -------------------------------- ### Kara Listeyi Listeleme (SOAP) - PHP Source: https://docs.vatansms.net/soap-sms-api/dark-list SOAP API'nin 'getBlackList' metodunu kullanarak kara listedeki numaraları listeleyen PHP örneği. API kimliği ve anahtarını kullanarak SOAP istemcisi oluşturur ve çağrıyı gerçekleştirir. Hataları yakalamak için try-catch bloğu içerir. ```PHP WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("getBlackList", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY" ]]); print_r($response); } catch (Exception $e) { echo "Error in getBlackList: " . $e->getMessage(); } ?> ``` -------------------------------- ### Send OTP SMS using SOAP API (PHP) Source: https://docs.vatansms.net/soap-sms-api/otp-sms Bu kod parçacığı, VatanSMS'in SOAP API'sini kullanarak OTP SMS gönderme işlemini gösterir. Bir SoapClient örneği oluşturulur, OtpSms metodu çağrılır ve gönderici kimliği, API anahtarı, mesaj içeriği gibi gerekli parametreler iletilir. Hata yönetimi de içerir. ```php WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("OtpSms", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY", "sender" => "VATANSMS", "message_type" => "turkce", "message" => "Test mesajı", "phones" => "905450000000,905450000001", "send_time" => null ]]); print_r($response); } catch (Exception $e) { echo "Error in OtpSms: " . $e->getMessage(); } ``` ``` -------------------------------- ### Kara Listeye Numara Ekleme (SOAP) - PHP Source: https://docs.vatansms.net/soap-sms-api/add-blacklist-list SOAP API kullanarak kara listeye numara ekleme işlemini PHP ile gerçekleştirir. Bu örnek, `SoapClient` kullanarak `addBlackList` metodunu çağırır ve API kimlik bilgileri ile telefon numarasını parametre olarak iletir. Hata yönetimi de içerir. ```PHP WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("addBlackList", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY", "phone" => 5450000000 ]]); print_r($response); } catch (Exception $e) { echo "Error in addBlackList: " . $e->getMessage(); } ?> ``` -------------------------------- ### 1-N SMS Gönderim (SOAP) Source: https://docs.vatansms.net/soap-sms-api/1n-sms SOAP API kullanarak tek bir mesajı birden fazla numaraya gönderme işlemi için kullanılır. ```APIDOC ## 1-N SMS Gönderim (SOAP) ### Description SOAP API kullanarak tek bir mesajı birden fazla numaraya gönderme işlemi için kullanılır. ### Method SOAP ### Endpoint `https://api.vatansms.net/soap.wsdl` ### Parameters #### Request Body (SOAP) - **api_id** (string) - Required - API ID - **api_key** (string) - Required - API Key - **sender** (string) - Required - Gönderici başlığı - **message_type** (string) - Required - Mesaj tipi (normal veya turkce) - **message** (string) - Required - Gönderilecek mesaj - **phones** (string) - Required - Alıcı telefon numaraları (virgülle ayrılmış) - **send_time** (string) - Optional - İleri tarihli gönderim zamanı ### Request Example ```php WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("OnetoNSms", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY", "sender" => "VATANSMS", "message_type" => "turkce", "message" => "Test mesajı", "phones" => "905450000000,905450000001", "send_time" => null ]]); print_r($response); } catch (Exception $e) { echo "Error in OnetoNSms: " . $e->getMessage(); } ``` ### Response #### Success Response (SOAP Response) - The response structure will depend on the SOAP service's WSDL definition. #### Response Example ```json { "example": "SOAP response content" } ``` ``` -------------------------------- ### Query Sender Names using VatanSMS SOAP API (PHP) Source: https://docs.vatansms.net/soap-sms-api/sender-name This snippet demonstrates how to query registered sender names using the VatanSMS SOAP API. It requires your API ID and API Key. The code initializes a SOAP client, calls the 'Senders' method, and prints the response or any encountered exceptions. ```php WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("Senders", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY" ]]); print_r($response); } catch (Exception $e) { echo "Error in Senders: " . $e->getMessage(); } ?> ``` -------------------------------- ### User Information Retrieval (SOAP) Source: https://docs.vatansms.net/soap-sms-api/user-info Retrieve account information using the SOAP API. This endpoint allows you to query your account details. ```APIDOC ## User Information Retrieval (SOAP) ### Description SOAP API kullanarak hesap bilgilerinizi sorgulama işlemi için kullanılır. ### Method SOAP ### Endpoint https://api.vatansms.net/soap.wsdl ### Parameters #### SOAP Method - **UserInformation** #### Parameters - **api_id** (string) - Required - API ID - **api_key** (string) - Required - API Key ### Request Example ```php try { $client = new \SoapClient("https://api.vatansms.net/soap.wsdl", [ 'cache_wsdl' => WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("UserInformation", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY" ]]); print_r($response); } catch (Exception $e) { echo "Error in UserInformation: " . $e->getMessage(); } ``` ### Response #### Success Response (SOAP Response) - The structure of the success response depends on the SOAP service definition. #### Response Example ```json { "user_info": { ... } } ``` ``` -------------------------------- ### POST /api/v1/user/information Source: https://docs.vatansms.net/rest-sms-api/user-info Retrieves user account information. This endpoint is used to query your account details. ```APIDOC ## POST /api/v1/user/information ### Description Retrieves user account information. This endpoint is used to query your account details. ### Method POST ### Endpoint https://api.vatansms.net/api/v1/user/information ### Parameters #### Request Body - **api_id** (string) - Required - Your API ID. - **api_key** (string) - Required - Your API Key. ### Request Example ```json { "api_id": "YOUR_API_ID", "api_key": "YOUR_API_KEY" } ``` ### Response #### Success Response (200) - **Example Response Structure** (object) - Contains user information. - **user_balance** (string) - Current balance. - **user_name** (string) - User's name. - **user_credit** (string) - User's credit information. #### Response Example ```json { "user_balance": "100.50", "user_name": "John Doe", "user_credit": "Premium" } ``` ``` -------------------------------- ### SOAP API ile SMS Raporu Sorgulama - PHP Source: https://docs.vatansms.net/soap-sms-api/report-result Bu kod, VatanSMS SOAP API'nin ReportSingle metodunu kullanarak belirli bir rapor ID'sine ait SMS gönderim sonucunu sorgular. SOAP istemcisi oluşturulur ve gerekli parametreler (api_id, api_key, report_id) ile çağrı yapılır. Hata yönetimi de bulunmaktadır. ```php WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("ReportSingle", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY", "report_id" => 123456 ]]); print_r($response); } catch (Exception $e) { echo "Error in ReportSingle: " . $e->getMessage(); } ?> ``` -------------------------------- ### Kara Listeden Numara Silme (PHP) Source: https://docs.vatansms.net/soap-sms-api/delete-blacklist SOAP API kullanarak kara listeden bir telefon numarasını silmek için PHP kullanılır. Bu işlem için API kimliği, API anahtarı ve telefon numarası gereklidir. Hata yönetimi için try-catch bloğu kullanılmıştır. ```php WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("deleteBlackList", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY", "phone" => 5450000000 ]]); print_r($response); } catch (Exception $e) { echo "Error in deleteBlackList: " . $e->getMessage(); } ?> ``` -------------------------------- ### Kara Listeye Numara Ekleme (PHP) Source: https://docs.vatansms.net/rest-sms-api/add-blacklist-list Kara listeye numara eklemek için PHP ile cURL isteği gönderen örnek kod. API kimlik bilgileri ve eklenecek telefon numarası parametre olarak alınır. ```php "API_ID", "api_key" => "API_KEY", "phone" => "5450000000" ]; $curl_options = [ CURLOPT_URL => 'https://api.vatansms.net/api/v1/add/blacklist', CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_POSTFIELDS => json_encode($params), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json' ] ]; curl_setopt_array($curl, $curl_options); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` -------------------------------- ### Tarih Bazlı Rapor Sorgulama (SOAP - PHP) Source: https://docs.vatansms.net/soap-sms-api/report-date SOAP API kullanarak belirli bir tarih aralığındaki SMS gönderim raporlarını sorgulamak için PHP örneği. `SoapClient` kullanılır ve `ReportBetween` metodu çağrılır. Hata yönetimi `try-catch` bloğu ile sağlanır. ```php WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("ReportBetween", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY", "start_date" => "2025-01-01T00:00:00", "end_date" => "2025-01-31T23:59:59" ]]); print_r($response); } catch (Exception $e) { echo "Error in ReportBetween: " . $e->getMessage(); } ?> ``` -------------------------------- ### Report Querying (SOAP) Source: https://docs.vatansms.net/soap-sms-api/report-result This section details how to query SMS sending results using the SOAP API. It specifically covers the 'ReportSingle' method. ```APIDOC ## Report Querying - Result Query (SOAP) This SOAP API is used to query the results of SMS sending. ### SOAP Method ReportSingle ### Parameters | Parameter | Type | Required | Description | |-------------|--------|----------|---------------| | api_id | string | Yes | API ID | | api_key | string | Yes | API Key | | report_id | number | Yes | Report ID | ### Request Example (PHP) ```php try { $client = new \SoapClient("https://api.vatansms.net/soap.wsdl", [ 'cache_wsdl' => WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("ReportSingle", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY", "report_id" => 123456 ]]); print_r($response); } catch (Exception $e) { echo "Error in ReportSingle: " . $e->getMessage(); } ``` ``` -------------------------------- ### Kara Listelenen Numaraları Listeleme (PHP) Source: https://docs.vatansms.net/rest-sms-api/dark-list VatanSMS API'sini kullanarak kara listedeki numaraları listelemek için PHP'de cURL isteği gönderir. API kimliği ve anahtarını girdi olarak alır ve JSON yanıtını döndürür. ```php "API_ID", "api_key" => "API_KEY" ]; $curl_options = [ CURLOPT_URL => 'https://api.vatansms.net/api/v1/blacklists', CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_POSTFIELDS => json_encode($params), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json' ] ]; curl_setopt_array($curl, $curl_options); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` -------------------------------- ### 1-N SMS Gönderimi (PHP) Source: https://docs.vatansms.net/rest-sms-api/1n-sms Tek bir mesajı birden fazla numaraya göndermek için VatanSMS API'sini kullanan PHP örneği. API kimliği, anahtarı, gönderici bilgileri, mesaj içeriği ve alıcı telefon numaraları gibi parametreler gereklidir. ```php "API_ID", "api_key" => "API_KEY", "sender" => "SMSBASLIGINIZ", "message_type" => "normal", "message" => "Bu bir test mesajıdır.", "message_content_type" => "bilgi", "phones" => ["5xxxxxxxxx","5xxxxxxxxx"] ]; $curl_options = [ CURLOPT_URL => 'https://api.vatansms.net/api/v1/1toN', CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_POSTFIELDS => json_encode($params), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json' ] ]; curl_setopt_array($curl, $curl_options); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` -------------------------------- ### N-N SMS Gönderim (SOAP) Source: https://docs.vatansms.net/soap-sms-api/nn-sms SOAP API kullanarak farklı mesajları farklı numaralara gönderme işlemi için kullanılır. Bu metod, birden çok alıcıya özel mesajlar göndermenize olanak tanır. ```APIDOC ## N-N SMS Gönderim (SOAP) ### Description SOAP API kullanarak farklı mesajları farklı numaralara gönderme işlemi için kullanılır. ### Method SOAP ### Endpoint https://api.vatansms.net/soap.wsdl ### Parameters #### SOAP Method NtoNSms #### Parameters - **api_id** (string) - Required - API ID - **api_key** (string) - Required - API Key - **sender** (string) - Required - Gönderici başlığı - **message_type** (string) - Required - Mesaj tipi (normal veya turkce) - **phones** (array) - Required - Alıcı telefon numaraları ve mesajları. Her eleman {"phone":"telefon_numarası", "message":"mesaj_içeriği"} formatında olmalıdır. - **send_time** (string) - Optional - İleri tarihli gönderim zamanı (YYYY-MM-DD HH:MM:SS formatında) ### Request Example ```php WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("NtoNSms", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY", "sender" => "VATANSMS", "message_type" => "turkce", "phones" => [{"phone":"905450000000","message":"Test mesajı 1"},{"phone":"905450000001","message":"Test mesajı 2"}], "send_time" => null ]]); print_r($response); } catch (Exception $e) { echo "Error in NtoNSms: " . $e->getMessage(); } ?> ``` ### Response #### Success Response (SOAP Response) SOAP API'nin döndürdüğü sonuç detayları. #### Response Example ```json // SOAP yanıtının yapısına göre değişir { "result": "success", "message_id": "123456789" } ``` ``` -------------------------------- ### Sender Name Querying (SOAP) Source: https://docs.vatansms.net/soap-sms-api/sender-name Use the SOAP API to query the sender names defined in your account. ```APIDOC ## Sender Name Querying (SOAP) ### Description SOAP API kullanarak hesabınıza tanımlı gönderici adlarını sorgulama işlemi için kullanılır. ### Method SOAP ### Endpoint https://api.vatansms.net/soap.wsdl ### Parameters #### SOAP Parameters - **api_id** (string) - Required - API ID - **api_key** (string) - Required - API Key ### Request Example ```php WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("Senders", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY" ]]); print_r($response); } catch (Exception $e) { echo "Error in Senders: " . $e->getMessage(); } ``` ### Response #### Success Response (SOAP) - The response will contain an array of sender names. #### Response Example ```json { "SendersResult": { "diffgr:checkpoint", "NewDataSet": { "Table": [ { "Name": "SenderName1" }, { "Name": "SenderName2" } ] } } } ``` ``` -------------------------------- ### POST /api/v1/report/single Source: https://docs.vatansms.net/rest-sms-api/report-result This endpoint is used to query the results of SMS dispatches. It requires an API ID, API Key, and the Report ID. ```APIDOC ## POST /api/v1/report/single ### Description SMS gönderim sonuçlarını sorgulama işlemi için kullanılır. ### Method POST ### Endpoint https://api.vatansms.net/api/v1/report/single ### Parameters #### Query Parameters - **api_id** (string) - Required - API ID - **api_key** (string) - Required - API Key - **report_id** (number) - Required - Rapor ID ### Request Example ```json { "api_id": "API_ID", "api_key": "API_KEY", "report_id": 926382 } ``` ### Response #### Success Response (200) - **status** (string) - The status of the report query. - **message** (string) - A message describing the result of the query. - **data** (object) - Contains the detailed results of the SMS dispatch. - **id** (number) - The ID of the report. - **message_id** (string) - The ID of the message. - **sender** (string) - The sender of the message. - **recipient** (string) - The recipient of the message. - **status** (string) - The delivery status of the message. - **delivered_at** (string) - The timestamp when the message was delivered. - **created_at** (string) - The timestamp when the message was created. #### Response Example ```json { "status": "success", "message": "Report retrieved successfully.", "data": { "id": 926382, "message_id": "MSG123456789", "sender": "VatanSMS", "recipient": "905XXXXXXXXX", "status": "DELIVERED", "delivered_at": "2023-10-27 10:00:00", "created_at": "2023-10-27 09:59:00" } } ``` ``` -------------------------------- ### OTP SMS Gönderimi - PHP Source: https://docs.vatansms.net/rest-sms-api/otp-sms PHP kullanarak VatanSMS REST API ile OTP SMS gönderme örneği. cURL kütüphanesi kullanılır. API kimliği, anahtar, gönderici, mesaj tipi, mesaj içeriği ve alıcı telefon numaraları gereklidir. Çıktı olarak API'den gelen yanıt döndürülür. ```php "API_ID", "api_key" => "API_KEY", "sender" => "SMSBASLIGINIZ", "message_type" => "normal", "message" => "OTP kodunuz: {code}", "phones" => ["5xxxxxxxxx"] ]; $curl_options = [ CURLOPT_URL => 'https://api.vatansms.net/api/v1/otp', CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_POSTFIELDS => json_encode($params), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json' ] ]; curl_setopt_array($curl, $curl_options); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` -------------------------------- ### Report Detail (SOAP) - ReportDetail Source: https://docs.vatansms.net/soap-sms-api/report-detail SOAP API call to retrieve detailed information about SMS sending reports using the ReportDetail method. ```APIDOC ## POST /soap ### Description Retrieves detailed information about SMS sending reports via SOAP API. ### Method POST ### Endpoint https://api.vatansms.net/soap.wsdl ### Parameters #### Request Body (SOAP) - **api_id** (string) - Required - API ID - **api_key** (string) - Required - API Key - **report_id** (number) - Required - Report ID - **page** (number) - Optional - Page number - **pageSize** (number) - Optional - Number of records per page ### Request Example ```php WSDL_CACHE_NONE, 'trace' => 1 ]); $response = $client->__soapCall("ReportDetail", [[ "api_id" => "YOUR_API_ID", "api_key" => "YOUR_API_KEY", "report_id" => 123456, "page" => 1, "pageSize" => 20 ]]); print_r($response); } catch (Exception $e) { echo "Error in ReportDetail: " . $e->getMessage(); } ``` ### Response #### Success Response (200) - **Response Structure**: The structure of the success response will depend on the data returned by the ReportDetail SOAP method. It typically includes details about the specified report. #### Response Example ```json { "ReportDetailResult": { "Success": true, "Message": "Report details retrieved successfully.", "Data": [ { "recipient": "1234567890", "status": "Delivered", "timestamp": "2023-10-27 10:00:00" } // ... more records ] } } ``` ``` -------------------------------- ### Kara Listeden Numara Silme (PHP) Source: https://docs.vatansms.net/rest-sms-api/delete-blacklist Kara listedeki bir telefon numarasını silmek için VatanSMS API'sine POST isteği gönderir. API kimlik bilgileri ve silinecek telefon numarası gereklidir. Bu fonksiyon, API'den gelen yanıtı döndürür. ```php "API_ID", "api_key" => "API_KEY", "phone" => "5450000000" ]; $curl_options = [ CURLOPT_URL => 'https://api.vatansms.net/api/v1/delete/blacklist', CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_POSTFIELDS => json_encode($params), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json' ] ]; curl_setopt_array($curl, $curl_options); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` -------------------------------- ### SMS Gönderim Sonucu Sorgulama (PHP) Source: https://docs.vatansms.net/rest-sms-api/report-result SMS gönderim raporlarının sonuçlarını sorgulamak için PHP'de cURL kullanarak API isteği gönderme örneği. Bu kod, belirtilen rapor ID'si için sorgulama yapar ve sonucu JSON formatında döndürür. API kimlik bilgileri ve rapor ID'si gereklidir. ```php "API_ID", "api_key" => "API_KEY", "report_id" => 926382 ]; $curl_options = [ CURLOPT_URL => 'https://api.vatansms.net/api/v1/report/single', CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_POSTFIELDS => json_encode($params), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json' ] ]; curl_setopt_array($curl, $curl_options); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` -------------------------------- ### POST /api/v1/report/detail Source: https://docs.vatansms.net/rest-sms-api/report-detail Allows querying the details of SMS sending reports using the report ID. ```APIDOC ## POST /api/v1/report/detail ### Description SMS gönderim raporlarının detaylarını sorgulama işlemi için kullanılır. ### Method POST ### Endpoint https://api.vatansms.net/api/v1/report/detail ### Parameters #### Request Body - **api_id** (string) - Required - API ID - **api_key** (string) - Required - API Key - **report_id** (number) - Required - Rapor ID ### Request Example ```json { "api_id": "API_ID", "api_key": "API_KEY", "report_id": 926410 } ``` ### Response #### Success Response (200) - **status** (boolean) - Indicates if the request was successful. - **message** (string) - A message describing the result of the operation. - **data** (object) - Contains the detailed report information if successful. #### Response Example ```json { "status": true, "message": "Rapor detayları başarıyla getirildi.", "data": { "report_id": 926410, "sender_id": "VatanSms", "recipient_count": 100, "sent_count": 98, "failed_count": 2, "report_date": "2023-10-27 10:00:00" } } ``` ```