Creating an existing consumer key/secret in another developer app throws "ConsumerKey already exists"

I want to migrate existing consumer key/secret from one developer app to another in the same organization. So I used the following steps:

a) Obtain the existing consumer key/secret (let's say K1/S1) from the "DeveloperApp".

b) Create a new developer app "NewDeveloperApp" with some API Product. This created a new consumer key/secret (let's say K2/S2) for the "NewDeveloperApp".

c) Create consumer key/secret API for the "NewDeveloperApp" with K1/S1 (Step#1 above) using the API documented here -> http://apigee.com/docs/management/apis/post/organizations/%7Borg_name%7D/developers/%7Bdeveloper_ema...

It is also documented in this community post -> https://community.apigee.com/articles/3113/how-to-set-a-custom-api-key-for-a-product.html

d) But I get the error stating K1/S1 already exists as shown below:

{
  "code": "keymanagement.service.ConsumerKeyAlreadyExists",
  "message": "ConsumerKey already exists",
  "contexts": []
}

e) However when I fetch the details of the "NewDeveloperApp", the K1/S1 does not exist.

f) If I try to create consumer key/secret for "NewDeveloperApp" with any random values (using any value other than existing consumer key/secret), then it works fine.

Have I missed anything here ?

Can you please help me to create an existing consumer key/secret taken from one developer app in a different developer app ?

Solved Solved
0 4 1,403
1 ACCEPTED SOLUTION

We can do the following to migrate consumer key/secret from one Developer App to another Developer App within the same org:

Post this, create the consumer key/secret K1/S1 in the "NewDeveloperApp".

In addition, I figured out the following information by doing some experiments:

  1. In a given org, same consumer key/secret cannot be part of multiple developer apps. That is, it has to be unique for every developer app in an org.
  2. The consumer key/secret from "org1" can be migrated or created in "org2" as long as it is unique in "org2".

View solution in original post

4 REPLIES 4

Hi @AMAR DEVEGOWDA

If I followed your steps above correctly, I didn't see the original consumer key being removed or regenerated from "DeveloperApp". If that is correct then that is the problem - the same key cannot be shared by multiple Developer Apps.

Dear @mschreuder,

Yes it looks like the same key cannot be shared by multiple Developer Apps.

We can do the following to migrate consumer key/secret from one Developer App to another Developer App within the same org:

Post this, create the consumer key/secret K1/S1 in the "NewDeveloperApp".

In addition, I figured out the following information by doing some experiments:

  1. In a given org, same consumer key/secret cannot be part of multiple developer apps. That is, it has to be unique for every developer app in an org.
  2. The consumer key/secret from "org1" can be migrated or created in "org2" as long as it is unique in "org2".

Is this process still expected to work? I'm trying to backup and restore portal data using the management APIs and find that even if I have deleted a developer I cannot restore the old key values. See https://community.apigee.com/questions/34266/using-management-apis-to-restore-a-deleted-develop.html.