curl into Alamofire
func sendRequestRequest() {
/**
Request
get https://parseapi.back4app.com/classes/category
*/
// Add Headers
let headers = [
"X-Parse-Master-Key":"qTJ3eatgZppvAWqkb82WsCoqG9MqRog2MBXqRHHv",
"X-Parse-Application-Id":"ad383bxkAmwAgKgPEqZHjewleWi2bLmNTlctBuky",
"Content-Type":"text/plain; charset=utf-8",
]
// Fetch Request
//Alamofire.request("https://parseapi.back4app.com/classes/category?where=%7B%22parentID%22%3A%7B%22%24exists%22%3Afalse%7D%7D", method: .get, headers: headers) // SUCCESS
//Alamofire.request("https://parseapi.back4app.com/classes/category?where=%7B%22parentID%22:%7B%22$exists%22:false%7D%7D", method: .get, headers: headers) // .urlQueryAllowed - SUCCESS
//Alamofire.request("https:%2F%2Fparseapi.back4app.com%2Fclasses%2Fcategory%3Fwhere=%7B%22parentID%22:%7B%22$exists%22:false%7D%7D", method: .get, headers: headers) // .urlHostAllowed - FAILURE
//Alamofire.request("https://parseapi.back4app.com/classes/category?where=%7B%22parentID%22:%7B%22$exists%22:false%7D%7D", method: .get, headers: headers) //.urlFragmentAllowed - SUCCESS
Alamofire.request("https://parseapi.back4app.com/classes/category?where=%7B%22parentID%22:%7B%22$exists%22:false%7D%7D", method: .get, headers: headers) // .urlHostAllowed но только к той части строки, которая после знака вопроса - SUCCESS
.validate(statusCode: 200..<300)
.responseJSON { response in
if (response.result.error == nil) {
debugPrint("HTTP Response Body: \(response.data)")
}
else {
debugPrint("HTTP Request failed: \(response.result.error)")
}
}
}