Hi Kaveesha,

Few suggestions on the REST API for import-export.

eg :-
> curl -H "Authorization:Basic AbCdEfG" -F file=@
> "/Desktop/MyAPIFolder/myExportedAPI.zip" -k -X POST "
> https://10.100.7.40:9443/api-import-export-<version>/import-api?
> *updateIfExists=true*"

Isn't API import/export apis belongs to publisher? Or is
api-"import-export-<version>" is an api on a jaggery app?

How about following APIs on publisher?

https://apis.wso2.com/api/am/publisher/v0.9/apis/{apiId} - [already
exists][1]
https://apis.wso2.com/api/am/publisher/v0.9/apis/{apiId}/documents/{documentId}
 [already exists][2]
https://apis.wso2.com/api/am/publisher/v0.9/apis/{apiId}/import-export [new]

*Importing API*
PUT https://apis.wso2.com/api/am/publisher/v0.9/apis/
<https://apis.wso2.com/api/am/publisher/v0.9/apis/%7BapiId%7D/import-export>
{apiId}/
<https://apis.wso2.com/api/am/publisher/v0.9/apis/%7BapiId%7D/import-export>
import-export
<https://apis.wso2.com/api/am/publisher/v0.9/apis/%7BapiId%7D/import-export>
   -> Update if exists API+Docs
POST https://apis.wso2.com/api/am/publisher/v0.9/apis/{apiId}/import-export
-> Create a new API + Docs (Gives 409 if exists)

*Export API*
GET https://apis.wso2.com/api/am/publisher/v0.9/apis/{apiId}/import-export
 -> Export API

Regards,
Rasika

[1]
https://docs.wso2.com/display/AM1100/apidocs/publisher/#!/operations#APICollectionApi#apisApiIdGet
[2]
https://docs.wso2.com/display/AM1100/apidocs/publisher/#!/operations#APIDocumentApi#apisApiIdDocumentsDocumentIdGet

On Thu, Jul 14, 2016 at 5:22 PM, Kaveesha Perera <[email protected]> wrote:

> Hi All,
>
> Current import/export tool doesn't facilitate updating a imported API. I
> modified the implementation of import/export tool in APIM to update a API
> once its been try to import a already imported API using APIM REST API.
>
> When a user attempt to import a existing  API using *"*create a new API*"
> *REST API [ 1.
> https://docs.wso2.com/display/AM1100/apidocs/publisher/#!/operations#APICollectionApi#apisPost]
> , server gives out a error with code 409 stating a conflict. On it, then
> check whether the user has set the value of query parameter
> "updateIfExists" to true.(Refer the following example)
>
> eg :-
> curl -H "Authorization:Basic AbCdEfG" -F file=@
> "/Desktop/MyAPIFolder/myExportedAPI.zip" -k -X POST "
> https://10.100.7.40:9443/api-import-export-<version>/import-api?
> *updateIfExists=true*"
>
>  If then, update the existing API using following REST APIs,
>
>    - Update the existing API -
>    
> https://docs.wso2.com/display/AM1100/apidocs/publisher/#!/operations#APICollectionApi#apisApiIdPut
>    - Delete the existing API documents -
>    
> https://docs.wso2.com/display/AM1100/apidocs/publisher/#!/operations#APIDocumentApi#apisApiIdDocumentsDocumentIdDelete
>    - Add exported API documents -
>    
> https://docs.wso2.com/display/AM1100/apidocs/publisher/#!/operations#APIDocumentApi#apisApiIdDocumentsPost
>
>    - Update document contents -
>    
> https://docs.wso2.com/display/AM1100/apidocs/publisher/#!/operations#APIDocumentApi#apisApiIdDocumentsDocumentIdContentPost
>    - Add API thumbnail by calling to the end point
>    http://localhost:9763/api/am/publisher/v0.9//apis/{apiId}/thumbnail
>    
> <http://www.google.com/url?q=http%3A%2F%2F127.0.0.1%3A9763%2Fapi%2Fam%2Fpublisher%2Fv0.9%2F%2Fapis%2Ff7ac5958-e581-4631-9c39-bb7d0795cf7c%2Fthumbnail&sa=D&sntz=1&usg=AFQjCNEpM0xz1acxH3fPPubOP-RG_WhTsA>
>    with corresponding image file.
>
> else, If the value of query parameter "updateIfExists" is false, importing
> action ends up giving a appropriate error message stating API trying to
> create already exists.
> If there are any feedback on this procedure please reply.
>
> Regards,
>
> --
> Kaveesha Perera
> Intern - Software Engineering
>
> mobile: 0716130471
>
> _______________________________________________
> Architecture mailing list
> [email protected]
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>


-- 
With Regards,

*Rasika Perera*
Software Engineer
LinkedIn: http://lk.linkedin.com/in/rasika90

[image: wso2-signature-general.png] <https://wso2.com/signature>

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