function restws_resource_uri($resource, $id) {
// Avoid having the URLs aliased.
return url($resource . '/' . $id, array('absolute' => TRUE, 'alias' => TRUE));
}
restws_resource_uri() should follow the URI patterns that are defined by core or whatever module that defines the entity type. For example, for a taxonomy term, restws will return taxonomy_term/1.xml when the obvious URI that people expect is one following the core pattern: taxonomy/term/1.xml, in other words, people should be able to add a .xml or .json to the entity page they are looking at and get the entity in the format they've put at the end of the url.
Comments
Comment #1
goekhanc commentedis this the issue that causes imcompatibility between the url alias feature and restws?
is there any solution to this problem? I would like to set the accept header and send a get request to the alias and get the content in the right format. Does this work somehow?
Comment #2
goekhanc commentedI made an observation and I dont know if its a bug or a feature or whatever.
I am using url alias for nodes like /[type]/[node-title] and for taxonomy terms like /[taxonomy-name]/[term-name].
When I set a header "Accept: application/rdf+xml" and send a get request to the alias of the node, I get a correct rdf. But for the term I dont get the right content. To get an rdf representation of th term I need to use the path taxonomy_term/[term-id]. The problem then is that the rdf contains this taxonomy_ter/[term-id] as the uri of the described resource. Is there a reason why it works properly with the node alias but not with the term alias?