The demand for APIs is growing exponentially, several companies are opting API strategies to support their business models. Let us discuss about the best practices which can be followed while designing the APIs, that helps in developing the applications by consuming the APIs.
Here are some points to note before designing an API
1. Who are the intended target users?
Design the APIs in order to give a great experience to the developers by keeping it simple, functional and a purpose which is easy to understand. Any inconsistency needs to be avoided in order to process the request and response. The naming standards and the data formats need to be consistent as well.
2. What are the exposed entities and resources? Why is it necessary?
Identify the entities/resources that are to be exposed through the APIs so that developers can use it for building their applications. These resources should be named as NOUNS that makes sense from API perspective. Once the resources are finalised, list out the actions that can be performed by using these APIs and prioritize them accordingly. Some of the commonly used resources and nouns would be Customers, Tickets, Users, etc.
3. Identify the Technologies to implement APIs
Most of the APIs tend to follow the REST or JSON-RPC. But, it is necessary to understand the client needs and make use of technology which is suitable to their environment. If the client is using a system that depends on a SOAP, then it makes more sense to build an API using SOAP platform. To build an API, if simplicity is the key factor, then it is good to go with JSON- RPC based. We can choose REST, if we are planning to build API's keeping in view the present and the future.
It is always good to build an API with a long term perspective as this would avoid potential version issues.
Design Considerations
How MuleSoft API Platform helps to Design, Develop and Publish an API
1. Describing and publishing API
MuleSoft bundles RAML with API Portal Platform to “Publish” and “Describe” the APIs. RAML is an Open Source tool, which is simple to understand and update. It is built on pattern based design principles. RAML allows us to define patterns using traits, resource types and security schemas to minimize the repetition.
2. Implementing and Testing
RAML Editor is used to structure API and is also used to mock the service. The service can be defined and mocked for testing while defining the structure of RAML file in real time.
The RAML file is exported from RAML Editor and imported into Anypoint Studio. In Anypoint Studio API DevKit is used to implement the functionality and integrate the APIs with corresponding Mule flows.
3. Expose API
APIs which are designed and implemented in the previous steps would be exposed through MuleSoft API Manager. API Manager is a service wherein APIs are registered, governed and integrated with other server side components including Mule flows or a database service that is accessible.
4. Operating and Versioning
API Manager and API Portal is used to maintain and manage different versions of same API.
5. Security
API Manager is used to configure the security for an API using User/Roles based permissions, security policies applied on each API and its versions. It supports OAUTH2 if there is any need for 3 way authentication and also enables the support for client specific "Identity Management" solutions.
6. Proxy
MuleSoft provides API Gateway as part of API Manager and it allows to provide a proxy for the implemented APIs.
If you would like to find out more about how Systems Integration could help you make the most out of your current infrastructure while enabling you to open your digital horizons, do give us a call at +44 (0)203 475 7980 or email us at Salesforce@coforge.com
Other useful links:
Integration with Twitter using Mule ESB
Integration of Mule ESB with Microsoft Azure
Integration with Dropbox using Mule ESB