Hi Sanjiva,
You have to create an API, subscribe to it, invoke the API, then delete it.
After that, if you try to create another API with the previously used name,
then the above mentioned problem will occur. Just creating and deleting the API
won't do. The reason is, an entry to AM_APPLICATION_KEY_MAPPING table will only
be added when generating a key to invoke the API after subscription.
Sent from my Windows phone.
-----Original Message-----
From: "Sanjeewa Malalgoda" <[email protected]>
Sent: 6/9/2014 7:43 AM
To: "Nalin Chandraratne" <[email protected]>
Cc: "WSO2 Developers' List" <[email protected]>; "Amila Maha Arachchi"
<[email protected]>; "Evanthika Amarasiri" <[email protected]>
Subject: Re: [Dev] [API-M] [1.7.0] Can't create API's with previously used
APInames.
It seems API go deleted from registry and still there in database so we may
need to debug and see what went wrong.
But when i tried same from API Manager 1.7.0 UI things worked as expected. See
following logs. Created deleted same API multiple times without an issue.
[2014-06-09 07:40:25,735] INFO - API Destroying API: admin--rrr:v1.0.0
[2014-06-09 07:40:55,478] INFO - API Initializing API: admin--rrr:v1.0.0
[2014-06-09 07:41:06,694] INFO - API Destroying API: admin--rrr:v1.0.0
[2014-06-09 07:41:41,241] INFO - API Initializing API: admin--vvv:v1.0.0
[2014-06-09 07:41:41,294] INFO - API Destroying API: admin--vvv:v1.0.0
[2014-06-09 07:41:41,295] INFO - API Initializing API: admin--vvv:v1.0.0
[2014-06-09 07:41:48,671] INFO - API Destroying API: admin--vvv:v1.0.0
Thanks,
sanjeewa.
On Fri, Jun 6, 2014 at 7:16 PM, Nalin Chandraratne <[email protected]> wrote:
Hi,
I encountered an issue when trying to create an API with a previously used but
deleted API name. The error actually occurs when trying to generate the key
after subscription.
I wrote a java client using the provided API-M REST API to do the basic
operations and when trying to generate the key, following error occurs.
ERROR - ApiMgtDAO Error occurred while creating an Application Registration
Entry for Application : DefaultApplication
org.h2.jdbc.JdbcSQLException: Unique index or primary key violation:
"PRIMARY_KEY_AF ON PUBLIC.AM_APPLICATION_KEY_MAPPING(APPLICATION_ID,
KEY_TYPE)"; SQL statement:
INSERT INTO AM_APPLICATION_KEY_MAPPING (APPLICATION_ID,KEY_TYPE,STATE)
VALUES(?,?,?) [23001-140]
When trying to do the same thing manually using API-M publisher UI the console
gives the following message.
The API manager console prints,
ERROR - UserAwareAPIProvider Failed to get API from :
/apimgt/applicationdata/provider/test-AT-test.com/test/1/api
org.wso2.carbon.registry.core.exceptions.ResourceNotFoundException: Resource
does not exist at path
/_system/governance/apimgt/applicationdata/provider/test-AT-test.com/test/1/api
It seems like although the API got deleted, the associated application key does
not get removed from the "AM_APPLICATION_KEY_MAPPING" table.
Thanks.
Nalin Chamara
Software Engineer
071-56-147-56
--
Sanjeewa Malalgoda
WSO2 Inc.
Mobile : +94713068779
blog :http://sanjeewamalalgoda.blogspot.com/
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev