How to RE-scaffold Mule flows from an Exchange API specification in Anypoint Studio
What happens when there is a change to a published API in Anypoint Exchange? How can we get these changes re-scaffolded to our API implementation once we have already done the scaffolding? In this post, we'll learn how to re-scaffold our Mule project based on new changes done to the published API Specification in Exchange.
Scaffolding Mule Flows from a Published API Spec (Anypoint Studio)· Part 2 of 2
- 1.How to scaffold Mule flows from a published API spec in Anypoint Studio
- 2.How to RE-scaffold Mule flows from an Exchange API specification in Anypoint Studio
What happens when there is a change to a published API in Anypoint Exchange? How can we get these changes re-scaffolded to our API implementation once we have already done the scaffolding?
In this post, we’ll learn how to re-scaffold our Mule project based on new changes done to the published API Specification in Exchange.
Prerequisites
- Anypoint Platform - You should have an Anypoint Platform account. You can create a new free trial account here.
- API specification - You should already have an API specification published in Anypoint Exchange.
- Anypoint Studio - MuleSoft’s IDE based on Eclipse. You can download it here.
- Scaffolded Mule project - You should already have scaffolded the first version of the Mule project based on a previous version of the API specification since we’re going to re-scaffold the same project with the new change in the specification. If you haven’t done this yet, please refer to part 1 of this series.
- GitHub Repo - If you want to follow along with the code I generated, you can check it out here.
Update the API specification’s dependency version
Once our API Specification has been updated and published to Anypoint Exchange, our Mule project will become outdated and this is where we’ll do the re-scaffolding to update the project to match the latest API specification version from Exchange.
In your Package Explorer in Anypoint Studio (located at the left of the screen), you will be able to find the name of your API Specification with the first version (in this case v1.0.0). If you open the dependency, you’ll be able to see the .zip associated with the specification.

We want to change this version of the specification to the next available version, which in our case is v2.0.0, but it could be v1.0.1 or any other version your specification has as the latest. To do this, right-click on your API specification’s dependency and select the name of the spec (in this case my-to-do-api). After that, select Update Version.

This will open a new window where you’ll be able to refresh the APIs associated with the Mule Project by clicking the Refresh or Update button on the top-right side.

Important
If nothing happens when you click this button, it might mean that your credentials have expired. You will need to refresh them from Anypoint Studio > Settings > Anypoint Studio > Authentication. Remove your current Anypoint Platform credentials from this window and re-add them. Try refreshing the APIs one more time after refreshing the credentials.
Once the APIs are refreshed, you’ll be able to see that there is a newer version of the API specification you’re using in your project.

Click on the Update version button for this API to be refreshed.

Once it’s refreshed, it will appear with the newest version. In this case, 2.0.0. Click Apply and Close.

Immediately after that, you will get a message asking if you want to scaffold the API specification. Select Yes to re-scaffold it.

After that, your API specification’s dependency will appear with the new version in the Package Explorer and you’ll be able to see your new changes in the API implementation.

Subscribe to receive notifications as soon as new content is published ✨
💬 Prost! 🍻
FAQs
Frequently asked questions about this post.
-
How do I re-scaffold a Mule project after the API specification changes in Exchange?
Once the updated specification is published to Exchange, find your API specification dependency in the Package Explorer, right-click it and select the spec name, then choose Update Version; in the window that opens click Refresh or Update to refresh the APIs, click Update version for the API, then Apply and Close, and when prompted whether you want to scaffold the specification select Yes to re-scaffold it.
-
What should I do before re-scaffolding a Mule project?
You should already have an Anypoint Platform account, an API specification published in Anypoint Exchange, Anypoint Studio installed, and a first version of the Mule project already scaffolded from a previous version of the specification, since the post re-scaffolds that same project with the new change; if you haven't done the initial scaffolding yet, refer to part 1 of the series at https://www.prostdev.com/post/scaffold-mule-flows-from-published-api-specification .
-
Why does nothing happen when I click the Refresh button to update the APIs?
It might mean your credentials have expired; refresh them from Anypoint Studio > Settings > Anypoint Studio > Authentication by removing your current Anypoint Platform credentials and re-adding them, then try refreshing the APIs one more time.
-
How do I know there is a newer version of my API specification available?
After refreshing the APIs you'll see a newer version of the specification you're using, indicated by a tooltip on your current version reading that there is a newer version available, and the API dependency detail will show New version available with an Update version button.
More from this series
Scaffolding Mule Flows from a Published API Spec (Anypoint Studio)· Part 2 of 2
- 1.How to scaffold Mule flows from a published API spec in Anypoint Studio
- 2.How to RE-scaffold Mule flows from an Exchange API specification in Anypoint Studio