In this walk-through, we will define api definition using RAML in Mule API designer.
Login in to anypoint platform and using API Manager create new API as MuleAPI.
Open the Mule API 1.0 and in APIDefinition Tab, click Define API in API Designer.In the designer, we can provide the base path and then add the relevant method it supports. As shown below, we defined a get operation and response with status code and response type either json or xml and we provided sample xml response for the operation.
In the resources tab, provides mock description of the operation with example. This operation can even be tested, if mocking service is enabled.
Here is actually xml response of the operation and similarly, other operations are add to support the features of Restful Service.
Resources tab, shows complete set of operation that it supports.
All the operation definition is shown below, examples shown are mocked up xml content
Other example of API Designer using RAML shown the feature of supporting xml and json type of messages
Sample RAML for easy understanding, example json and xml has been removed for better alignment.
#%RAML 0.8
baseUri: https://mocksvc.mulesoft.com/mocks/af7204ad-81ec-462c-b3b8-f58485a4bfc0
title: MuleAPI
version: 1.0
/Orders:
get:
queryParameters:
Event:
enum: [101, 201, 501]
responses:
200:
body:
application/xml:
example:
""
application/json:
example: |
post:
body:
application/xml:
example:
""
application/json:
example: |
responses:
201:
body:
application/xml:
example:
""
application/json:
example: |
/{ID}:
get:
responses:
200:
body:
application/xml:
example:
""
application/json:
example: |
No comments:
Post a Comment
Note: only a member of this blog may post a comment.