Hi @Lev Kuznetsov Greetings! Welcome to Microsoft Q&A forum. Thank you for posting this question here.
I have tested the APIM Python SDK in house and could replicated the same behavior. The SDK is working as expected when filtering name
, description
and externalId
properties. However, it is failing for displayName
I have reached out to the team internally to check on this issue. I will get back to you with more details on this as soon as I get an update from the team.
In the meantime, you can use the following approach to filter on the displayName
property.
client = ApiManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
groups = client.group.list_by_service(
resource_group_name="<ResourceGroupName>",
service_name="<APIMInstanceName>"
)
products = client.product.list_by_service(
resource_group_name="lsayanaintegrationwest",
service_name="lsayanaapimwest"
)
# Filter the groups based on display name
filtered_groups = [group for group in groups if group.display_name == "<displayName>"]
for item in filtered_groups:
print(item)
# Filter the prodcuts based on display name
filtered_products = [product for product in products if product.display_name == "<displayName>
"]
for item in filtered_products:
print(item)
Hope this helps!
If the response helped, please do click Accept Answer and Yes for the answer provided. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.