### Webhook Response Example Source: https://smsplanet.pl/doc/slate/index.html Example of a successful response when retrieving webhook information. ```json {"webhooks":[{ "type": "MESSAGE_NOTIFICATION_WEBHOOK", "url": "https://link.do/webhook"}]} ``` -------------------------------- ### Send SMS API Example Source: https://smsplanet.pl/doc/slate/index.html This example demonstrates how to send an SMS message using the SMSPlanet API. It includes the necessary authorization header and form-urlencoded data. ```APIDOC ## POST /sms ### Description Sends an SMS message to a specified recipient. ### Method POST ### Endpoint https://api2.smsplanet.pl/sms ### Parameters #### Request Body - **from** (string) - Required - Sender ID. - **to** (string) - Required - Recipient phone number. - **msg** (string) - Required - The message content. ### Request Example ``` curl -X POST \ https://api2.smsplanet.pl/sms \ -H 'Authorization: Bearer QwErTyUiOpaSdFgHjKlZxCvBnm12345' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'from=TEST&to=500111222&msg=wiadomość' ``` ### Response #### Success Response (200) - **messageId** (string) - The unique identifier for the sent message. ``` -------------------------------- ### Signature Verification Example Source: https://smsplanet.pl/doc/slate/index.html This example demonstrates the request body and signature key used for calculating the signature. The signature is computed using HMAC SHA256 and then Base64 encoded. Ensure exact JSON formatting and Base64 encoding for verification. ```text Zawartość żądania (body): {"notification":{"deliveryError":"","sentDate":"24-05-2024 11:45:24","parts":"1","messageId":"1234567","from":"AUTO HANDEL","delivered":"true","to":"600700800","deliveryDate":"24-05-2024 11:45:30"}} Klucz podpisu (Signature key): 3e13a3d9d531cdb791b96b01b733f27c Prawidłowy podpis: Upe2XxZCyeQyqADt0RuQ4l8RtWgjaSlKzyB7ogGjs4g= ``` -------------------------------- ### Example Success Response (JSON) Source: https://smsplanet.pl/doc/slate/index.html This is an example of a successful response from the getMessageInfo API when requesting details in JSON format. It includes general sending information and detailed delivery status for each recipient. ```json {"result":"OK", "message": Pole nadawcy: TEST Nazwa wysyłki: Treść wiadomości: wiadomość testowa Data wysyłki: 22-12-2019 17:46:34 Wysłane: 3 Dostarczone: 3 Zwroty: 0 "Numer telefonu";"Dostarczono";"Data dostarczenia";"Powód odrzucenia";"Pobrano opłatę" "000111222";"TAK";"22-12-2019 17:46:40";"";"TAK" "333444555";"TAK";"22-12-2019 17:46:40";"";"TAK" "666777888";"TAK";"22-12-2019 17:46:40";"";"TAK" } ``` -------------------------------- ### Get List of Webhooks (PHP) Source: https://smsplanet.pl/doc/slate/index.html This PHP script demonstrates how to fetch the list of webhooks using the SMSPlanet API. It utilizes a helper function for GET requests and requires API credentials. ```php 'klucz_api', 'password' => 'haslo', ]; $response=send_get($url, $params); function send_get($url,$params) { $params_string = http_build_query($params); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url . '?'.$params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` -------------------------------- ### Example Success Response Source: https://smsplanet.pl/doc/slate/index.html A sample JSON response indicating a successful retrieval of shortened link information. ```json {"links":[{ "date": "27-04-2021 14:24:27", "shortURL": "https://link.do/iyv5w", "clicks": "0", "longURL": "https://smsplanet.pl/api"}]} ``` -------------------------------- ### Example MESSAGE_NOTIFICATION_WEBHOOK Payload Source: https://smsplanet.pl/doc/slate/index.html This is an example of the JSON payload received for a MESSAGE_NOTIFICATION_WEBHOOK event. Ensure your system can parse this structure. ```json { "notification": { "deliveryError": "", "sentDate": "24-05-2024 11:45:24", "parts": "1", "messageId": "1234567", "from": "AUTO HANDEL", "delivered": "true", "to": "600700800", "deliveryDate": "24-05-2024 11:45:30" } } ``` -------------------------------- ### SMS API Response Examples Source: https://smsplanet.pl/doc/slate/index.html These examples show possible responses from the SMS API, indicating either a successful message ID or an error with a descriptive message and code. ```json {"messageId":"191919"} ``` ```json {"errorMsg":"Niepoprawny klucz - sprawdź swój klucz API.","errorCode":101} ``` -------------------------------- ### Get List of Webhooks (cURL) Source: https://smsplanet.pl/doc/slate/index.html Use this cURL command to retrieve a list of all configured webhooks. Requires API key and password. ```bash curl -X GET -G \ 'https://api2.smsplanet.pl/webhooks/list' \ -d key=klucz \ -d password=haslo \ ``` -------------------------------- ### Send SMS via GET Request (PHP) Source: https://smsplanet.pl/doc/slate/index.html This PHP script demonstrates sending an SMS using the GET method. It constructs the URL with parameters and uses cURL to make the request. The `send_get` function handles the HTTP request and returns the API response. Note that this method has limitations for a large number of recipients. ```php 'klucz_api', 'password' => 'haslo', 'from' => 'TEST', 'to' => '600111222', 'msg' => 'Wiadomosc testowa' ]; $response=send_get($url, $params); var_dump($response); function send_get($url,$params) { $params_string = http_build_query($params); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url . '?'.$params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` -------------------------------- ### Example Success Response Source: https://smsplanet.pl/doc/slate/index.html A successful API call to retrieve sender fields will return a JSON object with a 'senderFields' key containing a comma-separated list of available sender fields. ```json {"senderFields":"TEST,Informacja,Sklep,MojaFirma"} ``` -------------------------------- ### Send SMS via GET Request Source: https://smsplanet.pl/doc/slate/index.html This section describes how to send an SMS message using the SMS Planet API via a GET request. It includes the endpoint, required and optional parameters, and examples of request and response bodies. ```APIDOC ## GET /sms ### Description Allows users to send SMS messages using a GET request to the SMS Planet API. This method is suitable for sending messages to a limited number of recipients due to GET request length limitations. ### Method GET ### Endpoint `https://api2.smsplanet.pl/sms` ### Parameters #### Query Parameters - **key** (string) - Optional - API key identifying the user. Required only if an authorization token is not provided. - **password** (string) - Optional - API password. Disabled by default. The first password must be set in the client panel. - **from** (string) - Required - The visible sender name for the SMS recipient. Can use the test name 'TEST' or pre-approved names. For two-way communication, a special phone number is required. - **msg** (string) - Required - The message content. A single SMS can be up to 160 characters, or 70 characters if it contains special characters (including Polish characters). Longer messages will be split into multiple SMS (max. 6). - **to** (multi string array) - Required - Recipient's phone number. Accepted formats include [600111222, 48600111222, +48600111222]. This parameter can be repeated to send the same message to multiple recipients. Due to GET method limitations (approx. 2000 characters), this method is not recommended for over 200 numbers. Invalid numbers will be ignored. Duplicates will be omitted. - **date** (string) - Optional - Specifies when the message should be sent. If omitted or in the past, the message will be sent immediately. Accepted formats: Unixtime (e.g., 1276623871), dd-MM-yyyy HH:mm:ss (e.g., 21-05-2017 10:05:00). Sending is scheduled according to Polish time zone. - **name** (string) - Optional - A name for the shipment, which can help in finding it later in the history. - **clear_polish** (enum: 0, 1) - Optional - If set to 1, all Polish characters in the message content will be replaced with their equivalents (e.g., ą=a, ć=c, ł=l, etc.). Default value: 0. - **test** (enum: 0, 1) - Optional - If set to 1, the message will not be sent, but a standard API response will be returned. Used for testing purposes. Default value: 0. - **company_id** (string) - Optional - An additional field to specify the company sending the request. Used for the reference system. - **transactional** (enum: 0, 1) - Optional - If set to 1, an attempt will be made to send the message via the transactional channel. This channel is for one-time, non-marketing messages (e.g., login PIN codes) and is available only after administrative approval. Default value: 0. ### Request Example ```json { "key": "klucz", "password": "haslo", "from": "TEST", "to": "600111222", "msg": "Wiadomosc" } ``` ### Response #### Success Response (200) - **messageId** (string) - A unique identifier for the shipment assigned by smsplanet. Can be used to cancel a scheduled shipment or retrieve shipment information. **Important! (Queue Buffer)** If `messageId` starts with "B-" (e.g., "B-5-123456789"), it means the message has entered the queue buffer and will be sent with a delay (10 to 30 seconds). The returned ID can only be used to retrieve shipment information. #### Response Example (Success) ```json { "messageId": "191919" } ``` #### Error Response - **errorMsg** (string) - A message indicating the reason for the error. - **errorCode** (integer) - A unique error code. #### Response Example (Error) ```json { "errorMsg": "Niepoprawny klucz - sprawdź swój klucz API.", "errorCode": 101 } ``` ``` -------------------------------- ### Send SMS via POST (Recommended) Source: https://smsplanet.pl/doc/slate/index.html This section details how to send SMS messages using the POST method. It includes examples in cURL and PHP, demonstrating how to send a single SMS and multiple SMS messages. ```APIDOC ## POST /sms ### Description Sends an SMS message using the POST method. This is the recommended method for sending SMS. ### Method POST ### Endpoint https://api2.smsplanet.pl/sms ### Parameters #### Request Body - **key** (string) - Required - Your API key. - **password** (string) - Required - Your API password. - **from** (string) - Required - The sender ID (alphanumeric, up to 11 characters). - **to** (string or array) - Required - The recipient's phone number(s) in international format (e.g., 600111222). For multiple recipients, provide an array or append multiple 'to' parameters. - **msg** (string) - Required - The message content. ### Request Example (cURL) ```bash curl -X POST \ 'https://api2.smsplanet.pl/sms' \ -d key=klucz \ -d password=haslo \ -d from=TEST \ -d to=600111222 \ -d msg=Wiadomosc ``` ### Request Example (PHP - Single Recipient) ```php 'klucz_api', 'password' => 'haslo', 'from' => 'TEST', 'to' => '600111222', 'msg' => 'Wiadomosc testowa' ]; $response=send_post($url, $params); var_dump($response); function send_post($url,$params) { $params_string = http_build_query($params); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` ### Request Example (PHP - Multiple Recipients) ```php 'KLUCZ_API', 'password' => 'HASLO_API', 'from' => 'TEST', 'msg' => 'Wiadomosc testowa' ); $to = array('600111222', '700333444'); $params_string = http_build_query($params); foreach ($to as $msisdn) { $params_string = $params_string . '&to=' . $msisdn; } $response=send_post($url, $params_string); var_dump($response); function send_post($url,$params_string) { $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` ### Response #### Success Response (200) - **messageId** (string) - The unique identifier for the sent message. #### Error Response - **errorMsg** (string) - A message describing the error. - **errorCode** (integer) - An error code indicating the type of error. #### Response Example (Success) ```json { "messageId":"191919" } ``` #### Response Example (Error) ```json { "errorMsg":"Niepoprawny klucz - sprawdź swój klucz API.", "errorCode":101 } ``` ``` -------------------------------- ### Get Sender Fields using PHP Source: https://smsplanet.pl/doc/slate/index.html This PHP script demonstrates how to send a POST request to the SMSPlanet API to get sender fields. It includes a helper function 'send_post' for making the HTTP request and handling the response. Replace placeholders with your API key and password. ```php 'klucz_api', 'password' => 'haslo', 'product' => 'SMS' ]; $response=send_post($url, $params); var_dump($response); function send_post($url,$params) { $params_string = http_build_query($params); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` -------------------------------- ### Send SMS via GET Request (cURL) Source: https://smsplanet.pl/doc/slate/index.html Use this cURL command to send an SMS message using the GET method. Ensure you replace placeholder values with your actual API key, password, and message details. This method is not recommended for sending to more than 200 numbers due to GET request length limitations. ```bash curl -X GET -G \ 'https://api2.smsplanet.pl/sms' \ -d key=klucz \ -d password=haslo \ -d from=TEST \ -d to=600111222 \ -d msg=Wiadomosc ``` -------------------------------- ### Successful Short URL Response Source: https://smsplanet.pl/doc/slate/index.html This is an example of a successful response when a URL is shortened. The 'shortUrl' field contains the generated shortened link. ```json {"shortUrl":"https://link.do/Qdwjg"} ``` -------------------------------- ### Send SMS using API Token Authentication Source: https://smsplanet.pl/doc/slate/index.html Example of sending an SMS using the SMSPLANET API with Bearer token authentication. Ensure your API token is correctly formatted and included in the Authorization header. The 'Content-Type' should be 'application/x-www-form-urlencoded'. ```bash curl -X POST \ https://api2.smsplanet.pl/sms \ -H 'Authorization: Bearer QwErTyUiOpaSdFgHjKlZxCvBnm12345' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'from=TEST&to=500111222&msg=wiadomość' ``` -------------------------------- ### Get Sender Fields using cURL Source: https://smsplanet.pl/doc/slate/index.html Use this cURL command to make a POST request to the SMSPlanet API to retrieve available sender fields. Ensure you replace 'klucz' and 'haslo' with your actual API credentials. ```bash curl -X POST \ 'https://api2.smsplanet.pl/getSenderFields' \ -d key=klucz \ -d password=haslo \ -d product=SMS \ ``` -------------------------------- ### Get Sender Fields Source: https://smsplanet.pl/doc/slate/index.html Retrieves a list of available sender fields (sender IDs) for a specified product. This is useful for knowing which sender IDs are registered and can be used for sending messages. ```APIDOC ## POST /getSenderFields ### Description Retrieves a list of available sender fields (sender IDs) for a specified product. This is useful for knowing which sender IDs are registered and can be used for sending messages. ### Method POST ### Endpoint https://api2.smsplanet.pl/getSenderFields ### Parameters #### Query Parameters - **key** (string) - Optional - API key identifying the user. Required only if an authorization token is not present. - **password** (string) - Optional - API password. Disabled by default. The first password must be set in the client panel. - **product** (enum: SMS, 2WAY, MMS) - Optional - The name of the product for which sender fields are being checked. Default value: SMS ### Request Example ```json { "key": "klucz", "password": "haslo", "product": "SMS" } ``` ### Response #### Success Response (200) - **senderFields** (string) - Available sender fields separated by commas. #### Response Example ```json { "senderFields": "TEST,Informacja,Sklep,MojaFirma" } ``` #### Error Response - **errorMsg** (string) - Information about the cause of the error. - **errorCode** (integer) - Unique error code. #### Error Response Example ```json { "errorMsg": "Invalid key - check your API key.", "errorCode": 101 } ``` ``` -------------------------------- ### Create Webhook using PHP Source: https://smsplanet.pl/doc/slate/index.html This PHP script demonstrates how to create a webhook using the SMSPlanet API. It includes a helper function to send POST requests and handles the API response. ```php 'klucz_api', 'password' => 'haslo', 'url' => 'http://mojastrona.pl/webhook', 'type' => 'MESSAGE_NOTIFICATION_WEBHOOK' ]; $response=send_post($url, $params); var_dump($response); function send_post($url,$params) { $params_string = http_build_query($params); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` -------------------------------- ### List Shortened Links using PHP Source: https://smsplanet.pl/doc/slate/index.html This PHP script demonstrates how to fetch a list of shortened links using the SMSPlanet API. It includes a helper function 'send_post' for making the API request. ```php 'klucz_api', 'password' => 'haslo', ]; $response=send_post($url, $params); var_dump($response); function send_post($url,$params) { $params_string = http_build_query($params); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` -------------------------------- ### Create Webhook using cURL Source: https://smsplanet.pl/doc/slate/index.html Use this cURL command to create a webhook for message notifications. Ensure you replace 'klucz', 'haslo', and the URL with your actual credentials and desired endpoint. ```bash curl -X POST \ 'https://api2.smsplanet.pl/webhooks/create' \ -d key=klucz \ -d password=haslo \ -d url=http://mojastrona.pl/webhook \ -d type=MESSAGE_NOTIFICATION_WEBHOOK \ ``` -------------------------------- ### Create Webhook Source: https://smsplanet.pl/doc/slate/index.html This method allows for the creation of a webhook. It is possible to add only one webhook of a given type. ```APIDOC ## POST /webhooks/create ### Description Allows for the creation of a webhook. Only one webhook of a given type can be added. ### Method POST ### Endpoint https://api2.smsplanet.pl/webhooks/create ### Parameters #### Query Parameters - **key** (string) - Optional - API key identifying the user. Required only if no authorization token is present. - **password** (string) - Optional - API password. Disabled by default. The first password must be set in the client panel. - **url** (string) - Required - The URL to which notifications will be forwarded. - **type** (enum) - Required - The type of webhook. Allowed values are: MESSAGE_NOTIFICATION_WEBHOOK - notifications about the status of sent messages. ### Request Example ```json { "key": "klucz", "password": "haslo", "url": "http://mojastrona.pl/webhook", "type": "MESSAGE_NOTIFICATION_WEBHOOK" } ``` ### Response #### Success Response (200) - **result** (string) - The field can only take the value "OK" #### Response Example ```json { "result": "OK" } ``` ### Error Handling #### Error Response - **errorMsg** (string) - Information about the cause of the error. - **errorCode** (string) - Unique error code. ``` -------------------------------- ### Get Message Info Source: https://smsplanet.pl/doc/slate/index.html Retrieves detailed information about sent SMS messages, including delivery status and timestamps. This endpoint can be used to fetch details for multiple messages at once. ```APIDOC ## POST getMessageInfo ### Description Retrieves detailed information about sent SMS messages, including delivery status and timestamps. This endpoint can be used to fetch details for multiple messages at once. ### Method POST ### Endpoint https://api2.smsplanet.pl/getMessageInfo ### Parameters #### Query Parameters - **key** (string) - Optional - API key identifying the user. Required only if an authorization token is not provided. - **password** (string) - Optional - API password. Disabled by default. The first password must be set in the client panel. - **messageId** (multi integer array) - Required - Unique identifier of the shipment - this parameter can occur multiple times, which will cause the retrieval of details of multiple shipments at once. A maximum of 1000 messageId parameters can be provided in a single request. - **responseType** (string) - Optional - "json" or "csv". Default value: "json" ### Request Example ```json { "key": "klucz", "password": "haslo", "messageId": "123456" } ``` ### Response #### Success Response (200) - **result** (string) - Can only take the value "OK". - **message** (string) - Report content in CSV format (semicolon as separator). The first 7 lines contain information about the shipment. Subsequent lines contain delivery details for each number. #### Response Example ```json { "result": "OK", "message": "Pole nadawcy: TEST\nNazwa wysyłki: \nTreść wiadomości: wiadomość testowa\nData wysyłki: 22-12-2019 17:46:34\nWysłane: 3\nDostarczone: 3\nZwroty: 0\n\n"Numer telefonu";"Dostarczono";"Data dostarczenia";"Powód odrzucenia";"Pobrano opłatę"\n"000111222";"TAK";"22-12-2019 17:46:40";"";"TAK"\n"333444555";"TAK";"22-12-2019 17:46:40";"";"TAK"\n"666777888";"TAK";"22-12-2019 17:46:40";"";"TAK" } ``` #### Error Response - **errorMsg** (string) - Information about the cause of the error. - **errorCode** (integer) - Unique error code. #### Error Response Example ```json { "errorMsg": "Niepoprawny klucz - sprawdź swój klucz API.", "errorCode": 101 } ``` ### Limits The method cannot be called more often than once every 3 minutes. Delivery statuses are updated every few minutes, so more frequent calls to the method are groundless. ``` -------------------------------- ### Usuwanie skróconego linku za pomocą cURL Source: https://smsplanet.pl/doc/slate/index.html Użyj tego polecenia cURL do wysłania żądania POST w celu usunięcia skróconego linku. Wymaga podania klucza API, hasła i aliasu linku. ```bash curl -X POST \ 'https://api2.smsplanet.pl/shortener/remove' \ -d key=klucz \ -d password=haslo \ -d alias=XYZ \ ``` -------------------------------- ### List Shortened Links using cURL Source: https://smsplanet.pl/doc/slate/index.html Use this cURL command to list all shortened links associated with your API key. Ensure you replace 'klucz' and 'haslo' with your actual API credentials. ```bash curl -X GET -G \ 'https://api2.smsplanet.pl/shortener/list' \ -d key=klucz \ -d password=haslo \ ``` -------------------------------- ### Generowanie raportu zbiorczego za pomocą cURL Source: https://smsplanet.pl/doc/slate/index.html Użyj tego polecenia cURL do wysłania żądania POST do API w celu wygenerowania raportu zbiorczego. Wymaga podania klucza API, hasła oraz zakresu dat. ```bash curl -X POST \ 'https://api2.smsplanet.pl/generateReport' \ -d key=klucz \ -d password=haslo \ -d from=01-05-2019 \ -d to=30-06-2019 ``` -------------------------------- ### Webhook - lista Source: https://smsplanet.pl/doc/slate/index.html This method allows you to retrieve a list of all created webhooks. It requires API key and password for authentication. ```APIDOC ## GET /webhooks/list ### Description Retrieves a list of all configured webhooks. ### Method GET ### Endpoint `https://api2.smsplanet.pl/webhooks/list` ### Parameters #### Query Parameters - **key** (string) - Optional - API key identifying the user. Required only if an authorization token is not provided. - **password** (string) - Optional - API password. Disabled by default. The first password must be set in the client panel. ### Request Example ```json { "key": "klucz", "password": "haslo" } ``` ### Response #### Success Response (200) - **webhooks** (array) - A list of all created webhooks. Each webhook object contains 'type' and 'url'. #### Response Example ```json { "webhooks": [ { "type": "MESSAGE_NOTIFICATION_WEBHOOK", "url": "https://link.do/webhook" } ] } ``` #### Error Response - **errorMsg** (string) - Message explaining the reason for the error. - **errorCode** (integer) - Unique error code. #### Error Response Example ```json { "errorMsg": "Invalid key - check your API key.", "errorCode": 101 } ``` ``` -------------------------------- ### Retrieve Detailed Shipping Info using PHP Source: https://smsplanet.pl/doc/slate/index.html This PHP script demonstrates how to make a POST request to the getMessageInfo API endpoint using cURL to retrieve detailed shipping information. It includes a helper function for sending POST requests and displays the response. Replace placeholder credentials and message ID with your actual values. ```php 'klucz_api', 'password' => 'haslo', 'messageId' => '123456' ]; $response=send_post($url, $params); var_dump($response); function send_post($url,$params) { $params_string = http_build_query($params); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` -------------------------------- ### SMS Length Calculation with PHP Source: https://smsplanet.pl/doc/slate/index.html This PHP script calculates the number of SMS parts for a given message content. It uses a helper function to perform GET requests with parameters. Remember to replace placeholders with your API credentials. ```php 'klucz_api', 'password' => 'haslo', 'content' => 'treść SMSa do sprawdzenia' ]; $response=send_get($url, $params); function send_get($url,$params) { $params_string = http_build_query($params); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url . '?'.$params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` -------------------------------- ### Check Prepaid Account Balance with PHP Source: https://smsplanet.pl/doc/slate/index.html This PHP script demonstrates how to check your prepaid SMS account balance using the SMSPlanet API. It includes a helper function for making POST requests. Replace placeholders with your API credentials. ```php 'klucz_api', 'password' => 'haslo' ]; $response=send_post($url, $params); var_dump($response); function send_post($url,$params) { $params_string = http_build_query($params); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` -------------------------------- ### Usuń numer z czarnej listy (cURL) Source: https://smsplanet.pl/doc/slate/index.html Użyj tego polecenia cURL do wysłania żądania POST w celu usunięcia numeru z czarnej listy. Wymaga klucza API, hasła i numeru MSISDN. ```bash curl -X POST \ 'https://api2.smsplanet.pl/blacklist/remove' \ -d key=klucz \ -d password=haslo \ -d msisdn=600111222 \ ``` -------------------------------- ### Add Number to Blacklist (PHP) Source: https://smsplanet.pl/doc/slate/index.html This PHP script demonstrates how to add a phone number to the blacklist using the SMSPlanet API. It utilizes a helper function `send_post` to make the HTTP request. Replace placeholder credentials and phone number with your actual details. ```php 'klucz_api', 'password' => 'haslo', 'msisdn' => '600111222' ]; $response=send_post($url, $params); var_dump($response); function send_post($url,$params) { $params_string = http_build_query($params); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` -------------------------------- ### Retrieve Detailed Shipping Info using cURL Source: https://smsplanet.pl/doc/slate/index.html Use this cURL command to send a POST request to the getMessageInfo endpoint to fetch detailed status for a specific message ID. Ensure you replace 'klucz' and 'haslo' with your actual API credentials and '123456' with the message ID. ```bash curl -X POST \ 'https://api2.smsplanet.pl/getMessageInfo' \ -d key=klucz \ -d password=haslo \ -d messageId=123456 \ ``` -------------------------------- ### Check Prepaid Account Balance with cURL Source: https://smsplanet.pl/doc/slate/index.html Use this cURL command to check the balance of your prepaid SMS account. Ensure you replace 'klucz' and 'haslo' with your actual API key and password. ```bash curl -X POST \ 'https://api2.smsplanet.pl/getBalance' \ -d key=klucz \ -d password=haslo ``` -------------------------------- ### Shorten URL using PHP Source: https://smsplanet.pl/doc/slate/index.html This PHP script demonstrates how to send a POST request to the shortUrl API endpoint to shorten a URL. It includes a helper function for making the POST request and handling the response. ```php 'klucz_api', 'password' => 'haslo', 'longUrl' => 'https://google.com' ]; $response=send_post($url, $params); var_dump($response); function send_post($url,$params) { $params_string = http_build_query($params); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` -------------------------------- ### Usuń numer z czarnej listy (PHP) Source: https://smsplanet.pl/doc/slate/index.html Przykład w PHP pokazujący, jak wysłać żądanie POST do usunięcia numeru z czarnej listy. Zawiera funkcję pomocniczą do obsługi żądań POST. ```php 'klucz_api', 'password' => 'haslo', 'msisdn' => '600111222' ]; $response=send_post($url, $params); var_dump($response); function send_post($url,$params) { $params_string = http_build_query($params); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` -------------------------------- ### Anulowanie wiadomości SMS za pomocą cURL Source: https://smsplanet.pl/doc/slate/index.html Użyj tego polecenia cURL do anulowania zaplanowanej wysyłki wiadomości SMS. Wymaga podania klucza API, hasła i identyfikatora wiadomości. ```bash curl -X POST \ 'https://api2.smsplanet.pl/cancelMessage' \ -d key=klucz \ -d password=haslo \ -d messageId=123456 \ ``` -------------------------------- ### Shorten URL using cURL Source: https://smsplanet.pl/doc/slate/index.html Use this cURL command to make a POST request to the shortUrl endpoint. Ensure you replace 'klucz' and 'haslo' with your actual API key and password. ```bash curl -X POST \ 'https://api2.smsplanet.pl/shortUrl' \ -d key=klucz \ -d password=haslo \ -d longUrl=https://google.com \ ``` -------------------------------- ### Generowanie raportu zbiorczego za pomocą PHP Source: https://smsplanet.pl/doc/slate/index.html Ten skrypt PHP demonstruje, jak wysłać żądanie POST do API SMSPlanet w celu wygenerowania raportu zbiorczego. Zawiera funkcję pomocniczą do obsługi żądań POST. ```php 'klucz_api', 'password' => 'haslo', 'from' => '01-05-2019', 'to' => '30-06-2019' ]; $response=send_post($url, $params); var_dump($response); function send_post($url,$params) { $params_string = http_build_query($params); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` -------------------------------- ### Send MMS via PHP Source: https://smsplanet.pl/doc/slate/index.html This PHP script demonstrates how to send an MMS message using the SMS Planet API. It includes a helper function for making POST requests. Replace placeholder values with your API credentials and message details. ```php 'klucz_api', 'password' => 'haslo', 'from' => 'TEST', 'to' => '600111222', 'subject' => 'temat', 'attachment' => 'https://link.do/zdjecia/kotka.jpg', 'msg' => 'Wiadomość testowa' ]; $response=send_post($url, $params); var_dump($response); function send_post($url,$params) { $params_string = http_build_query($params); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` -------------------------------- ### List Shortened Links Source: https://smsplanet.pl/doc/slate/index.html Retrieves a list of all shortened links created through the API. Authentication is required using an API key and password, or an authorization token. ```APIDOC ## List Shortened Links ### Description Retrieves a list of all shortened links. ### Method GET ### Endpoint `https://api2.smsplanet.pl/shortener/list` ### Parameters #### Query Parameters - **key** (string) - Optional - API key identifying the user. Required only if no authorization token is present. - **password** (string) - Optional - API password. Disabled by default. The first password must be set in the client panel. - **shortUrl** (string) - Optional - Shortened URL. If this parameter is omitted, information about all links will be retrieved. ### Request Example ```bash curl -X GET -G \ 'https://api2.smsplanet.pl/shortener/list' \ -d key=klucz \ -d password=haslo \ ``` ### Response #### Success Response (200) - **links** (array) - A list of objects, where each object contains details about a shortened link including date, shortURL, clicks, and longURL. #### Response Example ```json { "links": [ { "date": "27-04-2021 14:24:27", "shortURL": "https://link.do/iyv5w", "clicks": "0", "longURL": "https://smsplanet.pl/api" } ] } ``` #### Error Response - **errorMsg** (string) - A message describing the error. - **errorCode** (integer) - A unique error code. #### Error Response Example ```json { "errorMsg": "Invalid key - check your API key.", "errorCode": 101 } ``` ``` -------------------------------- ### Usuwanie skróconego linku za pomocą PHP Source: https://smsplanet.pl/doc/slate/index.html Ten skrypt PHP demonstruje, jak wysłać żądanie POST do API SMSPlanet w celu usunięcia skróconego linku. Zawiera funkcję pomocniczą do obsługi żądań POST. ```php 'klucz_api', 'password' => 'haslo', 'alias' => 'XYZ' ]; $response=send_post($url, $params); var_dump($response); function send_post($url,$params) { $params_string = http_build_query($params); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $params_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close ($ch); return $response; } ?> ``` -------------------------------- ### Zgłoszenie pola nadawcy Source: https://smsplanet.pl/doc/slate/index.html This method allows you to submit a sender field. It requires API key, password, and the sender field name. ```APIDOC ## POST /addSenderField ### Description Submits a custom sender field for use with SMS messages. ### Method POST ### Endpoint `https://api2.smsplanet.pl/addSenderField` ### Parameters #### Query Parameters - **key** (string) - Optional - API key identifying the user. Required only if an authorization token is not provided. - **password** (string) - Optional - API password. Disabled by default. The first password must be set in the client panel. - **senderField** (string) - Required - The name of the sender field. Maximum 11 characters. Allowed characters: a-z, A-Z, 0-9, ., -, +, _, ! [space] (phone number is not allowed). ### Request Example ```json { "key": "klucz", "password": "haslo", "senderField": "MOJA FIRMA" } ``` ### Response #### Success Response (200) - **result** (string) - Indicates the status of the operation. Can only have the value "OK". #### Response Example ```json { "result": "OK" } ``` #### Error Response - **errorMsg** (string) - Message explaining the reason for the error. - **errorCode** (integer) - Unique error code. #### Error Response Example ```json { "errorMsg": "Invalid key - check your API key.", "errorCode": 101 } ``` ``` -------------------------------- ### Przykładowa odpowiedź API SMSPlanet Source: https://smsplanet.pl/doc/slate/index.html Przykładowe odpowiedzi JSON z API SMSPlanet, pokazujące sukces ('OK') lub błąd z kodem i komunikatem. ```json {"result":"OK"} ``` ```json {"errorMsg":"Niepoprawny klucz - sprawdź swój klucz API.","errorCode":101} ``` -------------------------------- ### Przykładowa odpowiedź API (sukces) Source: https://smsplanet.pl/doc/slate/index.html Przykładowa odpowiedź JSON w przypadku pomyślnego anulowania wiadomości. ```json {"result":"OK"} ```