{"_id":"581c5ef0bb096b0f002e6144","version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":27,"createdAt":"2015-02-23T17:30:32.501Z","releaseDate":"2015-02-23T17:30:32.501Z","categories":["54eb63b959b1172100334faf","54eb63b959b1172100334fb0","54eb63b959b1172100334fb1","54eb63b959b1172100334fb2","54ed8dd4ab373e2300f50eae","54ed99b2ab373e2300f50ede","55153a6de68daa2f00cff838","551546edbc466623002afe72","5515472ac28d6125001b8884","55154749c28d6125001b8885","555d9b4106dfec0d00d38ea7","5613e06e433e5735007c7708","5624bbb785a31117001c5403","56669e857cc81e0d00253f8e","568b8d837a42220d00498311","56a632277ef6620d00e2f18a","56d8147c3eb4dd0b00201aac","57a9ce2fac6db30e000d7efd","57a9cf4e944ea60e00dc3f74","58172386715dce0f00da4aa0","582dc59ee1b8692300c0dd03","589b19b4fec2730f0082e040","58b04a023529383900a759b5","58b92d1598157a0f004869bf","592e7685c58275000f20174f","59392839e376d4002f8a0474","59393064e376d4002f8a05a1","5947ae0d4005e2000f3a4fec","594a74df1d1de5001ab3517a","5954bc387a147f001b918915"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"__v":1,"category":{"_id":"551546edbc466623002afe72","pages":["551549c0bc466623002afe76","55154afbc859ac2f0001b486","55154daec859ac2f0001b48b","55154f36bc466623002afe7c","551550c5e68daa2f00cff84c","551551d4f854a31900368737","551552e7c859ac2f0001b494","551be4e3a0ee622b0087f69e","5527acc447b71d0d0044e6cd","552f84ad633a5b0d00e99daf","5537533df162750d00bbf7d0","554b3ffd6b448d0d00646d79","55506416fa289c0d0075e4f0","5550aaea00420e0d00d13113","55545865b450630d00041d80","55546906f9a7871700ef8e3c","555c4bf87e271d0d00f3c8c4","5564318c1fa8002300ea4bb0","556ffbd5910c090d00c432b6","557019f4cc189a21001ab258","55703aefcc189a21001ab2a3","5575a3c60b81dc230069c910","558ab69575eaf50d004e4cf3","55b0b41fb3171b3700b1539a","55ba2e48d72d1e1900276ac1","55ba45c804775a2f00628101","55c0b789344dc40d00f55933","55c0b8c837298d0d00088d88","55c0c095344dc40d00f55960","55d43e05b49ab11900328e2e","55d72c8c60fc730d00fc2738","55e6c564d678ad17001589ac","55e9b7780c9b420d0042b275","55f7cf2de32e9b0d00a2d4b6","56094efea7b2590d0089eb95","5613cdbeecbebc21003fa179","5613d8de6a092921004c30b8","5613de7c443514170060dbb6","5613e02823ecf6350009eefc","5613e4271db46e2100e142ad","5614d73c8113d20d00082e3e","561e11ae50e0a62100955946","561e2008efcf8217003adf77","5620f184b244890d001868e0","5620feb740e2c30d0002a899","562105ce40e2c30d0002a8a3","56210b3340e2c30d0002a8b3","56210c74b244890d0018690e","56249a0372ac510d00e49149","56249df185a31117001c53de","56249f0c85a31117001c53e1","5624a9e7c4bf501700bc5ec8","5624b29806e8040d005ed6a0","562507435a86b42300946324","563877854bfb360d00a463c1","5639e0f91846790d0089529a","565327d17d29410d004a0835","565457df04feff210074b17d","56545821ec189235002967af","565485099c4c6d0d00aeda02","5666f1f1f672550d000851ad","566abc7b74d574170070b700","566ad3c7c7c3cd1700265d14","566aede7b5ccc20d00817f71","566aef3147ebaf1900fe65d6"],"project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","__v":65,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-03-27T12:02:53.314Z","from_sync":false,"order":11,"slug":"advanced-tutorials","title":"Advanced tutorials"},"parentDoc":null,"project":"54eb50e5615ffc1900305a16","user":"54eb4fdedf7add210007b29b","updates":["581ca02b2d0f7225009a9b70"],"next":{"pages":[],"description":""},"createdAt":"2016-11-04T10:12:00.231Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":true,"order":8,"body":"Owning custom made applications tailored for specific requirements of the single organization is an expensive privilege not many can afford. Using third party software solutions for your business needs is a more common case for most of the businesses today. Those **\"generic\" applications** are usually highly configurable in order to cover the widest range of use cases. No matter how clever the application is designed, it seems like there is always at least one crucial feature missing.\n\nIf you happen to have one of those applications, you probably have options to configure different workflows and triggers. Very often the application also offers some integration options too. Due to it's generic nature, the application has to cover a variety of integration scenarios and also keep a certain level of simplicity to remain intuitive and usable. This trade-off between options and usability can result in a solution with **limited integration possibilities**.\n\nIntegrating our [REST API method for sending SMS](/docs/fully-featured-binary-message) in such an application may be impossible since you have to configure the request type, headers and body model. This is something that is usually handled by developers and this type of application will not allow you to write custom code. In best case scenario it will provide you with a **single input** to enter URL of the service you want to trigger, and that's it.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Simple SMS with basic parameters\"\n}\n[/block]\nWith this single input problem in mind, we have designed a method which allows you to **send SMS in a single line** of the HTTP request:\n\n```\nhttps://api.infobip.com/sms/1/text/query?username=myUsername&password=myPassword&to=41793026727&text=Message text\n```\nThis is all you need to send a message. You can even send this message through your web browser address bar, the same way you would type some address to open a web page. Now, this is something that you could put into your application without writing any code! \n\nResponse will be identical to fully featured SMS response:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"bulkId\\\": \\\"1478260834465349757\\\",\\n  \\\"messages\\\": [\\n    {\\n      \\\"to\\\": \\\"41793026727\\\",\\n      \\\"status\\\": {\\n        \\\"groupId\\\": 1,\\n        \\\"groupName\\\": \\\"PENDING\\\",\\n        \\\"id\\\": 7,\\n        \\\"name\\\": \\\"PENDING_ENROUTE\\\",\\n        \\\"description\\\": \\\"Message sent to next instance\\\"\\n      },\\n      \\\"smsCount\\\": 1,\\n      \\\"messageId\\\": \\\"844acc75-e5c6-4a21-a7e3-444c412c385b\\\"\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"XML response format\",\n  \"body\": \"Default response format is JSON, however if you would like to receive XML as a response instead, you may specify the format **.xml** extension at the end of the method base URL, such as:\\n\\n`https://api.infobip.com/sms/1/text/query.xml`\"\n}\n[/block]\nThere is one more catch. You will probably need to replace hard-coded values like phone number and message text with placeholders unless you want to send the same message every time to the same recipient. Placeholder names will be provided by the application system you are using. What you need to understand is where to put those placeholders.  Let's break down our example request in several lines so we could examine it closely:\n\n```\nhttps://api.infobip.com/sms/1/text/query?\nusername=myUsername\n&password=myPassword\n&to=41793026727\n&text=Message text\n```\n\nThe first line is API endpoint and this never changes. The question mark at the end represents begging of the **query string parameters**. It's a system of **key / value pairs** separated by symbol `&`. It's quite clear now what the values are and which values you will need to replace by a value placeholder.\n\n```\n&to=%phoneNumber%\n&text=%message%\n```\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Value placeholders\",\n  \"body\": \"Placeholder names and format will vary depending on your application. Refer to your application documentation for instructions.\"\n}\n[/block]\nHere is the final result:\n```\nhttps://api.infobip.com/sms/1/text/query?username=myUsername&password=myPassword&to=%phoneNumber%&text=%message%\n```\n\nYour application should now dynamically send different messages to different recipients by dynamically replacing placeholders with recipient phone number and message.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Key / value pairs\",\n  \"body\": \"It's important to understand how to properly format the query string in order to make it work properly. Here is the rule that must be followed:\\n\\nhttps://api.infobip.com/sms/1/text/query `?` key `=` value `&` key `=` value `&` key `=` value\\n\\nSort order of key / value pairs is not important as long as it's well formatted. If your application supports placeholders, you should use it to replace values only!\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Multiple recipients\"\n}\n[/block]\nSending messages to multiple recipients at once is also supported, as long as they all get the same message. URL is basically the same as simple SMS The only difference is in `to` key where you need to separate recipients by comma. \n\n```\nhttps://api.infobip.com/sms/1/text/query?username=myUsername&password=myPassword&to=41793026727,41793026834&text=Message text\n```\n\nCloser look:\n```\n&to=41793026727,41793026834\n```\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Fully featured SMS\"\n}\n[/block]\nYou can use this method to send an SMS with almost all features of our standard [fully featured SMS](/docs/fully-featured-textual-message)\n\nOptional key value pairs:\n```\n&from=InfoSMS\n&flash=true\n&transliteration=TURKISH\n&languageCode=TR\n&intermediateReport=true\n&notifyUrl=https//www.example.com\n&notifyContentType=application/json\n&callbackData=callbackData\n&validityPeriod=86400000\n&track=SMS\n&processKey=A612ECB0F62799FDC12EC50D2A6F0472\n&trackingType=Custom+field+test\n```\n\nRefer to our fully featured SMS documentation for an explanation of each parameter.\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Important!\",\n  \"body\": \"Please use this method for sending messages only when you don't have the option to integrate via [fully featured SMS method](/docs/fully-featured-textual-message). \\n\\nPlease keep in mind:\\n* This method does not support API key authorization. You are sending the username and password over the network which is less secure than using API key\\n* Your application should support URL encoding of your requests. Messages that are not properly formatted may be delivered with incorrectly encoded text or not delivered at all.\"\n}\n[/block]","excerpt":"Send SMS by including all required parameters in the URL using HTTP GET request.","slug":"sms-over-url-parameters","type":"basic","title":"SMS over URL parameters"}

SMS over URL parameters

Send SMS by including all required parameters in the URL using HTTP GET request.

Owning custom made applications tailored for specific requirements of the single organization is an expensive privilege not many can afford. Using third party software solutions for your business needs is a more common case for most of the businesses today. Those **"generic" applications** are usually highly configurable in order to cover the widest range of use cases. No matter how clever the application is designed, it seems like there is always at least one crucial feature missing. If you happen to have one of those applications, you probably have options to configure different workflows and triggers. Very often the application also offers some integration options too. Due to it's generic nature, the application has to cover a variety of integration scenarios and also keep a certain level of simplicity to remain intuitive and usable. This trade-off between options and usability can result in a solution with **limited integration possibilities**. Integrating our [REST API method for sending SMS](/docs/fully-featured-binary-message) in such an application may be impossible since you have to configure the request type, headers and body model. This is something that is usually handled by developers and this type of application will not allow you to write custom code. In best case scenario it will provide you with a **single input** to enter URL of the service you want to trigger, and that's it. [block:api-header] { "type": "basic", "title": "Simple SMS with basic parameters" } [/block] With this single input problem in mind, we have designed a method which allows you to **send SMS in a single line** of the HTTP request: ``` https://api.infobip.com/sms/1/text/query?username=myUsername&password=myPassword&to=41793026727&text=Message text ``` This is all you need to send a message. You can even send this message through your web browser address bar, the same way you would type some address to open a web page. Now, this is something that you could put into your application without writing any code! Response will be identical to fully featured SMS response: [block:code] { "codes": [ { "code": "{\n \"bulkId\": \"1478260834465349757\",\n \"messages\": [\n {\n \"to\": \"41793026727\",\n \"status\": {\n \"groupId\": 1,\n \"groupName\": \"PENDING\",\n \"id\": 7,\n \"name\": \"PENDING_ENROUTE\",\n \"description\": \"Message sent to next instance\"\n },\n \"smsCount\": 1,\n \"messageId\": \"844acc75-e5c6-4a21-a7e3-444c412c385b\"\n }\n ]\n}", "language": "json" } ] } [/block] [block:callout] { "type": "info", "title": "XML response format", "body": "Default response format is JSON, however if you would like to receive XML as a response instead, you may specify the format **.xml** extension at the end of the method base URL, such as:\n\n`https://api.infobip.com/sms/1/text/query.xml`" } [/block] There is one more catch. You will probably need to replace hard-coded values like phone number and message text with placeholders unless you want to send the same message every time to the same recipient. Placeholder names will be provided by the application system you are using. What you need to understand is where to put those placeholders. Let's break down our example request in several lines so we could examine it closely: ``` https://api.infobip.com/sms/1/text/query? username=myUsername &password=myPassword &to=41793026727 &text=Message text ``` The first line is API endpoint and this never changes. The question mark at the end represents begging of the **query string parameters**. It's a system of **key / value pairs** separated by symbol `&`. It's quite clear now what the values are and which values you will need to replace by a value placeholder. ``` &to=%phoneNumber% &text=%message% ``` [block:callout] { "type": "warning", "title": "Value placeholders", "body": "Placeholder names and format will vary depending on your application. Refer to your application documentation for instructions." } [/block] Here is the final result: ``` https://api.infobip.com/sms/1/text/query?username=myUsername&password=myPassword&to=%phoneNumber%&text=%message% ``` Your application should now dynamically send different messages to different recipients by dynamically replacing placeholders with recipient phone number and message. [block:callout] { "type": "info", "title": "Key / value pairs", "body": "It's important to understand how to properly format the query string in order to make it work properly. Here is the rule that must be followed:\n\nhttps://api.infobip.com/sms/1/text/query `?` key `=` value `&` key `=` value `&` key `=` value\n\nSort order of key / value pairs is not important as long as it's well formatted. If your application supports placeholders, you should use it to replace values only!" } [/block] [block:api-header] { "type": "basic", "title": "Multiple recipients" } [/block] Sending messages to multiple recipients at once is also supported, as long as they all get the same message. URL is basically the same as simple SMS The only difference is in `to` key where you need to separate recipients by comma. ``` https://api.infobip.com/sms/1/text/query?username=myUsername&password=myPassword&to=41793026727,41793026834&text=Message text ``` Closer look: ``` &to=41793026727,41793026834 ``` [block:api-header] { "type": "basic", "title": "Fully featured SMS" } [/block] You can use this method to send an SMS with almost all features of our standard [fully featured SMS](/docs/fully-featured-textual-message) Optional key value pairs: ``` &from=InfoSMS &flash=true &transliteration=TURKISH &languageCode=TR &intermediateReport=true &notifyUrl=https//www.example.com &notifyContentType=application/json &callbackData=callbackData &validityPeriod=86400000 &track=SMS &processKey=A612ECB0F62799FDC12EC50D2A6F0472 &trackingType=Custom+field+test ``` Refer to our fully featured SMS documentation for an explanation of each parameter. [block:callout] { "type": "danger", "title": "Important!", "body": "Please use this method for sending messages only when you don't have the option to integrate via [fully featured SMS method](/docs/fully-featured-textual-message). \n\nPlease keep in mind:\n* This method does not support API key authorization. You are sending the username and password over the network which is less secure than using API key\n* Your application should support URL encoding of your requests. Messages that are not properly formatted may be delivered with incorrectly encoded text or not delivered at all." } [/block]