I am still learning the programming in Swift, I have successfully consumed services with Alamofire, but now I face the following problem, I have a service where I sent 2 json in the URL and I really have no idea how to send this data, I have seen some examples but I still can not understand. Already configure the security policy however the problem is the same
This is my URL {{url}}apps/Search2/{"search":"","user":14,"category":2,"numero":0,"subgroup":-1,"tipo":-1,"subcategory":-1,"cantidad":0}/{"max":5000,"minimo":1}
and this is what I have been trying
static func loadMenuWithFilter(search : String, userId : Int, categoryId : Int ){
let menu : Parameters = ["search" : search, "user" : userId, "category" : categoryId, "numero" : 0, "subgroup" : -1, "tipo" : -1, "subcategory" : -1,"cantidad" : 0]
Alamofire.request(AlamofireConstants.MENU_FILTER, method: .get, parameters: menu, encoding: JSONEncoding.default)
.validate(statusCode: 200..<300).responseData { response in
switch response.result {
case .failure(let error):
print("error ==> \(error)")
case .success(let data):
do{
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
let result = try decoder.decode(Menu.self, from: data)
print("MenuController \(result)")
} catch {
print("MenuController \(error)")
}
}
}
}
obviously I have not had successful because I'm sure it's not the right way to do it. My service response is 404