1

I'm building a web service for a mobile app (Sencha Touch), and I'm hung up on the right way to approach this (as subjective as "right" can be).

Here's my situation.
I'm consuming a google calendar and pushing it via JSON to the mobile app. I have two options here, and I'm not sure how to go about this.

Option 1 is to pass the calendarID via a querystring. This allows us to swap out the calendarID in the mobile app config if need be.

Example:
http://example.com/calendar/[email protected]&callback=asdf

Option 2 is to use a config file on the web service to update the calendarID

Example:
http://example.com/calendar/events?callback=asdf

Is it wise to have the config stick with the web service, or better to be able to pass the config from the mobile app?

[note] the calendar is shared among all users

2 Answers 2

1

Typically, in a RESTful system, you should not rely on any public data other than what is passed back to you. However, it sounds like this is more of an implementation (private) detail that the public users will not care about. So, I see no problem storing this in a config as it sounds like it will be the same on every request.

That is my take on it, at least.

Sign up to request clarification or add additional context in comments.

2 Comments

Yeah, this is a private API. So are you referring to "no problem storing this in a config" in the App or in the API?
I am referring to storing the config in the API. If you have to store it in the App, then that is information being passed back and forth and should be in the parameters.
1

Of the two options, option one would be considered more inline with REST principles.

URIs are intended to be unique identifiers for resources. If you did option two, both user A and user B would have the same URI for their calendars (http://example.com/calendar/events?callback=asdf) even though they have two different calendars.

Your app would then be relying on the state of a config file to determine how to respond to this URI. REST typically advocates statelessness.

3 Comments

While I agree entirely with what you are saying, I think you might have misunderstood the description (or I did :)). The calendarid is a back-end implementation detail where it is the same for every user. If I did misunderstand, then you are correct, as I explained in my above answer :)
Got it. It wasn't clear that only one calendar was used on the backend from the question. If its an application wide setting, then you certainly don't want it to be changed by the end user (that'd be analogous to letting the end user select the db name as part of the URI), so yeah option two is the way to go. Good catch.
Yeah, sorry. It's an app for our publics, and it shows a single calendar to everyone. I should have explained that better.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.