Restrict API Product List of Drupal Portal

sonalishyam
Participant II

Hi,

I have a list of public API Products on edge but i do not want to display all of them on portal ,only some of the public API Products should get displayed on the drupal portal.

How do I add this restriction.Can I use management API for this?I was thinking to add a custom attribute on the API Product and use management API to search API Products having that custom attribute.

Can this be done on Drupal 7 or all the public API Products will get displayed on the portal.

Regards,

Sonalee Shyam

1 5 610
5 REPLIES 5

Yes it is possible.

For example I've written modules for Drupal7 that allow you to display only API Products that are deployed to a particular environment.

https://github.com/DinoChiesa/Edge-DevPortal-Filter-ApiProducts

Or an RBAC module

https://github.com/DinoChiesa/Edge-DevPortal-ApiProducts-Access-Extended

Or, display API products for Drupal users according to the user role, dependent upon a custom attribute on the product.

https://github.com/DinoChiesa/Edge-DevPortal-ApiProducts-Access-CustomAttr

But all of these are Drupal 7, and really you should be moving to Drupal 8.

I don't know if these kinds of things are available in D8, at this point.

@Chris Novak @Chris Novak may have some comment.

@Dino-at-Google We are currently defining our user roles and adding custom attributes to our products in order to be able to limit what is displayed to new Drupal portal users. Is there an advantage of doing this filtering logic in the portal modules vs.using an API? Being an API Developer without any experience with the Drupal portal, I'm thinking on creating a Target API that the portal can hit with information from the registration process. The API would determine the role based on that information and then interface with the Edge Management APIs to filter the product list given in the response. Are there advantages/disadvantages on where this logic is applied - portal vs. api? Thanks!

I think it's up to you, and where you are most comfortable deploying the logic.

Drupal is made to be extensible, and via modules it's pretty straightforward to do custom things. If you build a custom API that the portal invokes... then you're still going to need to do some customization in Drupal. Less, but still, some. So keep that in mind.

I am not a Drupal or PHP expert, but by following the example of some known good modules I was able to get pretty good at building customizations quickly.

Thank you Dino. Appreciate it



slope game

@lee86 Can you set some of the API Products 'private' or 'internal' instead? That will prevent them from showing up on the devportal. As far as I know, that shouldn't affect their functionality in any other ways.

As for the Drupal 8-based portal, it does have more fine grained control over which API Products to display, no additional modules are needed anymore. Like Dino says, you want to go this route if at all possible, there's many good reasons to make the switch.