This article gives an impression of API-led architecture using Mule4 APIs in order to give a clear understanding of the development process of an API-led approach. It covers all 3 of the API layers (System, Process, and Experience) using Salesforce and FIRST.org as the source. Additionally, we cover applying best practices in each layer of development.
RAML: Common library, traits, data definition, reusable resources, health endpoint
API: Externalize property files, encryption of properties, externalize dwl code, reusable http requester, common error handling, applying policies, applying loggings
Requirements
Create and get account details from Salesforce CRM
Input has country code in the request for shipping and billing details tags, which needs to be looked up against FIRST.org open source REST API to get the country name
Implement clientID enforcement policy with SLA-based rate limiting; limit 100 requests in a minute
Follow the best practices:
Reusable traits, library, and response code in RAML
Define respective APIs with proper error handling, global connectors, logging, munit testcases
Common Library
Common Traits
Client credentials headers: To re-use for APIs where the developer wants to secure the resources using the Client ID enforcement policy
headers:
client_id:
type: string
description: Client Id for the respective consumer application
client_secret:
type: string
description: Client Secret for the respective consumer application