question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom endpoint URLs for specific filter/action

See original GitHub issue

My 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:closed
  • Created 9 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
simpixelatedcommented, Dec 18, 2014

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.

0reactions
altschulercommented, Jan 28, 2017

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found