Thanks for the reply!
I don't have the exact code in front of me because I'm no longer at work, but I'm pretty sure I can recall the scenario. My function was returning an array. What I wanted to was use each key in the array as a 'track' element in my XML.
PHP Code:
function getTracks() {
return array('Track1', 'Track2', 'Track3');
}
The XML would return something like this obviously:
Code:
<key_0>Track1</key_0>
<key_1>Track2</key_1>
<key_2>Track3</key_2>
I've played around with it a few different ways and haven't found a solution other than just using simpleXML.
As for the optional parameters I got the idea from flickrs API. See this page:
Flickr Services: Flickr API: flickr.activity.userComments or
Flickr Services: Flickr API: flickr.interestingness.getList
For instance we have some tracks that are considered promotional tracks. A user may want to reserve their search to just these promotional tracks, or all tracks. By default I'd like it to be all tracks so it'd be nice if when a parameter is optional in a function that it could also be optional in the URI parameters.
Code:
public function getTracks($genreId, $promo=false)
could work as:
Code:
http://api.domain.com/v1/catalog/getTracks?genreId=1&promo=true
or
Code:
http://api.domain.com/v1/catalog/getTracks?genreId=1