Rest web service

Discussion in 'iOS Programming' started by pankaj21c, Oct 25, 2011.

  1. pankaj21c macrumors newbie

    Joined:
    Apr 15, 2009
    #1
    I have to post the below data:
    Any idea, how to do using HTTP Post


    Request example:
    ------------------------------------------------------------------------
    {
    "authInfo": {
    "authBySession": {
    "session": "some string"
    },
    "authByEmail": {
    "email": "any string",
    "password": "yet another string"
    },
    "sessionType": "NoSession",
    "authByComcast": {
    "comcastUsername": "yet another string",
    "password": "some string"
    },
    "clientInfo": {
    "maxId": 0,
    "clientId": "some string",
    "timezone": 1001,
    "version": "some string",
    "contactDisplay": "firstName",
    "clientOS": "any string",
    "partnerId": "any string",
    "model": "some string",
    "clientIcon": {
    "hexEncoded": "0FB7"
    },
    "locale": "(unknown XSD element)",
    "clientName": "yet another string",
    "requiredFields": {
    "group": [
    {
    "fields": {
    "separated": {
    "value": [
    "some string",
    "yet another string"
    ]
    },
    "delimited": {
    "delimiter": "any string",
    "data": "any string"
    }
    },
    "type": "Contact"
    },
    {
    "fields": {
    "separated": {
    "value": [
    "some string",
    "some string"
    ]
    },
    "delimited": {
    "delimiter": "some string",
    "data": "some string"
    }
    },
    "type": "Contact"
    }
    ]
    },
    "manufacturer": "some string",
    "type": "Yahoo"
    }
    }
    }
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Looks like JSON. You should probably integrate a JSON library into your app.
     
  3. North Bronson macrumors 6502

    Joined:
    Oct 31, 2007
    Location:
    San José
    #3
    Apple gives you a JSON serializer in Foundation. Look for NSJSONSerialization. Apple also gives you sample code for HTTP POSTs. Look for SimpleURLConnections.
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    True, but only available in iOS 5.0 and later.
     
  5. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #5
    JSONkit could help you for other iOSes then 5.x
     
  6. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    There are a few third-party libraries at one's disposal, including TouchJSON and json-framework as well. But, you'll want to pick one that is supported across all the versions of iOS you are planning your app to run on rather having to integrate multiple libraries. Which is what you meant, right jnoxx? ;)
     
  7. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #7
    Correct, but i was too lazy to type it all out like a boss (you).
    The thing is, I allways tried to cross develop for iOS 3.X 4.X and now 5.X
    But since 5.X i'm skipping 3.X because it's just a a bunch of (insert random word) to support it all.
    Ah well, i'd say, have fun with parsers *cough*
     
  8. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #8
    Same here: only 4.0 or higher. But at what point can we reasonably abandon 4.x as well?
     
  9. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #9
    I guess iOS5 my dear Dejo.
    Since most people I know, don't wonna upgrade to iOS5, i'm speechless. but well..
    Most people with 3GS don't wonna upgrade, because they think it'll be too slow.
    So 4.x and 5.x it is..
     
  10. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #10
    I don't understand this answer.
     
  11. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #11
    I meant iOS6, Auwch, makes me look like a turd.
    But, You allways stop supporting when there is only 1x new iOS version.
     

Share This Page