let parameters = ["order": ["line_items": [
["variant_id": 18055889387589, "quantity": 11]]]] as [String : Any]
Alamofire.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.prettyPrinted, headers: headers).responseJSON { response in
switch response.result {
case .success:
print("response is ",response)
case .failure(let error):
print(0,"Error")
}
}
Asked
Active
Viewed 53 times
-3

luk2302
- 55,258
- 23
- 97
- 137

slash gamer
- 37
- 6
-
Take a look at this question and answers: https://stackoverflow.com/questions/31982513/how-to-send-a-post-request-with-body-in-swift – alitosuner Nov 18 '18 at 10:33
1 Answers
-2
let parameters = ["order": ["line_items": [
["variant_id": 18055889387589, "quantity": 11]]]] as [String : Any]
let jsonData = try! JSONSerialization.data(withJSONObject: parameters)
let jsonString = NSString(data: jsonData, encoding: String.Encoding.utf8.rawValue)
i think the problem is your parametres try this one

shynkhtb
- 61
- 1