Using multiple product with one APP. GetEntity fetches 1 product.

We are able to add multiple products to a single APP. But as we have different custom attributes added to different Products, we are using AccessEntity policy. But it only fetches the data about last product added to the APP. Can we get all products added to the APP?

Solved Solved
0 8 546
1 ACCEPTED SOLUTION

Earlier I was using consumerkey to fetch active Product. So now the approach is to fetch based on product name.

<EntityIdentifier ref="verifyapikey.VerifyAPIKey-ValidateExternalAPIKey.apiproduct.name" type="apiproductname"/>

Active product is fetched using verify key policy and I am using that name to fetch product.

View solution in original post

8 REPLIES 8

Hi @Manisha ,

You need to specify the identifiers in the AccessEntity Policy with that way you can load multiple products for the same entity type.

<EntityType value="apiproduct"/>
   
    <Identifiers>
        <Identifier>
            <EntityIdentifier ref="app_name_ref" type="appname"/>
        </Identifier>
        <Identifier>
            <EntityIdentifier ref="app_name_ref_helloworldprod" type="appname"/>
        </Identifier>
    </Identifiers>

you can add SecondaryIdentifier also for more conditional data (e.g client key)

Then you have to use individual extract variable for output of each identifier. I have a working sample of this. along with tract logs attaching here.

access-entity-demo-rev3-2019-07-23.zip

I hope this solves your problem.

Hi @Ravindra Singh

Requirement is different here, I have multiple products on same APP, which I want to load. The sample shared has different APPs based on which products are being loaded.

Possible flow I see could be like, fetch all products added in APP based on API key or name. Use AccessEntity to fetch product based on apiproductname.

Issue with this approach is: there is not definite list of product that can be added to an APP. And there is not option for dynamic loading.

Hence if Apigee had option to list all products tied to an APP name or Key, it can solve. But right now it only fetches first product.

Maybe you are thinking about it incorrectly.

The proxy will implicitly load the custom attributes associated to the product which is "active". That is to say, the product on behalf of which the apiproxy request is authorized. While a credential may be authorized for use on multiple products, for any one request, there is exactly one product for which the request has been authorized.

If you think you need attributes for other products, then you are probably attaching the attributes to the wrong entities.

If there are attributes that you need regardless of which product is actively being authorized, then you should attach those attributes to the app itself, or possibly to the credential, but definitely not to the various products.

I m using below to fetch Product information:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<AccessEntity async="false" continueOnError="false" enabled="true" name="AccessEntity-APIProduct">

<EntityType value="apiproduct"/>

<Identifiers>

<Identifier>

<EntityIdentifier ref="request.header.X-GP-Api-Key" type="consumerkey"/>

</Identifier>

</Identifiers>

</AccessEntity>

My understanding is, If my APP has two Products (both active) and I am trying to access URL which is from Product 2, using API Key. Above AccessEntity policy should fetch the Product which actually verified my URL with the Key given.

But Instead, I am getting information about Product 1.

Let me know if above understanding in incorrect.

Earlier I was using consumerkey to fetch active Product. So now the approach is to fetch based on product name.

<EntityIdentifier ref="verifyapikey.VerifyAPIKey-ValidateExternalAPIKey.apiproduct.name" type="apiproductname"/>

Active product is fetched using verify key policy and I am using that name to fetch product.

your approach doesn't sound good. I think you should get product name list first with consumer key then in AccessEntity use those product names like i have given the example above - https://community.apigee.com/answers/70833/view.html

you can use Identifiers to fetch from all defined products.

I think you are misunderstanding. Manisha has explained that the problem is solved. "your approach doesn't sound good" seems to miss that point.

We needed custom attributes of the product which authorized my API, so I dont need to fetch all the products. Therefore, we take product name obtained from verifyAPIKey policy.