RKResponseDescriptor with custom uRL

What is the best approach in this case?

I've got this path to the milestones resource:

GET: {baseURL}/rest/v2/common/plans/{id}/milestones

and also this path to a different resource:

GET: {baseURL}/rest/v2/common/plans/{id}/statistics

In order to parse it properly I need to define the descriptor before any request is issued:

RKResponseDescriptor *responseDescriptor = 
    [RKResponseDescriptor responseDescriptorWithMapping:...

with a properly defined path. I considered responseDescriptor always as a static instance, that does not need to be recreated through the app lifetime (before that I was using the request's body).

But in the case of the path above the {id} changes path nature to the dynamic one. Should I always redefine the responseDescriptor whenever I send a request with a different {id}? Defining the path with {baseURL}/rest/v2/common/plans/ is ambiguous.

Using RK version 0.26.0.

Upvotes: 0

Views: 39

Answers (1)

Wain
Wain

Reputation: 119031

No, it's a path pattern for a reason:

@"/rest/v2/common/plans/:id/milestones"

Note also that using /rest/v2/common/plans/ is an incomplete path and won't be a match.

Upvotes: 1

Related Questions