tranvutuan
tranvutuan

Reputation: 6109

how to pass an array as parameter when making a request to server,iphone

Given :

a chunk of books and each book will associated with unique id

Scenario :

user can order more than one book

Goal :

   making an NSMutableURLRequest and send this request to server and let server know which books 
    are being picked 

Question :

  For example, user A will choose 3 books whose id are a, b ,c. How can I send an array 
  containing with these id in the request so that server can know that user A are ordering these books

Upvotes: 1

Views: 635

Answers (1)

Pochi
Pochi

Reputation: 13459

Depends on the format your server is expecting, IF for example you use RESTful then you would have to chose between post or get and based on that build your query. If you do use restful then use RestKit API and use the params property. (or you can build them urself directly with the basic ios api). You can send your data in JSON format as well but the server would have to know how to parse it.

Upvotes: 1

Related Questions