Rest Service path

Events happening in the community are now at Drupal community events on www.drupal.org.
Chris87's picture

Hi,
I have been playing with the Services module for a couple of days. According to REST API best practices, the GET URL paths I want to use are:
/buildings
/buildings/4
/buildings/4/rooms
/buildings/4/rooms/5

'Building' and 'room' are both content types, and '4' and '5', the node-ids.

Using the Services module, I can create the following calls:
/node/type=building
/node/4

And with the Services Views module, I can customise the path a little more:
/buildings

But the only way to get a specific building is by:
/buildings?nid=4

In order to enable the call path '/buildings/4' do I have to create a custom Services resource?

Thanks

Comments

Yes I think so.

monaw's picture

Yes I think so.

On second thought, I don't think that will work either. I have my own custom service for GET and our URL still contains ?parameter1=x&parameter2=y syntax.

Please post back if you manage to have the slash work for GET parameters also.

Good luck!

Yes

toemaz's picture

Indeed, with a custom Service resource you can do this. There are examples out there.

Services

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: