Rest Service path

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by Chris87 on January 22, 2015 at 4:34pm

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

Categories: , , ,

Comments

Yes I think so.

Posted by monaw on January 22, 2015 at 6:15pm

(削除) 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

Posted by toemaz on January 29, 2015 at 8:30am

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:

AltStyle によって変換されたページ (->オリジナル) /