I am testing a GET request
using Postman
. In Params tab, there is Path Variable
with an "id" key
and a value
. You can see the URL
of GET request
in this screenshot below, there is url path
/:id in the end of the URL
endpoint.
How to perform GET request
with Path Variables params as such in Swift?
Thanks
In Params tab, there is 'Path Variable' with an "id" key and a value
This means you can replace this :/id
with your actual id value in url.
func getRequestAPICall() {
let apiUrl : String = "your_server_url" + "/" + "yourIdValueHere"
Alamofire.request(apiUrl, method: .get, encoding: JSONEncoding.default)
.responseJSON { response in
print(response)
}
}