Exploring API Sync feature in Anypoint Studio 7.4.x onwards

API Sync feature in Anypoint Studio 7.4.x onwards enables synchronization of changes between the Anypooint platform and Anypoint Studio and vice versa. Below are the ways in which API sync can be accomplished

  1. Import as API Specification from the Design Center

    In Anypoint Studio use  File -> Import ->Anypoint  Studio ->API Specification from Design Center to import an API specification to Anypoint Studio

    Once imported we will have a project structure as below. We can see that along with the project name the branch information gets imported

    Now we can perform changes we want to. For example, in below RAML, we have added the missing description

    Anypoint Studio comes with an inbuilt git configuration. Post changes we can see that there are unstaged changes in Git Staging.  Add the file to staged changes, put comments, push and commit.

    Also one can create a different branch for the changes to be performed by switching to new branch Team -> Switch To -> New Branch

    Later we can merge the newly-created branch with the master branch and push the changes to the Design Center.
  2. The other way to sync API specification is from the project created using the API Definition imported from Exchange
    • Create a project in Anypoint studio by importing published API from Exchange
    • Select the asset to import
    • Once imported we can the project structure as below. The API definition is now not part of src/main/resources rather it is kept as a separate entity.
    • Now right click on api dependency and click of Edit API Specification
    • Oncle clicked we will get a notification saying that the editable assets will get downloaded from the Design Center and we need to make sure that the version in Design Center and Exchange are in sync.
    • Click continue. And import the editable asset. And follow step 1 to perform any changes and push the data to the Design Center.

      Note: While importing we import API specification from Exchange but while editing it downloads the master branch of Design Center. So when changes are pushed it goes to the design center. Even the notification says the same
    • Now we need to publish the changes to Exchange, and we can perform it two way
      1. Right-click on the API Specification project and click on publish to exchange

        Add the asset version and click on finish

        Now the changes are available in the exchange.
      2. The other way is to publish the changes from Design center Exchange in Anypoint Platform
    • Now we need to update the project with the latest version of the asset. For that go to the API Specification folder inside the project. Right-click -> API name -> update version
    • In the newly opened window click on update version, apply and close

Note: While creating a mule project with API Specification referred from the Design center directly. We will not be able to perform API Sync in that case. Look at the warning below which says the same

By Soumitra Giri

Tags: No tags

Leave A Comment

Your email address will not be published. Required fields are marked *