devconnect_developer_apps_get_api_products??

I'm attempting to call devconnect_developer_apps_get_api_products(true, true, org) to get all products. I would expect that it would also return the associated proxies as well but the proxies array is null. Is there a way to also return the proxies?

[Public APIs] => Drupal\devconnect_developer_apps\ApiProductEntity Object
        (
            [orgName] => nwie
            [apiResources] => Array
                (
                )

            [approvalType] => 0
            [createdAt] => 0
            [createdBy] => 
            [modifiedAt] => 0
            [modifiedBy] => 
            [description] => APIs for general consumption
            [displayName] => Public APIs
            [environments] => Array
                (
                    [0] => dev
                    [1] => prod
                    [2] => stage
                    [3] => test
                )

            [name] => Public APIs
            [proxies] => Array
                (
                )

            [quota] => 0
            [quotaInterval] => 0
            [quotaTimeUnit] => 
            [scopes] => Array
                (
                )

            [attributes] => Array
                (
                    [access] => public
                )

            [isPublic] => 1
        )
Solved Solved
1 6 376
1 ACCEPTED SOLUTION

@Dave , Great find, Thank you for highlighting this issue,

It's a bug & information is missing when you enable the API Product cache in developer portal. Navigate to "admin/config/devconnect/apps" and disable the cache. You should see API Proxies associated with API Product in below function call output.

$all_api_products = devconnect_developer_apps_get_api_products(TRUE);
drupal_set_message("<pre>" . print_r($all_api_products, 1) . "</pre>");<br>

Also, Instead of above code, Use below code which should give you information you need irrespective of above cache setting,

$api_products = entity_load('api_product', array(), array(
      'orgName' => $org,
      'show_private' => TRUE
  ));


drupal_set_message("<pre>" . print_r($api_products, 1) . "</pre>");

In former case, Looks like after pushing the API call data to Drupal Cache & Information is retrieved from cache this information is lost. I can dig deeper when i get time.

You should be all set with above entity_load function. Hope it helps. Keep us posted moving forward if any.

View solution in original post

6 REPLIES 6

Good question. I don't know the answer to that off the top of my head. It's possible that the devconnect module does not copy through the list of proxies, by default.

@Anil Sagar might know.

But can you check, to see, via the Administrative API, that the API product actually does have API proxies configured for it?

** After looking through the code, in ...profiles/apigee/modules/custom/devconnect/devconnect_developer_apps/devconnect_developer_apps.module ... I don't see the list of proxies being copied through to the Entity. The ApiProductEntity has a field for the list of proxies, but that field is not filled with the data retrieved.

But this actually makes sense, because...in Apigee Edge, the consumable unit is the Api Product, not the API Proxy.

So I would like to ask you: what problem are you really trying to solve?

Why do you think you need to expose the list of proxies to the consuming developer?

Hi Dave,

1- you can also get the products by calling this function in your custom module.

 $api_products = devconnect_developer_apps_get_api_products();

2-you can use the following API Management to get the proxies

https://api.enterprise.apigee.com/v1/organizations/orgName/apiproducts/productname

@Dave , Great find, Thank you for highlighting this issue,

It's a bug & information is missing when you enable the API Product cache in developer portal. Navigate to "admin/config/devconnect/apps" and disable the cache. You should see API Proxies associated with API Product in below function call output.

$all_api_products = devconnect_developer_apps_get_api_products(TRUE);
drupal_set_message("<pre>" . print_r($all_api_products, 1) . "</pre>");<br>

Also, Instead of above code, Use below code which should give you information you need irrespective of above cache setting,

$api_products = entity_load('api_product', array(), array(
      'orgName' => $org,
      'show_private' => TRUE
  ));


drupal_set_message("<pre>" . print_r($api_products, 1) . "</pre>");

In former case, Looks like after pushing the API call data to Drupal Cache & Information is retrieved from cache this information is lost. I can dig deeper when i get time.

You should be all set with above entity_load function. Hope it helps. Keep us posted moving forward if any.

Thanks @Anil Sagar! entity_load works perfectly.


Awesome, Glad to know. Keep us posted moving forward if any. You can also accept the answer by clicking on Accept link below the answer so that it will be helpful for others.

@Anil Sagar @ Google

Thanks for your Answer , it worked for me