Hi,

> 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()).
>
+1 , So that we can avoid the creation of APIs with duplicate API
name,provider and version, even with different context template.

With the above changes, flow will be as follows in Fig 1.1.


​

*Fig. 1.1.*
If have any feedback on this approach do reply.

Thanks,
Kaveesha.


On Mon, Sep 12, 2016 at 9:15 AM, Kaveesha Perera <kavee...@wso2.com> 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
>



-- 
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