Hi,

Currently I'm working on a client side tool to perform import and export of
APIs in APIM.

I encountered conflict issues(error 409) on following instances when using
REST APIs to create a new API.
1.when trying to re-import already published API
2.when trying to import a new version of a already published API

This is because along API post , initially it check for the context by [1]
and throw a conflict exception if context template of the payload and a
existing API alike.

Several versions of the same API has same *context template* and it should
be a exceptional scenario of above mentioned procedure. To handle this hope
to do following modifications for apisPost REST API.

On API post initially do check [1]. If returns true, get the corresponding
API name from the database and check if the API name in the payload and the
published API are same. If same, then retrieve all the published versions
of that API from the database and check those against version stated in the
payload. Method should throws a conflict exception only if the payload
holds a already published version of the API or if the API name on the
payload and API name in the database corresponds to same context template
differs.Else it will allow the normal process of creating a new API.Summary
of the proposed changes are shown in Fig.1.0


​*Fig.1.0*



[1] apiProvider.isDuplicateContextTemplate(body.getContext())

If any feedback please do reply.

Regards,
Kaveesha

-- 
Kaveesha Perera
Intern - Software Engineering

mobile: 0716130471
_______________________________________________
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to