Hi Kaveesha,

Shouldn't we use apiProvider.checkIfAPIExists(apiId) as the first check of
POST /apis endpoint?
IMO it is good to start the duplicate check from API Identifier as it is
the unique entry for all the APIs in APIM.
Then we can go for apiProvider.isDuplicateContext
Template(body.getContext()).

WDYT?

Thanks.

On Mon, Sep 12, 2016 at 9:15 AM, Kaveesha Perera <[email protected]> wrote:

> 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
> [email protected]
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>


-- 
Best Regards,

*Thilini Cooray*
Software Engineer
Mobile : +94 (0) 774 570 112 <%2B94%20%280%29%20774%20570112>
E-mail : [email protected]

WSO2 Inc. www.wso2.com
lean.enterprise.middleware
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to