Your API returns HTTP Error 401 Unauthorized. Does your server require HTTP authentication? If so, put the correct credentials in RKClient :
[[RKClient sharedClient] setUsername:myUsername]; [[RKClient sharedClient] setPassword:myPassword];
change
I believe that you have some fundamental problems when setting up RestKit. Consider the following example.
//in your appdelegate RKObjectManager* manager = [RKObjectManager objectManagerWithBaseURL:@"http://localhost:8080/activiti-rest/service"]; [[RKClient sharedClient] setUsername:@"kermit"]; [RKClient sharedClient] setPassword:@"kermit"]; // don't forget to create your mapping here RKObjectMapping *dataMapping = [RKObjectMapping mappingForClass:[Data class]]; [dataMapping mapKeyPath:@"myKeyPath" toAttribute:@"myAttr"]; [[manager mappingProvider] addObjectMapping: dataMapping];
then you can do just that.
-(void)loadData{ // fetch your mapping [RKObjectMapping *mapping = [[RKObjectManager sharedManager].mappingProvider objectMappingForClass:[Data class]]; //request data [[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"/process-definitions?start=0&size=10&sort=id&order=asc" objectMapping:mapping delegate:self]; }
First, you need to do the setup ( RKClient , matching, and RKObjectManager ) - you do this only once. They are single, so the settings are saved. I found that the best place to do this is AppDelegate - feel free to experiment, but be sure to tweak before making any queries.
When you are going to make any requests, just use the single [[RKObjectManager sharedManager] tag to load real objects.
In addition, I recommend that you read some documentation, for example. Object Mapping Guide
source share