Module 1 Lab 1 - Explore Anypoint Exchange for the SAP ECC System API Specification
Overview
APIs are the reusable assets that simplify and accelerate the creation of modern software applications. As a MuleSoft developer you will need to consume APIs created by other members of the organization and publish new APIs for others to consume. This new consumption model is the foundation of a new approach for delivering software solutions where APIs form the building blocks of the modern enterprise.
MuleSoft advocates for users to adopt a "design first" approach to creating APIs. A "design first" approach is used to enable API consumers the ability to understand, interact, and solicit feedback on the proposed API contract prior to the development effort.
This first lab will focus on using Anypoint Exchange to search for API specification and other assets that can be re-used.
Step 1: Login to Anypoint Platform
Go to http://anypoint.mulesoft.com and enter your credentials into the Username and Password fields and click on Sign in
You should see the following landing page once you are logged in to Anypoint Platform. Click on the Business Group that is on the right top of the screen. The name will vary with the class and select the sub-business group.
Step 2: Access Anypoint Exchange
Click on the icon labeled "Discover & share" under the Exchange section.
You will now be presented the landing page for the Anypoint Exchange portal:
Anypoint Exchange should be your initial starting point for just about any project. If you are looking to reuse an API then Anypoint Exchange is obviously where you should start. But even if you are creating a new API to be reused by others, it makes sense to first look in Exchange to see if the API already exists. Sometimes you will find that someone else has already undertaken the task of creating the API, or has created a subset of what you need.
In the left-hand navigation bar, click on <Workshop Business Group Name> to filter down to the list of custom assets that have been created for this workshop. These are assets that are private to this organizations Anypoint Exchange. They can only be viewed by users logged into this organization.
Anypoint Exchange allows for discovery on the public or private exchange. Every organization will automatically have a private exchange created for them. Software assets stored in Anypoint Exchange can only be discovered by users that have permissions for the private exchange for that organization. Furthermore, organization administrators can also create independent business groups to provide even more restrictive discovery. Anypoint Exchange users can only search within their currently selected business group. The currently selected business group, SAP-ALC-Dry-Run-Apr-2024 in this example, is shown.
As you can see from the screen above, there are organizational search criteria on the left hand side of the page. By default searches will search the private exchange only, but you can restrict or expand your searches by selecting a different organizational level. Select All assets to select both MuleSoft public and your private repositories.
The API Design Developer has already created the API Design for the SAP ECC System API. Let us discover the API by searching for SAP in the private exchange. When found, open the API specifications
Step 3: API Specifications in Exchange
1. Asset Actions
-
Share: This option allows you to share the API with users, users that have a role, or publish to the Public portal.
-
Download: This option is to download the RAML Spec or Mule Plugin to use it as a Connector.
-
Edit: This option allows to edit the API portal.
-
Menu: By clicking on the "ellipsis" button a new menu is displayed where you can:
-
Request access
-
View code
-
2. Information Panel: This provides general information about the API. When it was published, who published it, and contact information for the asset owner.
Under the Asset versions for section, you can click on the "ellipsis" button to pull up a menu that provides the following options.
3. Tags: Tags make it easier to search and discover APIs. Rather than relying on the title or description of the API, tags allow for you to create categories of APIs related to each other by tags.
4. API Summary: This is the API specification. API resources can be seen here. You can click on each resource and view the documentation. All generated automaticall during the design process.
5. API Instances: This gives you the opportunity to edit the API Implementation endpoints. You can also add other implementations.
6. Ratings and Reviews: API users can review and comment on an API. This enables collaboration with the API owner and the ability to share experiences using the API that might help other API consumers.
7. Documentation: The API Documentation allows API Designer or Developer to document their APIs with formatted text and inline pictures.
Step 4: API Mocking Service
Let’s drill into another important capability of Anypoint Exchange and that’s the auto-generation of dynamic documentation based on API specifications written in either RAML or OpenAPI.
In the left-hand navigation bar, toggle the /accounts endpoint and click on the green GET button.
There are a couple areas on the GET /accounts page to point out:
1. Code Examples - Developers can see examples of how to use the API using code snippets in various languages
2. Headers and Responses - This section gives developers an understanding of what headers and parameters need to be passed to the API.
3. Download - Developers can download the RAML or OpenAPI specification. In addition, they can download REST Connect connectors for both Mule 4 and Mule 3.
Any important capability of Exchange is the ability to interact with the API, regardless of the fact that the underlying implementation has not been built yet.
On the right side of the specification, go ahead and fill in the client_id and client_secret fields with any values. As you saw in the specification description, these fields are required. But because we’re not calling a live system, we can use any values.
Next, click on Send
The mocking service returns the responses (both HTTP status codes and example payloads) that are defined in your API specification, and is valuable for testing or for simply exploring how your API behaves.
In addition, the URL at the top of the section can be also used for parallel development. Developers can use the API running on the mocking service to build their application and provide feedback to the API designer on changes that they’d like to see made to the specification. All this can be done before the actual implementation is developed to the backend SAP ECC system.
Summary
In this lab you learned about Anypoint Exchange, a centralized location to jumpstart projects by simplifying collaboration. Developers can save APIs, integration projects, templates, examples, and custom security policies for others to reuse.
Additionally developers get simple documentation and versioning. They can automatically map dependencies between Exchange assets and generate documentation and portals. Documentation and dependency mapping are supported by API fragments such as API design patterns, data models, security schemas, and data types.
In the next lab, we’re going to take the SAP ECC System API asset from Anypoint Exchange and implement the connectivity to SAP ECC in Anypoint Studio.