Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6628115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:05:36+00:00 2026-05-25T22:05:36+00:00

I have method getBuses on my RESTful webservice (Rails). That method needs to return

  • 0

I have method “getBuses” on my RESTful webservice (Rails). That method needs to return
me list of buses in JSON. But, when I sending request for “/getBuses.json” I
need to send

params = [NSDictionary 
dictionaryWithObjectsAndKeys: @"2011-08-16", @"datum", @"TRUE", 
@"fromSerbia", nil]; 

I’m posting params because I need filtered response (just for specific
tour on specific date).
Then, I expecting response like this:

{ 
  "buses" : [ { 
    "bus_number" : "1", 
    "created_at" : "2011-08-15T23:07:52Z", 
    "id" : 1, 
    "lat" : 44.815, 
    "long" : 20.4665, 
    "model" : "Setra", 
    "registar_number" : "123456", 
    "seats" : 50, 
    "tour_id" : 1, 
    "updated_at" : "2011-08-15T23:07:52Z" 
  }, { 
    "bus_number" : "2", 
    "created_at" : "2011-08-15T23:07:52Z", 
    "id" : 2, 
    "lat" : 44.812, 
    "long" : 20.465, 
    "model" : "Mercedes", 
    "registar_number" : "2234", 
    "seats" : 60, 
    "tour_id" : 1, 
    "updated_at" : "2011-08-15T23:07:52Z" 
  } ] 
} 

I just need NSArray with Bus objects.
Can you give me code example how to make this request and make object mapping with RestKit?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:05:36+00:00Added an answer on May 25, 2026 at 10:05 pm

    As I told you in the IRC Channel, in your RKClient instance you can use this method:

    (NSURL *)URLForResourcePath:(NSString *)resourcePath queryParams:(NSDictionary *)queryParams

    So you should do it like this:

    [objectManager.mappingProvider setMapping:busesMapping forKeyPath:@"buses"];
    
    params = [NSDictionary dictionaryWithObjectsAndKeys: @"2011-08-16", @"datum", @"TRUE", @"fromSerbia", nil];
    NSURL *someURL = [objectManager.client URLForResourcePath:@"/service/getLocations.json" queryParams:params];
    
    [objectManager loadObjectsAtResourcePath:[someURL absoluteString] delegate:self];
    

    That method builds a valid URL using the resourcePath and the parameters you give as parameter. And then you need to set it back using the absoluteString of the NSURL object. Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have class method that returns a list of employees that I can iterate
I have a method that can return either a single object or a collection
I have method in my N-layered application that returns List<Employee> . Below is the
Hii I have method in C#, I have to return multiple values from that
I have a short lock guarded section in a method (that serves the request
I have method that accept argument of Object type. But inside of method checked
We have method that looks like this : public String getCommandString(Object...args) { return this.code
I have method in a class that I need to make sure is only
I have a method that where I want to redirect the user back to
I have a method in my Python code that returns a tuple - a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.