Search code examples
iosheaderafhttpclient

AFHTTPClient putpath method


I have problem with my below funct:

NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
                       sportid, @"sport",
                        country,  SC_PAIS,
                        team,     SC_TEAM,
                        token,    SC_TOKEN,nil];

    [[SCHTTPClientServer sharedClient] setParameterEncoding:AFJSONParameterEncoding];
       [[SCHTTPClientServer sharedClient] putPath:@"calendarelemfilters/teams" parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
            NSLog(@"RESPonsee %@",responseObject);

        } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
            NSLog(@"ERROR %@",[error localizedDescription]);

        }];

this is my code. I have below error- How can i fix it?

Thanks

"""RESPONSE STRING: <>Apache Tomcat/7.0.26 - Error report

HTTP Status 400 - Required String parameter 'token' is not present

type Status report

message Required String parameter 'token' is not present

description The request sent by the client was syntactically incorrect (Required String parameter 'token' is not present).

Apache Tomcat/7.0.26

2013-09-19 13:10:24.254 ISportsCal[834:907] ERROR Expected status code in (200-299), got 400"""


Solution

  • I have fixed it with postPath. and also i setted "setparameter encoding" as below.

    [[SCHTTPClientServer sharedClient] setParameterEncoding:AFFormURLParameterEncoding];
    

    Thanks