can a dev portal show products from more than one env? ?

Not applicable

How does the Dev Portal filter products for the developer to select?

Let's say we have 3 environments - internal, public, private. All are effectively "production" runtimes.

We want to publish various products that span all 3 environments - and show the products depending upon a users affiliation (employee, partner, public).

A similar scenario might be 3 environment representing 3 business units. A single developer portal would show all products for all BUs.

Basically, looking for more information on how the product / env relationship is enforced.

Is this possible out the box?

If not, does anyone have an effective strategy to enable functionality via a custom module?

Solved Solved
1 1 190
1 ACCEPTED SOLUTION

Not applicable

Out of the box, Dev Portal ignores Edge environments when generating a list of available API products. However, it does expose a hook (`hook_apiproduct_list_alter`) which allows custom code to change this list.

Up until today, there was a minor bug which prevented environment and custom-attribute information from the API products from being included in the list of API products, but as of release 16.05.02.00 this has been fixed.

Here's an example implementation:

function mymodule_apiproduct_list_alter(array &$api_products, $account = NULL) {
  foreach ($api_products as $id => $api_product) {
    if (!in_array('prod', $api_product->environments)) {
      unset($api_products[$id]);
    }
  }
}

View solution in original post

1 REPLY 1

Not applicable

Out of the box, Dev Portal ignores Edge environments when generating a list of available API products. However, it does expose a hook (`hook_apiproduct_list_alter`) which allows custom code to change this list.

Up until today, there was a minor bug which prevented environment and custom-attribute information from the API products from being included in the list of API products, but as of release 16.05.02.00 this has been fixed.

Here's an example implementation:

function mymodule_apiproduct_list_alter(array &$api_products, $account = NULL) {
  foreach ($api_products as $id => $api_product) {
    if (!in_array('prod', $api_product->environments)) {
      unset($api_products[$id]);
    }
  }
}