Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to initiate webservice request that expects JSON payload
    text
    copied!<p>I am JSON newbie and can't find any material on how to simulate JSON payload request.</p> <p>My ultimate goal is to be able to build an objective-c iOS app that will handle these request-response. I am aware of ASIHttprequest framework and the request-response mechanism it works around. </p> <p>However right now I have a webservice api which expects various json payloads and also provides response in json format. Here is an example:</p> <p>Example URL: </p> <p><code>https://mywebServiceURL/api/ApiKey/user/create</code></p> <pre><code>The ContentType header = “application/json”. </code></pre> <p>Payload: The PUT payload is a JSON dictionary, containing the following keyvalue pairs:</p> <pre><code>email screenName User’s screen name. password passwordConfirm phoneNumber (optional) User’s phone number (optional) picture A png file (64x64), encoded as a Base64 string (optional) </code></pre> <p>Now my questions:</p> <p>1 - how do I simulate this normally (outside ios, just for the sake of testing)? I searched google but can't find exactly what I need, I got curl.exe but it gives me same as what a browser gives, like method not allowed etc. But that's not the only thing I want. I want to play with various requests, supply values and take the api for a ride for sometime before I know how it really works for PUT, GET, POST etc.</p> <p>2 - what is the best way to incorporate such stuff into iOS? I already have ASIHttp for web requests and JSONKit for JSON handling included in my project. </p> <p>I have done this kind of stuff but with xml responses, get requests. JSON I am working for the first time. Just a pointer to an example stuff like this would be a great help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload