I've gone down a different path. Not using Alamofire and just using the standard Swift networking. Postman allows the creation of multiple different language code blocks for a particular request so using the request it generates.
If anyone wants to know how to do it without Alamofire the answer is below.
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "OFF"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string:"http://192.168.x.x:8080/rest/items/BinarySensor")!,timeoutInterval: Double.infinity)
request.addValue("text/plain", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
return
}
semaphore.signal()
}
task.resume()
semaphore.wait()
I'm sure there is a better way but this way works.