2. POST - Create a new entry in the collection.
In the below example, we are adding a new peripheral to the collection(List of peripheral
devices)
body – body key indicates the content, that would POST.
application/json – Content Type
example – example data that would POST.
3. URI Parameters: Resources often taken dynamic data, such as id or even search filter, RAML supports
URI parameters/placeholders. to indicate dynamic data, just use the braces either side of the URI
parameter(open and closed braces).
Ex: {URI_Param}
Below itemId as a URI Parameter
4. Include:
Keyword include helps us to replace
in-Line declaration with reference
declaration.
Before we refer any example, we
need to create/place the example in
API directory.
Create a folder name as POST
Project New Folder
To create an example
Project New File Raml 1.0
Example
5. Rename default with the
below
Paste example data, which
was shown in previous slide
and save it.
7. securedBy: Keyword is used to provide authentication for API. Before using the
authentication need to define the authentication. To define the security schema’s,
changed the RAML version 0.8 to 1.0.
8. In the above example, we used Basic Authentication. Basic
authentication validates Username and password. Mulesoft also
supports below authentications.
• OAuth 1.0
• OAuth 2.0
• Digest Authentication
• Pass Through
• x-{other}
Please refer undistributed ReST by Michael Stowe for more on
authentications.
9. Mocking and Sharing the RAML :
To Mock the Service, toggle Mocking Service as shown below.
10. Sharing an RAML : To share RAML to users, follow the below steps
Click on API Administrator (Top Left corner).
Select the RAML API, which you want to share.
Under API Portal section, select Create New Portal Option, It will redirect to the
below screen.
12. Click on live portal, it will redirect to the below screen.
This will provide users to test the RAML. Need to copy the URL and
share it for testers to testing the RAML.
It can also provide to download RAML from the link Download API
definition as a .zip file.
13. RAML is not small, recommend you to go
through Mulesoft documentations.