I am developing an android app with kotlin and in this road i want to use a request to respond from restfull server ... Now look at my codes that i request it from server and its true but i don't know how to add the parameters of header to my request
fun sendCode(){
val URL = "https://RestfulSms.com/api/MessageSend"
val body : JSONObject = JSONObject()
val header : JSONObject = JSONObject()
body.put("Messages",messageText )
body.put("MobileNumbers",PhoneNumber )
body.put("LineNumber","***********")
body.put("SendDateTime","")
body.put("CanContinueInCaseOfError","false")
val request :JsonObjectRequest = JsonObjectRequest(Request.Method.POST,
URL,
body,
Response.Listener<JSONObject> { response ->
Log.e(tag, response.toString())
},
Response.ErrorListener{ error ->
Log.e(tag, error.message )
})
//request.headers.put("Content-Type","application/json")
header.put("x-sms-ir-secure-token",tokenKey)
queue.getCache().clear();
queue.add(request)
}