Created
September 28, 2016 04:51
-
-
Save yellowred/0d048c206e83dcc55c16f12b1a50cdc2 to your computer and use it in GitHub Desktop.
Save array of object in Loopback using Swift 3 + Alamofire
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let financials = [ | |
[ | |
"amount": 777, | |
"date": "2016-09-24", | |
"rate": 1, | |
"text": "string", | |
"category": "string", | |
"uuid": "string", | |
], | |
[ | |
"amount": 888, | |
"date": "2016-09-24", | |
"rate": 1, | |
"text": "string", | |
"category": "string", | |
"uuid": "string", | |
] | |
] | |
let data = try! JSONSerialization.data(withJSONObject: financials, options: []) | |
let jsonBatch:String = String(data: data, encoding: .utf8)! | |
Alamofire.request(API_URL, method: .post, parameters: [:], encoding: jsonBatch, headers: [:]).responseJSON { response in | |
debugPrint(response) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment