I can not filter based on the node resource 'url' property. I get a database error when trying to do this because it is meta data. When I print_r the array there is a 'getter callback' that I think needs to be used to somehow translate the value into something filterable.

What I want to do is say /node.json?url=http://www.mysite.com/my-url-alias

This will allow me to match url aliases on the client with those specified in Drupal.

I have managed to intercept the property and value then preprocess by doing a path lookup before it queries the db, changing the path to node ID... patch below..

I am sure there is a better way to do this? There are a couple of keys in node resources that throw DB errors if you try and filter against them

CommentFileSizeAuthor
#1 preprocess-filter-2388239-1.patch1.72 KBrcaracaus
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rcaracaus’s picture

rcaracaus’s picture

Issue summary: View changes
jaskaran.nagra’s picture

Just another way to do this (really depends on your personal taste which way you want to go with) is to add url aliases that point to node/[id].json.

For example: page/newpage.json ==> node/1.json

I have written a module, which is currently in sandbox stage, for this.
https://www.drupal.org/sandbox/jaskaran.nagra/2470461

Please review and help towards making it a full project.
https://www.drupal.org/node/2470483

Thanks,
Jask