Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alamofire post request with json encoding

How to send a post request with Alamofire with parameters as json having list of integers i.e, my server expects a dictionary whose value for the key is a list of integers.

I want the parameters as {"abc":[1,2,3]}. How to send this along post request of Alamofire in swift?

like image 354
kaushikdr Avatar asked Sep 11 '26 14:09

kaushikdr


1 Answers

Have you tried the following?

 var parameter  = ["abc": [1,2,3]]
 Alamofire.request(.POST, "http://www.yoursite.com/api" , parameters:parameter)

I would also look at the documentation over at Alamofire github documentation which is really helpful.

like image 52
Gokhan Dilek Avatar answered Sep 14 '26 06:09

Gokhan Dilek