Revoke Application at the Product Level

This question is for both developer and company applications.

When I retrieve an application, there is a (*deep breath*) credentials array containing objects with an apiProducts array containing objects with the product name and status ('revoked' or 'approved').

The status of the product corresponds to what I see when I view the application in apigee management portal. So I can revoke an application at the product level, and see the status updated within the apiProducts array entry for that product.

Note that the app level object also has a status property. And it might not match the product level status.

app = {
  "name": "My App",
  "status": "approved",
  "credentials": [
    {
      "apiProducts": [
        {
          "apiproduct": "My Product",
          "status": "revoked"
        }
      ]
    }
  ]
}

What is the correct apigee api call to revoke the app at the product level?

The one documented here updates at the application level. Do I have to update the specific object in the credentials array myself? If so, what would that call look like? Would it need to include the entire credentials array so that other products are not overriden?

Solved Solved
1 4 183
1 ACCEPTED SOLUTION

Here's how you revoke a particular API Product - in this example Prod1 - from an existing app.

## revoke a key for a currently-approved apiproduct
curl -i -n -X POST \
  -d ''
  "${mgmtserver}/v1/o/${orgname}/developers/${developerId}/apps/${appname}/keys/${consumerKey}/apiproducts/Prod1?action=revoke"

Here's how you approve a revoked or pending product - in this example, Prod2 - for an existing developer app:

## approve a key for a pending or revoked apiproduct
curl -i -n -X POST \
  -d '' \
  "${mgmtserver}/v1/o/${orgname}/developers/${developerId}/apps/${appname}/keys/${consumerKey}/apiproducts/Prod2?action=approve"

Does this help? In both cases you will get a "204 No Content" reply on success. To query the current status of the consumerKey, you can do this:

curl -n -i -X GET \
  "${mgmtserver}/v1/o/${orgname}/developers/${developerId}/apps/${appname}/keys/${consumerKey}" 

I will leave it to you to translate these curl commands to the programming framework of your choice.

View solution in original post

4 REPLIES 4

Here's how you revoke a particular API Product - in this example Prod1 - from an existing app.

## revoke a key for a currently-approved apiproduct
curl -i -n -X POST \
  -d ''
  "${mgmtserver}/v1/o/${orgname}/developers/${developerId}/apps/${appname}/keys/${consumerKey}/apiproducts/Prod1?action=revoke"

Here's how you approve a revoked or pending product - in this example, Prod2 - for an existing developer app:

## approve a key for a pending or revoked apiproduct
curl -i -n -X POST \
  -d '' \
  "${mgmtserver}/v1/o/${orgname}/developers/${developerId}/apps/${appname}/keys/${consumerKey}/apiproducts/Prod2?action=approve"

Does this help? In both cases you will get a "204 No Content" reply on success. To query the current status of the consumerKey, you can do this:

curl -n -i -X GET \
  "${mgmtserver}/v1/o/${orgname}/developers/${developerId}/apps/${appname}/keys/${consumerKey}" 

I will leave it to you to translate these curl commands to the programming framework of your choice.

Awesome. Thanks for your help! I assume this also works for company apps (with relevant path pieces changed)?

Yes, should do. I haven't tested that, but it's the same idea.

FYI: Don't forget to set header Content-Type to application/octet-stream

Docs: Company and Developer