2. Agenda
In this walkthrough, you create an API definition with RAML using API designer.
● Define resources and nested resources.
● Define get and post methods.
● Specify query parameters.
● Interact with an API using the API console.
3. WT 3-1: Use API designer to define an API with RAML
2
3
4
1
american-flights-api.raml
4. WT 3-2: Use the mocking service to test an API
1
2
Turn on mocking
service
Anypoint platform automatically
create a URL for client app to test
5. WT 3-2: Use the mocking service to test an API
1
2
3
4
Click GET method
for test
Response body contains
empty json because you do
not define the response
6. WT 3-3: Add request and response details
1
3
5
6
Add dependency
which is already in
Exchange
Mulesoft create the
data type for the
training
You have two
dependencies
Mulesoft create the
sample data for the
training
2
4
7. WT 3-3: Add request and response details
1
2
3
Imported data type
Define AmericanFlight type
AmericanFlightDataType.raml
american-flights-api.raml
8. WT 3-3: Add request and response details
1
2
3
Copy path to
AmericanFlightsExa
mple.raml
Paste the link to
AmericanFlightsExample.raml
Define response
body using imported
data type
american-flights-api.raml
american-flights-api.raml
9. WT 3-3: Add request and response details
1
2
Response body contains
AmericanFlightsExample.raml
10. WT 3-3: Add request and response details
1
2
4
Create
AmericamFlightExa
mple.raml with text
editor
american-flights-api.raml
3
11. WT 3-3: Add request and response details
1
2
3
You can see
response body as
same as the raml
file
Return response
body by mocking
service
american-flights-api.raml
12. WT 3-3: Add request and response details
1
2
3
4
5
Create example for
post method
Copy
AmericanFlightExam
ple.raml
Delete ID row
because of post
example
american-flights-api.raml
13. WT 3-3: Add request and response details
3
1
2
AmericanFLightNoID
Example.raml is
shown
Response body
14. WT 3-4: Add an API to Anypoint Exchange
Disable mocking
service
To share API spec
3
1
2
15. WT 3-4: Add an API to Anypoint Exchange
1
2
Version is
automatically added
Go to Exchange
american-flights-api.raml
4
3
API Spec published
by you