Skip to content

Instantly share code, notes, and snippets.

@Codesleuth
Created May 2, 2014 10:16
Show Gist options
  • Save Codesleuth/6444130f4f67c513eda3 to your computer and use it in GitHub Desktop.
Save Codesleuth/6444130f4f67c513eda3 to your computer and use it in GitHub Desktop.
package main
import dispatch._, Defaults._
object DispatchMessage extends App {
def DispatchRequest(reference: String, body: String, to: String): scala.xml.Elem = <messages>
<accountreference>{ reference }</accountreference>
<message>
<to>{ to }</to>
<body>{ body }</body>
</message>
</messages>
val messageBody = DispatchRequest("EX0012345", "hello world!", "447896541230").toString()
val request = url("http://api.esendex.com/v1.0/messagedispatcher").as("[email protected]", "password").POST << messageBody
val requestPromise = Http(request OK as.xml.Elem)
val result = requestPromise()
println(result)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment