### QueryDomains Endpoint GET Request Example Source: https://secure.lekab.com/doc/EmailToSmsAdminRESTWebService.html Example of a GET request to the /querydomains endpoint. Parameters are provided in the URL. ```http GET /querydomains?domain=example.com HTTP/1.1 Host: sms.lekab.com ``` -------------------------------- ### Batch Info GET Request Example Source: https://secure.lekab.com/doc/SMSRESTBatchWebService.html Example of how to retrieve batch information using a GET request. This is typically used from a web browser or command-line tool like curl. ```curl curl https://secure.lekab.com/restsms/api/batchinfo?U=testuser&P=testpass&BI=490922766334210048 ``` -------------------------------- ### GET Request Example for /incoming Source: https://secure.lekab.com/doc/SMSRESTWebService.html Example of a GET request to the /incoming endpoint, typically used from a web browser or curl. Parameters like username, password, mark as read status, number of messages, and get original flag are included. ```bash curl https://secure.lekab.com/restsms/api/incoming?U=testuser&P=testpass&R=FALSE&N=10&G=Y ``` -------------------------------- ### Set Endpoint GET Request Example Source: https://secure.lekab.com/doc/EmailToSmsAdminRESTWebService.html Example of a GET request to the /set endpoint. Parameters are provided in the URL. ```http GET /set?email=john.doe@example.com&domain=example.com&phone=46701234567&payid=12345&block=false&comment=Test%20user HTTP/1.1 Host: sms.lekab.com ``` -------------------------------- ### Default Endpoint GET Request Example Source: https://secure.lekab.com/doc/EmailToSmsAdminRESTWebService.html Example of a GET request to the /default endpoint. Parameters are provided in the URL. ```http GET /default?domain=example.com&phone=46701234567&payid=12345&block=false&comment=Default%20user HTTP/1.1 Host: sms.lekab.com ``` -------------------------------- ### GET Request Example for /status Source: https://secure.lekab.com/doc/SMSRESTWebService.html Use this example for retrieving SMS statuses directly from a web browser or using curl. It demonstrates how to pass authentication and message IDs as query parameters. ```bash curl https://secure.lekab.com/restsms/api/status?U=testuser&P=testpass&R=FALSE&I=1088,4140,4118,4243,4412 ``` -------------------------------- ### POST Request Example for /incoming Source: https://secure.lekab.com/doc/SMSRESTWebService.html Example of a POST request to the /incoming endpoint, suitable for applications. It includes parameters like username, password, mark as read status, max number of messages, and get original flag within the HTTP body. ```json { "username" : "testuser", "password" : "testpass", "markasread" : false, "maxnum" : 10, "getoriginal" : true } ``` -------------------------------- ### List Tags via GET Request Source: https://secure.lekab.com/doc/AddressbookWebService.html Example of how to list all tags in the address book using a GET request. Parameters are appended to the URL. ```http GET /listtags?apikey=YOUR_API_KEY HTTP/1.1 Host: api.lekab.com ``` -------------------------------- ### List Address Books via GET Request Source: https://secure.lekab.com/doc/AddressbookWebService.html Example of how to list available address books using a GET request, typically from a web browser. Parameters are appended to the URL. ```http GET /listaddressbooks?apikey=YOUR_API_KEY HTTP/1.1 Host: api.lekab.com ``` -------------------------------- ### GET Request Example for Batch Message IDs Source: https://secure.lekab.com/doc/SMSRESTBatchWebService.html This example shows how to retrieve batch message IDs using a GET request, typically from a web browser or curl. Parameters are passed as query parameters. ```bash curl https://secure.lekab.com/restsms/api/batchmessageid?U=testuser&P=testpass&BI=490922766334210048 ``` -------------------------------- ### Start saved job via GET request Source: https://secure.lekab.com/doc/DispatchWebService.html Initiates a saved job using a cURL command with query parameters. ```bash curl https://secure.lekab.com/dispatch/api/startsavedjob?U=partyparty&P=testpass&J=352872112744058883&N=Xmas%20bash&S=Xmas2022,EngineeringConsultants ``` -------------------------------- ### Python 3 Batch Info Output Example Source: https://secure.lekab.com/doc/SMSRESTBatchWebService.html This is the expected output when running the Python 3 batch info example. ```text Batch 490922766334210048(wed_campaign_feb) gets status Ok ``` -------------------------------- ### Authentication API Key Example Source: https://secure.lekab.com/doc/MedalliaAdapter.html Example of an API key used as an access_token query parameter for authentication. ```text TUxVOmRHVnpkSFZ6WlhJOjlKUUczTXU2TVZVU1Exd3Y ``` -------------------------------- ### GET request for saved jobs Source: https://secure.lekab.com/doc/DispatchWebService.html Example of retrieving saved jobs using a GET request with URL parameters for authentication. ```bash curl https://secure.lekab.com/dispatch/api/listsavedjobs?U=partyparty&P=testpass ``` -------------------------------- ### Python 3 Example Output Source: https://secure.lekab.com/doc/SMSRESTBatchWebService.html This is the expected output when running the Python 3 example script for the /batchstatuscount endpoint. ```text id=490922766334210048, conv=Sendout 123 --- DELIVERED : 4 UNDELIVERABLE : 1 --- ``` -------------------------------- ### Python 3 Example for Batch Info Source: https://secure.lekab.com/doc/SMSRESTBatchWebService.html This Python 3 code snippet demonstrates how to send a POST request to the /batchinfo endpoint and process the JSON response. Ensure the 'requests' library is installed. ```python import json import requests info = {"username" : "testuser", "password": "testpass", "batchid" : "490922766334210048"} info_json = json.dumps(info) url = 'https://secure.lekab.com/restsms/api/batchinfo' response = requests.post(url, data=info_json) inforesp = response.json() print("Batch " + inforesp["batchid"] + "(" + inforesp["batchconversation"] + ") gets status " + inforesp["batchstatusdescription"]) ``` -------------------------------- ### POST Request Example for /status Source: https://secure.lekab.com/doc/SMSRESTWebService.html This example shows how to make a POST request to the /status endpoint from an application. Authentication credentials and message IDs are sent in the JSON body. ```json { "username" : "testuser",  "password" : "testpass",  "markasread" : false, "id" : [ "1088", "4140", "4118", "4243", "4412" ] } ``` -------------------------------- ### Unset Endpoint GET Request Example Source: https://secure.lekab.com/doc/EmailToSmsAdminRESTWebService.html Example of a GET request to the /unset endpoint. Parameters are provided in the URL. ```http GET /unset?email=john.doe@example.com&domain=example.com HTTP/1.1 Host: sms.lekab.com ``` -------------------------------- ### QueryDomains Endpoint POST Request Example Source: https://secure.lekab.com/doc/EmailToSmsAdminRESTWebService.html Example of a POST request to the /querydomains endpoint. Parameters are provided in a JSON body. ```json { "domain": "example.com" } ``` -------------------------------- ### Start Saved Job using Python Source: https://secure.lekab.com/doc/DispatchWebService.html Use this Python code to start a saved job via the `/startsavedjob` endpoint. Ensure you have the `requests` and `json` libraries installed. The response includes the job name and a runtime ID. ```python import json import requests startreq = {"username" : "partyparty", "password" : "testpass", "jobid" : 352872112744058883, "jobname" : "Xmas bash", "toaddressbooksavedtagfilters" : ["Xmas2022","EngineeringConsultants"]} startreq_json = json.dumps(startreq) starturl = 'https://secure.lekab.com/dispatch/api/startsavedjob' response = requests.post(starturl, data=startreq_json) startresp = response.json() print("Started job " + startresp["jobname"] +" with runtime id " + str(startresp["runtimeid"])) ``` ```text Started job Xmas bash with runtime id 383228819873509376 ``` -------------------------------- ### Send SMS via GET Request Source: https://secure.lekab.com/doc/SMSRESTWebService.html Use this example for sending SMS messages via a GET request, typically from a web browser or curl. Ensure all parameters are correctly encoded. ```bash curl https://secure.lekab.com/restsms/api/send?U=testuser&P=testpass&T=46701234567,46CALLMENOW&F=LEKAB&M8=Hall%C3%A5+d%C3%A4r!&2=TRUE&X=CONV123 ``` -------------------------------- ### Python 3 Example for Sending SMS Source: https://secure.lekab.com/doc/SMSRESTWebService.html This Python 3 code snippet demonstrates how to send an SMS using the /send endpoint. Ensure you have the 'requests' library installed. ```python import requests url = "https://example.com/send" headers = { "Content-Type": "application/json" } data = { "to": "+46701234567", "from": "MyService", "text": "Hello world!" } response = requests.post(url, headers=headers, json=data) if response.status_code == 200: print("SMS sent successfully!") print(response.json()) else: print(f"Error sending SMS: {response.status_code}") print(response.text) ``` -------------------------------- ### GET Request with URL Parameters Source: https://secure.lekab.com/doc/EmailToSmsAdminRESTWebService.html Example of a GET request to the /set endpoint using URL parameters for authentication and data. URL parameters must be URL-encoded, with spaces represented by '+'. ```curl curl https://secure.lekab.com/restsms/api/emailtosms/set?U=testuser&P=testpass&EM=john.doe@bigco.com&SD=J+DOE&CM=Y ``` -------------------------------- ### Find Contact by Address Example Source: https://secure.lekab.com/doc/AddressbookWebService.html Example of how to find a contact by providing their address details. This uses the /findcontactbyaddress endpoint. ```http POST /findcontactbyaddress HTTP/1.1 Host: api.lekab.com Content-Type: application/json { "apikey": "YOUR_API_KEY", "addressbookid": 123, "email": "test@example.com" } ``` -------------------------------- ### Incoming Message Callback Example (REPLY Type) Source: https://secure.lekab.com/doc/RimeRESTWebService.html An example of an incoming message callback when a user replies, specifically of type 'REPLY'. ```APIDOC ## Incoming Message Callback Example (REPLY Type) ### Description This is an example of an incoming message callback for a message of type `REPLY`. ### Method POST (Callback) ### Endpoint `/callback/incoming_message` (Hypothetical endpoint for receiving callbacks) ### Request Body Example ```json { "id": "1249385655331594240", "userid": "12345", "appname": "", "time": "2025-09-08T13:32:32Z", "channel": "RCS", "from": "46701234567", "to": "mycompany_abcdabcd_agent", "responseto": "1249385535177367552", "type": "REPLY", "text": "ABCD", "buttontext": "YES", "resptometadata": "This is the metadata", "resptoconvid": "ABC123" } ``` ``` -------------------------------- ### Default Endpoint POST Request Example Source: https://secure.lekab.com/doc/EmailToSmsAdminRESTWebService.html Example of a POST request to the /default endpoint. Parameters are provided in a JSON body. ```json { "domain": "example.com", "phone": "46701234567", "payid": "12345", "block": false, "comment": "Default user" } ``` -------------------------------- ### Set Endpoint POST Request Example Source: https://secure.lekab.com/doc/EmailToSmsAdminRESTWebService.html Example of a POST request to the /set endpoint. Parameters are provided in a JSON body. ```json { "email": "john.doe@example.com", "domain": "example.com", "phone": "46701234567", "payid": "12345", "block": false, "comment": "Test user" } ``` -------------------------------- ### POST Request Body Example Source: https://secure.lekab.com/doc/EmailToSmsAdminRESTWebService.html Example of the JSON payload for a POST request to the /set endpoint, including authentication credentials and data. ```JSON {"username":"testuser","password":"testpass", "email":"john.doe@bigco.com","sender":"J DOE","checkMobile":true} ``` -------------------------------- ### Successful Job Start JSON Response Source: https://secure.lekab.com/doc/DispatchWebService.html The expected JSON structure returned upon a successful job start request. ```json { "result": "OK", "runtimeid": 383228819873509376, "jobname": "Xmas bash", "errormessage": "" } ``` -------------------------------- ### Add Contact Example Source: https://secure.lekab.com/doc/AddressbookWebService.html Example of how to add a new contact to the address book using the /addcontact endpoint. Requires API key, address book ID, and contact details. ```http POST /addcontact HTTP/1.1 Host: api.lekab.com Content-Type: application/json { "apikey": "YOUR_API_KEY", "addressbookid": 123, "contact": { "firstname": "John", "lastname": "Doe", "email": "john.doe@example.com", "phone": "1234567890" } } ``` -------------------------------- ### Example Output for Batch Message Statuses Source: https://secure.lekab.com/doc/SMSRESTBatchWebService.html This is an example of the output you can expect when running the Python script to check batch message statuses. ```text id=180024553, status=DELIVERED id=180024554, status=DELIVERED id=180024556, status=UNDELIVERABLE ``` -------------------------------- ### List Address Books via GET Source: https://secure.lekab.com/doc/AddressbookWebService.html Retrieve available address books using a GET request with credentials as query parameters. ```HTTP GET https://secure.lekab.com/addressbook/api/listaddressbooks?U=doggykennel&P=testpass ``` -------------------------------- ### Python 3 Code Example for Sending Rich Messages Source: https://secure.lekab.com/doc/RimeRESTWebService.html An example demonstrating how to send a multi-part rich message using Python 3 with the `requests` library. ```APIDOC ## Python 3 Example for Sending Rich Messages ### Description This Python 3 code snippet shows how to construct and send a multi-part rich message using the `requests` library. It includes setting up basic authentication and handling the JSON request and response. ### Language Python 3 ### Code ```python import json import requests import base64 # Basic Authentication Setup authstringarray=("testuser" + ":" + "testpass").encode('utf-8') authbase64=base64.b64encode(authstringarray).decode('utf-8') headers={'Authorization':'Basic ' + authbase64} # Constructing the send request payload sendreq = {} sendreq["channels"] = "RCS,SMS" sendreq["address"] = "46701234567;46702345678" sendreq["richMessage"] = { "text":"Can you work extra hours on Christmas Day?", "suggestions":[ { "reply" : { "text" : "Yes" } }, { "reply" : { "text" : "No" } } ] } sendreq["metadata"] = 'Xmas 2026 employee 1234' sendreq_json = json.dumps(sendreq) # Sending the POST request url = 'https://secure.lekab.com/rime/send' response = requests.post(url, data=sendreq_json, headers=headers) sendresp = response.json() # Handling the response if sendresp["sent"]: for m in sendresp["sent"]: print(f"Successful message id {m['id']} to {m['addresses']} via {m['channels']}") else: print(f"Send error: {sendresp["error"]}") ``` ### Output Example ``` Successful message id 1225831041592336384 to 46701234567,46701234567 via RCS,SMS Successful message id 1225831041684611072 to 46702345678,46702345678 via RCS,SMS ``` ``` -------------------------------- ### Retrieve Template Details Source: https://secure.lekab.com/doc/RimeRESTWebService.html Example JSON response for a successful /template/get request. ```json { "id" : "11257673581400342522", "slug" : "manual-example-message", "name" : "An example message used to illustrate saving templates in the API manual", "userid" : 12345, "appname" : "", "richMessage" : [ { "text":"This is a text RCS message and, as you can see, it is from a trusted agent" } ], "smsText" : "You got this SMS message because you cannot receive RCS", "createdby" : "testuser", "createdtime" : "2025-10-01T10:25:48Z", "modifiedby" : "testuser", "modifiedtime" : "2025-10-08T10:42:55Z" } ``` -------------------------------- ### GET Request for /default Endpoint Source: https://secure.lekab.com/doc/EmailToSmsAdminRESTWebService.html Example of a GET request to the /default endpoint using curl. ```bash curl https://secure.lekab.com/restsms/api/emailtosms/default? U=testuser&P=testpass&PU=bigco-sales&SD=BIGCO& DC=46&MS=12&CM=Y&IS=N&ND=N&OM=Y&SC=N&SL=N ``` -------------------------------- ### GET /batchinfo and POST /batchinfo Source: https://secure.lekab.com/doc/SMSRESTBatchWebService.html Endpoints to retrieve information about a specific SMS batch. Supports both GET and POST requests with detailed parameter explanations and response examples. ```APIDOC ## GET /batchinfo and POST /batchinfo ### Description These endpoints are used to retrieve detailed information about a specific SMS batch. Both GET and POST methods are supported. The documentation includes explanations of parameters, HTTP responses, and batch status. ### Method GET, POST ### Endpoint `/batchinfo` ### Parameters #### Path Parameters None #### Query Parameters - **batchId** (string) - Required - The unique identifier of the batch to retrieve information for. #### Request Body Details on request body fields for the POST method are provided in the full documentation. ### Request Example ```json { "example": "Request body for POST /batchinfo" } ``` ### Response #### Success Response (200) - **batchId** (string) - The unique identifier of the batch. - **status** (string) - The current status of the batch. - **messageCount** (integer) - The total number of messages in the batch. - **sentCount** (integer) - The number of messages successfully sent. - **failedCount** (integer) - The number of messages that failed to send. #### Response Example ```json { "batchId": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "status": "COMPLETED", "messageCount": 100, "sentCount": 98, "failedCount": 2 } ``` ### Batch Status Information on batch status codes and their meanings is available. ``` -------------------------------- ### Python 3 Example for /listaddressbooks Endpoint Source: https://secure.lekab.com/doc/AddressbookWebService.html A Python 3 script demonstrating how to interact with the /listaddressbooks endpoint. It shows how to send a POST request and process the JSON response. ```python import requests import json url = "https://api.lekab.com/listaddressbooks" headers = { "Content-Type": "application/json" } # Replace with your actual API key payload = { "apikey": "YOUR_API_KEY" } try: response = requests.post(url, headers=headers, data=json.dumps(payload)) response.raise_for_status() # Raise an exception for bad status codes address_books = response.json() print(json.dumps(address_books, indent=2)) except requests.exceptions.RequestException as e: print(f"An error occurred: {e}") except json.JSONDecodeError: print("Failed to decode JSON response.") ``` -------------------------------- ### Unset Email Address Requests Source: https://secure.lekab.com/doc/EmailToSmsAdminRESTWebService.html Examples of how to remove an email address using GET, DELETE, and POST methods. ```bash curl https://secure.lekab.com/restsms/api/emailtosms/unset?U=testuser&P=testpass&EM=john.doe@bigco.com ``` ```bash curl -X DELETE https://secure.lekab.com/restsms/api/emailtosms/unset?U=testuser&P=testpass&EM=john.doe@bigco.com ``` ```text https://secure.lekab.com/restsms/api/emailtosms/unset ``` ```json {"username":"testuser","password":"testpass", "email":"john.doe@bigco.com"} ``` -------------------------------- ### Python 3 Example for Listing Tags Source: https://secure.lekab.com/doc/AddressbookWebService.html This Python script demonstrates how to make a POST request to the /listtags endpoint using the 'requests' library and process the JSON response. ```python import json import requests tagsreq = {"username" : "doggykennel", "password" : "testpass", "addressbookid" : 646802966493470722} tagsreq_json = json.dumps(tagsreq) tagsurl = 'https://secure.lekab.com/addressbook/api/listtags' response = requests.post(tagsurl, data=tagsreq_json) tagsresp = response.json() print("Listing tags in " + tagsresp["addressbookname"]) for a in tagsresp["tags"]: print(a["type"] + " occurs " + str(a["typecount"]) + " times, with " + str(len(a["values"])) + " different values") ``` -------------------------------- ### Get Batch Info Response Example Source: https://secure.lekab.com/doc/SMSRESTBatchWebService.html A successful request to the /batchinfo endpoint returns a JSON object with batch details. The Content-Type header is always application/json. ```json { "batchid" : "490922766334210048", "batchconversation" : "Sendout 123", "batchstatuscode" : 0, "batchstatusdescription" : "Ok" } ``` -------------------------------- ### List Address Books with Python Source: https://secure.lekab.com/doc/AddressbookWebService.html Example implementation using the requests library to fetch and iterate through address books. ```Python import json import requests bookreq = {"username" : "doggykennel", "password": "testpass"} bookreq_json = json.dumps(bookreq) bookurl = 'https://secure.lekab.com/addressbook/api/listaddressbooks' response = requests.post(bookurl, data=bookreq_json) bookresp = response.json() for a in bookresp["addressbooks"]: print(a["name"] + " has numeric id " + a["id"]) ``` ```text Kennel Company - Shared address book has numeric id 576978287400472577 Doggy Kennel - Private address book has numeric id 646802963557457921 Kennel Club Members has numeric id 646802966493470722 ``` -------------------------------- ### Get Batch Message IDs Response Example Source: https://secure.lekab.com/doc/SMSRESTBatchWebService.html A successful request to the /batchmessageid endpoint returns a JSON object containing a list of message IDs. The Content-Type header is always application/json. ```json { "messageids" : [ "180024553", "180024554", "180024556", "180024558", "180024559" ] } ``` -------------------------------- ### Batch Info POST Request Example Source: https://secure.lekab.com/doc/SMSRESTBatchWebService.html Example of how to retrieve batch information using a POST request, commonly used by applications. The request body contains authentication and batch identification details. ```json { "username" : "testuser", "password" : "testpass", "batchid" : "490922766334210048" } ``` -------------------------------- ### Default Settings API Source: https://secure.lekab.com/doc/EmailToSmsAdminRESTWebService.html This section describes the `/default` endpoint, used for setting company defaults that are applied when the `/set` endpoint is called. It provides examples for both GET requests (e.g., via browser or curl) and POST requests (typically from an application). ```APIDOC ## GET /restsms/api/emailtosms/default ### Description Retrieves or sets default company settings for email to SMS service. ### Method GET ### Endpoint `/restsms/api/emailtosms/default` ### Parameters #### Query Parameters - **U** (string) - Required - Username. - **P** (string) - Required - Password. - **PU** (string) - Optional - Paying user identifier. - **SD** (string) - Optional - Sender ID. - **DC** (string) - Optional - Default country code. - **MS** (string) - Optional - Maximum SMS count. - **CM** (boolean) - Optional - Check mobile status (true/false). - **IS** (boolean) - Optional - Include subject (true/false). - **ND** (boolean) - Optional - Only non-delivery (true/false). - **OM** (boolean) - Optional - Original message flag (true/false). - **SC** (boolean) - Optional - Split callback flag (true/false). - **SL** (boolean) - Optional - Sender logic flag (true/false). ### Request Example (GET) ```bash curl https://secure.lekab.com/restsms/api/emailtosms/default?U=testuser&P=testpass&PU=bigco-sales&SD=BIGCO&DC=46&MS=12&CM=Y&IS=N&ND=N&OM=Y&SC=N&SL=N ``` ## POST /restsms/api/emailtosms/default ### Description Sets default company settings for the email to SMS service via a POST request with a JSON body. ### Method POST ### Endpoint `/restsms/api/emailtosms/default` ### Parameters #### Request Body - **username** (string) - Required - Username. - **password** (string) - Required - Password. - **payinguser** (string) - Optional - Paying user identifier. - **sender** (string) - Optional - Sender ID. - **defaultCountrycode** (string) - Optional - Default country code. - **maxSms** (string) - Optional - Maximum SMS count. - **checkMobile** (boolean) - Optional - Check mobile status (true/false). - **includeSubject** (boolean) - Optional - Include subject (true/false). - **onlyNonDelivery** (boolean) - Optional - Only non-delivery (true/false). - **origMsg** (boolean) - Optional - Original message flag (true/false). - **splitCallback** (boolean) - Optional - Split callback flag (true/false). - **senderLogic** (boolean) - Optional - Sender logic flag (true/false). ### Request Example (POST) ```json { "username":"testuser", "password":"testpass", "payinguser":"bigco-sales", "sender" : "BIGCO", "defaultCountrycode" : "46", "maxSms" : "12", "checkMobile" : true, "includeSubject" : false, "onlyNonDelivery" : false, "origMsg" : true, "splitCallback" : false, "senderLogic" : false } ``` ``` -------------------------------- ### GET /batchstatuscount and POST /batchstatuscount Source: https://secure.lekab.com/doc/SMSRESTBatchWebService.html Endpoints to get a count of messages within a batch based on their status. Supports GET and POST requests, with parameter and response details. ```APIDOC ## GET /batchstatuscount and POST /batchstatuscount ### Description These endpoints provide a summary count of messages within a batch, categorized by their delivery status. Both GET and POST methods are supported. The documentation explains the parameters and the structure of the response, including counts for different status types. ### Method GET, POST ### Endpoint `/batchstatuscount` ### Parameters #### Path Parameters None #### Query Parameters - **batchId** (string) - Required - The unique identifier of the batch. #### Request Body Details on request body fields for the POST method are provided in the full documentation. ### Request Example ```json { "example": "Request body for POST /batchstatuscount" } ``` ### Response #### Success Response (200) - **statusCounts** (object) - An object containing counts for different message statuses. - **pending** (integer) - Count of messages with pending status. - **sent** (integer) - Count of messages successfully sent. - **failed** (integer) - Count of messages that failed. - **delivered** (integer) - Count of messages successfully delivered. - **other** (integer) - Count of messages with other statuses. #### Response Example ```json { "statusCounts": { "pending": 5, "sent": 90, "failed": 5, "delivered": 85, "other": 0 } } ``` ### Message Statuses Information regarding message statuses, including non-final, successful final, and failing final statuses, is detailed. ``` -------------------------------- ### Example Template Message Source: https://secure.lekab.com/doc/SMSRESTWebService.html A sample message string containing placeholders for dynamic data. ```text Hello CUSTOMER! You can pick up your delivery ITEMNO at our store in CITY. Best regards, Our Company ``` -------------------------------- ### GET Endpoint Substitution Parameters Source: https://secure.lekab.com/doc/SMSRESTWebService.html URL-encoded parameters for performing substitutions in the GET /send endpoint. ```text TS=46701234567,Anna,1234567,Stockholm,46709876543,Sven,1234568,V%C3%A4stra+Fr%C3%B6lunda&H=CUSTOMER,ITEMNO,CITY ``` -------------------------------- ### GET /incoming Source: https://secure.lekab.com/doc/SMSRESTWebService.html Retrieves incoming SMS messages using GET request with parameters in the URL. ```APIDOC ## GET /incoming ### Description Retrieves incoming SMS messages using a GET request. Parameters are provided in the URL query string. ### Method GET ### Endpoint /incoming ### Parameters #### Query Parameters - **limit** (integer) - Optional - The maximum number of incoming messages to retrieve. - **offset** (integer) - Optional - The number of messages to skip. ### Request Example ``` GET /incoming?limit=10&offset=0 ``` ### Response #### Success Response (200) - **status** (string) - The status of the operation (e.g., 'success', 'error'). - **messages** (array of objects) - A list of incoming message objects. - **sender** (string) - The sender's phone number. - **message** (string) - The content of the incoming message. - **timestamp** (string) - The timestamp when the message was received. #### Response Example ```json { "status": "success", "messages": [ { "sender": "+1987654321", "message": "Received your message!", "timestamp": "2024-01-01T12:00:00Z" } ] } ``` ``` -------------------------------- ### GET /send Source: https://secure.lekab.com/doc/SMSRESTWebService.html Sends one or more SMS messages using GET request with parameters in the URL. ```APIDOC ## GET /send ### Description Sends one or more SMS messages using a GET request. Parameters are provided in the URL query string. ### Method GET ### Endpoint /send ### Parameters #### Query Parameters - **to** (string) - Required - The recipient's phone number. - **from** (string) - Optional - The sender ID. - **message** (string) - Required - The text message content. - **encoding** (string) - Optional - The character encoding to use (e.g., 'gsm7', 'ucs2'). - **tag** (string) - Optional - A tag for message filtering. ### Request Example ``` GET /send?to=%2B1234567890&from=MyService&message=Hello%2C%20world%21&encoding=gsm7 ``` ### Response #### Success Response (200) - **status** (string) - The status of the operation (e.g., 'success', 'error'). - **message_id** (string) - The unique identifier for the sent message. #### Response Example ```json { "status": "success", "message_id": "msg_12345abcde" } ``` ``` -------------------------------- ### Python 3 Example for /listtags Endpoint Source: https://secure.lekab.com/doc/AddressbookWebService.html A Python 3 script demonstrating how to interact with the /listtags endpoint. It shows how to send a POST request and process the JSON response. ```python import requests import json url = "https://api.lekab.com/listtags" headers = { "Content-Type": "application/json" } # Replace with your actual API key payload = { "apikey": "YOUR_API_KEY" } try: response = requests.post(url, headers=headers, data=json.dumps(payload)) response.raise_for_status() # Raise an exception for bad status codes tags = response.json() print(json.dumps(tags, indent=2)) except requests.exceptions.RequestException as e: print(f"An error occurred: {e}") except json.JSONDecodeError: print("Failed to decode JSON response.") ``` -------------------------------- ### Send SMS via GET Request Source: https://secure.lekab.com/doc/SMSRESTWebService.html Use this endpoint to send SMS messages via an HTTP GET request. Parameters are provided in the URL. The GET case allows either ISO-8859-1 or UTF-8 url-encoding of the message. ```http GET /send?to=%2B46701234567&from=MyService&text=Hello%20world! HTTP/1.1 Host: example.com ``` -------------------------------- ### List Tags via GET Source: https://secure.lekab.com/doc/AddressbookWebService.html Retrieve all tags in a specific address book using a GET request. ```HTTP GET https://secure.lekab.com/addressbook/api/listtags?U=doggykennel&P=testpass&A=646802966493470722 ``` -------------------------------- ### GET Callback Endpoints Source: https://secure.lekab.com/doc/SmsCallback.html Endpoints for receiving DR and MO callbacks via HTTP GET with URL-encoded parameters. ```APIDOC ## GET /sms/dr/callback ### Description Receives a delivery receipt (DR) callback via HTTP GET. ### Method GET ### Query Parameters - **id** (string) - Required - Unique message ID - **from** (string) - Required - Sender ID - **to** (string) - Required - Recipient ID - **status** (string) - Required - Delivery status - **statusmessage** (string) - Required - Status details - **timestamp** (string) - Required - Formatted timestamp YYYY-MM-ddTHH:mm:ss ## GET /sms/mo/callback ### Description Receives a mobile originated (MO) message callback via HTTP GET. ### Method GET ### Query Parameters - **id** (string) - Required - Unique message ID - **from** (string) - Required - Sender ID - **to** (string) - Required - Recipient ID - **message** (string) - Required - The message content - **timestamp** (string) - Required - Formatted timestamp YYYY-MM-ddTHH:mm:ss ``` -------------------------------- ### List Address Books via POST Request Source: https://secure.lekab.com/doc/AddressbookWebService.html Example of how to list available address books using a POST request, suitable for applications. Parameters are included in the JSON request body. ```http POST /listaddressbooks HTTP/1.1 Host: api.lekab.com Content-Type: application/json { "apikey": "YOUR_API_KEY" } ``` -------------------------------- ### POST /batchsend/list Request Example Source: https://secure.lekab.com/doc/SMSRESTBatchWebService.html Example of a POST request to the /batchsend/list endpoint for sending a batch of SMS messages. This format uses URL parameters for authentication and message details, with the message list in the HTTP body. ```http https://secure.lekab.com/restsms/api/batchsend/list?U=testuser&P=testpass&F=LEKAB&M8=Hall%C3%A5+d%C3%A4r!&BX=Sendout+123&DB=Y&DNN=Y&DNM=Y ``` ```text # this is Sendout 123 46701223344 447711223344;Hello there! 46702345678 46703344556 46704421232 ``` -------------------------------- ### Unset Endpoint DELETE Request Example Source: https://secure.lekab.com/doc/EmailToSmsAdminRESTWebService.html Example of a DELETE request to the /unset endpoint. Parameters are provided in the URL. ```http DELETE /unset?email=john.doe@example.com&domain=example.com HTTP/1.1 Host: sms.lekab.com ```