Set new consumer key expiration

Does the management API support setting an expiration when adding a new api key and secret? I tried and it does not appear to respect the 'expiresAt' setting. Is setting the expiration only available when creating a completely new application?

0 1 526
1 REPLY 1

The management API for Apigee Edge supports :

1- creating a new app and implicitly generating a new key/secret (aka credential) with a specified expiry.

2- adding a generated key/secret (aka credential) to an existing app with a specified expiry.

3- adding a specific key/secret to an existing app. No specified expiry is supported here.

Example API calls for these cases:

case 1:

curl -i -H 'Authorization: ...' \
 -H 'Content-type: application/json' \
 -X POST \
 'https://api.enterprise.apigee.com/v1/o/ORG/developers/dev@example.org/apps'\
 -d '{
  "attributes" : [ {
    "name" : "attrname",
    "value" : "attrvalue"
  } ],
  "apiProducts": [ "Product1" ],
  "keyExpiresIn" : "86400000",
  "name" : "AppName"
}'

case 2:

curl -i -H 'Authorization: ...' \
 -H 'Content-type: application/json' \
 -X POST \
 'https://api.enterprise.apigee.com/v1/o/ORG/developers/dev@example.org/apps/App0'\
 -d '{
  "name" : "App0",
  "keyExpiresIn" : "418400000",
  "apiProducts": [ "Product1", "Product2" ]
}'

In both cases you mustspecify "keyExpiresIn" not "expiresAt". This is a relative value, relative to "now". The "expiresAt" is generated.

The API call for the final case is discussed elsewhere on community.

You can also execute case 1 and case 2 in the Apigee Edge Admin UI. The Admin UI does not currently support case 3.