Custom endpoint URLs for specific filter/action
See original GitHub issueMy endpoints are:
/articles # all articles
/users/:id/articles # all articles by user
I want to use the same defined resource for both endpoints, but with a different filter. I see that endpoints can’t be changed after definition, even when sending a new one as an option.
Article.findAll() // /articles
Article.findAll({}, { endpoint: "/users/" + userId + "/articles" }) // /users/:id/articles
How about adding to DSHttpAdapterProvider
http methods overriding option, exactly like options.baseUrl || resourceConfig.baseUrl
but for endpoint
?
DSUtils.makePath(
options.baseUrl || resourceConfig.baseUrl, // exists
options.endpoint || resourceConfig.endpoint // currently only resourceConfig.endpoint
)
Issue Analytics
- State:
- Created 9 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Using custom actions for filtering and navigating
Filter action – Filter data included in visual or in the entire sheet. · Navigation actions – Enable navigation between different sheets in...
Read more >Adding Custom Endpoints | REST API Handbook
Namespaces are the first part of the URL for the endpoint. They should be used as a vendor/package prefix to prevent clashes between...
Read more >Filters in ASP.NET Core | Microsoft Learn
Filters in ASP.NET Core allow code to run before or after specific stages in the request processing pipeline. Built-in filters handle tasks such ......
Read more >what's the proper way to add Spring Security filter only for ...
I am trying to add custom filter to only specific URL, however the filter get applied to every request, regardless of URL and...
Read more >URL filter - Fortinet Documentation Library
By adding specific URLs with patterns containing text and regular expressions, ... URL Filter Action ... To customize the URL web page blocked...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for the quick response! I think I’m actually looking to use the relations functionality. For example, my API endpoint is ‘posts/:postId/comments’. I’m probably doing something wrong, but it seems like using the DS.find() method requires an ID for the comment. Unfortunately the API returns a 404 if that extra parameter is defined (‘posts/1/comments/1’ returns 404).
http://plnkr.co/edit/If17RKyeUaGZIssb9KeG?p=preview
EDIT: I used the same relations structure from issue #162 and was able to solve my problem… sort of. On first load I get the warning “DS.findAll(mls, params[, options]): response is expected to be an array!”. But the next time I call loadRelations it gets the data from the cache.
How is this done in v3?
Edit: FWIW this is what I was looking for: http://www.js-data.io/v3.0/docs/js-data-http#http-actions