Skip to content

[BUG] Apps import does not properly set the status of the API Product that has been manually approved #661

@kurtkanaskie

Description

@kurtkanaskie

Describe the bug
Given an App that is using an API Product that has manual approval
And the App's API Product has been manually approved before it was exported
apigeecli apps import does not use the status in API Product on the App to set the API Product status
By default the status of the API Product is "pending" because of the manual approval on the API Product

apigeecli needs to check the status returned from the call that associates the API Product to the API Key and compare to the value in the exported app
If it's different (e.g. pending when it should be approved) then call
https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.developers.apps.keys.apiproducts/updateDeveloperAppKeyApiProduct to set the status.

For example:

curlx -X POST https://apigee.googleapis.com/v1/organizations/apigeex-custom-non-prod/developers/ca16969b-f6d2-4ce8-8939-78f4678172da/apps/pingstatus-manual-exco/keys/XKxTStBSdFwhS2Wdse73la4kA03gUCLf/apiproducts/pingstatus-v1-manual?action=approve

Version
apigeecli version 2.11.0 date: 2025-03-31T20:08:55Z [commit: 95cc9d1]

To Reproduce
Create the test scenario:

  1. Create / use developer
  2. Create API for use in API Product
  3. Create API Product with manual approval
  4. Approve the API Product in the App

Reproduce the issue:

  1. Export the developers, products and apps
  2. Delete the app
  3. Edit the exported apps.json to use only the app that was deleted
  4. Import the apps using:
apigeecli --org=$X_ORG apps import \
    --file=$X_IMPORT_DIR/apps_test.json \
    --dev-file=$X_IMPORT_DIR/developers.json

Expected behavior
The Apps API Product should be "approved"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions