SlideShare a Scribd company logo
Oct 23, 2020
Monterrey MuleSoft Meetup Group
Use of DataType and Library Fragments with API
Designer
2
● Introductions
● Design your API with API Designer
● Create Fragments In RAML 1.0
● Modularizing APIs and Reusing Patterns in API’s
● Q/A
● What’s next
Agenda
3
●About the organizer:
Introductions
A SHOW OF HANDS:
Who is new to this Meetup?
Veyra Gutiérrez Martínez
in/veyra-celina-532bb88
• Studies in Computer Science. Started working
with Mulesoft about a 3 years ago. My experience
in Integrations development drove me to enter to
this MuleSoft world, that I found awesome.
• Experience in different industries as.
• CMT
• Manufacturing
• Electric and gas
• Mulesoft fundamentals trainer
subtitle
Design your API with API
Designer
5
● API & Integration Methodology.
MuleSoft’s AnyPoint Platform
API
• Design an API: Designing an API first before
actually building is often referred to as spec
driven development, in this development
process your application is built in two phases:
the design phase and the development phase
Design
● API Designer – it is web-based tool to design API’s REST interfaces or specifications as per
the requirement. While creating the interface it will validate the interface for any syntax error
and highlight the same. It also show the tab to validate the interface where it show the mock
interface
6
Mocking
● Mock Service – it is again one of the feature in Design Center through which we can quickly
validate the API specification. This only provide the Mock API without any actual
implementation and developer can validate request and response of the API
7
APIs
● Let's talk about API First………..
● What is API ?
8
An Application Programming Interface (API) provides the information for
how to communicate with a software component and define functionalities
independent of implementations.
Operations
(What to call?)
Inputs
(What to send with call?)
Outputs
(What you get from a call?)
Data Types
(What to expect receive and send?)
API
• The term API is often used to refer any part
of a RESTful web service
• The web service specification
• The web service interface implementing the
API
• The web service implementation itself
• A proxy
• Some benefits are:
• Provides Standard interface for
communication
• They are Reusable and Easy to use
• Provides a layer of security
- Hides the specifics of the systems talking to
each other
- Client is never fully exposed to the server
- Server is never fully exposed to your Client.
• APIs make it easy to efficiently share data
and processes
Web Service
API Specification
API Implementation
REST APIs
● Let's talk about REST APIs………..
● What is REST?
9
REpresentational State Transfer (REST) is a software architectural style
that defines a set of constraints to be used for creating Web services.
Those web services that follow this architecture are known as RESTful
Web services
Http Methods
o Http Verbs
Resource
o Entity that can be identified, named,
addressed, handled, or performed
Response
o Http code
Content Type
o Format Json, XML, HTML, etc
API
• REST APIs are distinguished by their strong
reliance on the HTTP application protocol. That is,
they use the HTTP response codes and methods for a
specific and widely recognized function. And it allows
us through the URI, the structuring of the available
resources.
• REST Development Advantages:
• Separation between the client and the server
• Visibility, reliability and scalability
• The REST API is always independent of the
type of platform or languages
{REST}
Json
Libraries and DataTypes Fragments
Create Fragments In RAML 1.0
11
One of the great things about RAML is modularization.
This gives the ability to separate concerns within an
API specification.
One feature that illustrates this concept quite well is
“Typed Fragments”.
There are two types of typed fragments that get
confused often, namely “Libraries” and “DataTypes”.
Fragments
Library Fragment DataType Fragment
It can hold MULTIPLE types. Libraries are
referred to using the uses: statement and a dot
notation to refer to a type inside that library
It can only hold a SINGLE type. DataTypes are
referred to using the !include tag as value of a
type
#%RAML 1.0 <fragment-type>
How to create the RAML fragments
● Login in to Anypoint platform -> Go to design Center
● Click on Create new-> Create fragment
● Provide the fragment name
● Provide the type of fragment
DataType Fragment
● Taken from object-oriented programming
languages like Java, data types allow the user to
define objects and reuse them at any level in a
RAML file.
○ You can define types that inherit from other types.
○ You can define multiple properties each of which is
declared as a built-in type like string or number.
● Types are split into four families: external, object,
array, and scalar.
● You can define a facets (You specialize types
based on characteristics of facet values.
Examples: minLength, maxLength)
● In a RAML file, we can define simple and complex
data types.
13
#%RAML 1.0 DataType
Library Fragment
● Libraries are usually defined in an external file,
however, also can be defined inline.
● Can hold any number and combination of data
types, security schemes, resource
types, traits, and annotations.
● Libraries are imported via the top-
level uses statement
● A library is referenced by concatenating
the library name, a dot (.), and the name of the
element (e.g. data type, resource type, trait,
etc) e.g. type: library.typeInsideLibrary
14
#%RAML 1.0 Library
In RAML, it's possible to organize APIs in a more
readable way by using of libraries
subtitle
Modularizing APIs and Reusing
Patterns in API’s
Divide, reuse and conquer
● Avoid to design one huge API file with everything
on it, divide instead.
● Create reusable file fragments which can be
used later across your organization.
● Conquer the Spec Driven Development driven,
using best practices to develop and maintain
large software programs, by breaking them up
into smaller parts.
16
APIs
17
How you can break your RAML API
definition into modules by making use
of typed fragments?.
○ Use of include key word to modularize a
complex property value in a RAML definition
by placing the property value in an external
file
○ Rather than placing all the types, resource
types or traits in their own
respective include files, you can also use
special types of includes known as typed
fragments to break each of these constructs
into multiple include files, specifying a
different file for each type, resource
type or trait.
Break your RAML
Fragment
Identifier
Description
DataType A data type declaration where the type node may be used
NamedExample A declaration of the examples facet, whose key is a name of
an example and whose value describes the example
ResourceType A single resource type declaration. ResourceType is
basically a template that is used to define the descriptions,
methods, and parameters that can be used by multiple
resources without writing the duplicate code or repeating
code
Trait A single trait declaration. Traits is like function and is used to
define common attributes for HTTP method (GET, PUT,
POST, PATCH, DELETE).
SecurityScheme A definition of a security scheme. A security scheme is used
to secure data access, identify requests, and determine
access level and data visibility
Library A RAML library. A library is used to modularize any number
and combination of data types, security schemes, resource
types, traits, and annotations
Overlay An overlay file. An overlay is used to extend non-behavioral
aspects of an API, such as descriptions, usage directions,
and user documentation items
Extension An extension file. An extension is used to extend or override
behavioral aspects of the API
Example
Example
● Given the entities types Foo and Bar, define basic CRUD operations and a couple of
query operations. Here are the resources that we will define for our API:
• GET /api/v1/foos
• POST /api/v1/foos
• GET /api/v1/foos/{fooId}
• PUT /api/v1/foos/{fooId}
• DELETE /api/v1/foos/{fooId}
• GET /api/v1/foos/name/{name}
• GET /api/v1/foos?name={name}&ownerName={ownerName}
• GET /api/v1/bars
• POST /api/v1/bars
• GET /api/v1/bars/{barId}
• PUT /api/v1/bars/{barId}
• DELETE /api/v1/bars/{barId}
• GET /api/v1/bars/fooId/{fooId}
Example
● Let’s the modularization begin...
● Where do I begin?
20
• Security.- Safety first, Let’s define a what type of
authentication mechanism will use our API.
#%RAML 1.0 SecurityScheme
1. Login in to Anypoint platform -> Go to design Center
2. Click on Create new-> Create fragment
3. Provide the fragment name: basicAuth_sample
4. Provide the type of fragment: Security Scheme
• Authentication mechanisms
 Basic Authentication
 Basic Auhtentication Client ID enforcement
 OAuth 2.0
 Custom token
Example
● Security check!!
● What’s next?
21
• DataTypes.- Next, we'll define the data types that
our API will use: Foo, Bar and Error.
#%RAML 1.0 DataType
1. Login in to Anypoint platform -> Go to design Center
2. Click on Create new-> Create fragment
3. Provide the fragment name: Foo
4. Provide the type of fragment: Data Type
1. Click on the ‘+’ icon and select “New File”
2. Provide the type of fragment: Data Type
3. Provide the fragment name: Bar; Error; Foo
Example
● Data Types Done!!
● What’s next?
22
• Library.- Next, we'll define the library or libraries
that our API will use: For data types, security
schemes, traits, resources types, etc.
#%RAML 1.0 Library
1. Login in to Anypoint platform -> Go to design Center
2. Click on Create new-> Create fragment
3. Provide the fragment name: dataTypes
4. Provide the type of fragment: Library
1. Click on the ‘+’ icon and select “New File”
2. Provide the type of fragment: Library
3. Provide the fragment name: dataTypes
Example
● That’s it?
● This is the end?
23
• Find the patterns and organize.- As we read
through the list of resources in our API, we begin to
see some patterns emerge. When we compare the
RAML definitions of the /foos and /bars resources,
including the HTTP methods used, we can see
several redundancies among the various properties
of each, and we again see patterns begin to emerge.
Wherever there is a pattern in either a resource or
method definition, there is an opportunity to use a
RAML fragment like a resource type, trait, example,
etc .
Q&A
Time to earn a pass to take free training course!
25
First Chance!!
Which are the four families in which
the DataType fragments split into?
¿Cuáles son las 4 familias en las
que se dividen los fragmentos
DataType?
Second Chance!!
Which is the key word used to
import Libraries and where should
be located?
¿Cuál es la palabra clave usada
para importer librerías y dónde
debe colocarse?
Third and Last
Chance!!
Name other 3 typed fragments
besides DataType and Library?
¿Nombre otros 3 tipos de
fragmentos además de Tipo de
datos y Biblioteca?
26
● Share:
○ Next Meetup: TBD
○ Stay tune: https://meetups.mulesoft.com/monterrey/
● Feedback:
○ Don’t forget to fill out the survey feedback
○ Nominate yourself for the next meetup speaker and suggest a topic as well
What’s next?
Thank you
References
● https://mulesy.com/create-fragments-in-raml/
● https://mulesy.com/include-fragments-in-raml/
● https://mulesy.com/usage-of-library-fragment-in-raml/
● https://mulesy.com/basic-authentication-simple/
● https://www.baeldung.com/raml-restful-api-modeling-language-tutorial
● https://www.baeldung.com/simple-raml-with-resource-types-and-traits
● https://www.baeldung.com/modular-raml-includes-overlays-libraries-extensions
● https://medium.com/raml-api/raml-101-libraries-and-datatypes-fragments-1889b2e82c27
● https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md#typed-
fragments
● https://dzone.com/articles/overview-on-raml-10
● https://dzone.com/articles/understanding-resourcetypes-and-traits-with-
raml#:~:text=3.0%20What%20Is%20Traits%3F,filterable%2C%20searchable%2C%20or%20p
ageable.

More Related Content

What's hot

Flex and PHP For the Flash Folks
Flex and PHP For the Flash FolksFlex and PHP For the Flash Folks
Flex and PHP For the Flash Folks10n Software, LLC
 
C# Unit 2 notes
C# Unit 2 notesC# Unit 2 notes
C# Unit 2 notes
Sudarshan Dhondaley
 
Java Basics
Java BasicsJava Basics
Java Basics
shivamgarg_nitj
 
WhiteList Checker: An Eclipse Plugin to Improve Application Security
WhiteList Checker: An Eclipse Plugin to Improve Application SecurityWhiteList Checker: An Eclipse Plugin to Improve Application Security
WhiteList Checker: An Eclipse Plugin to Improve Application Security
guest032fe5
 
Namespaces in C#
Namespaces in C#Namespaces in C#
Namespaces in C#
yogita kachve
 
PHP 5
PHP 5PHP 5
.NET Attributes and Reflection - What a Developer Needs to Know...
.NET Attributes and Reflection - What a Developer Needs to Know....NET Attributes and Reflection - What a Developer Needs to Know...
.NET Attributes and Reflection - What a Developer Needs to Know...
Dan Douglas
 
Add on packages
Add on packagesAdd on packages
Add on packages
Carlos Rico
 
Let's start with Java- Basic Concepts
Let's start with Java- Basic ConceptsLet's start with Java- Basic Concepts
Let's start with Java- Basic Concepts
Aashish Jain
 
Character stream classes .52
Character stream classes .52Character stream classes .52
Character stream classes .52myrajendra
 
Java chapter 3 - OOPs concepts
Java chapter 3 - OOPs conceptsJava chapter 3 - OOPs concepts
Java chapter 3 - OOPs concepts
Mukesh Tekwani
 
Entity Framework 4
Entity Framework 4Entity Framework 4
Entity Framework 4
richardrflores1
 
RESTFul Web API Services @ DotNetToscana
RESTFul Web API Services @ DotNetToscanaRESTFul Web API Services @ DotNetToscana
RESTFul Web API Services @ DotNetToscana
Matteo Baglini
 
Various io stream classes .47
Various io stream classes .47Various io stream classes .47
Various io stream classes .47myrajendra
 
C# Framework class library
C# Framework class libraryC# Framework class library
C# Framework class library
Prem Kumar Badri
 
Character stream classes introd .51
Character stream classes introd  .51Character stream classes introd  .51
Character stream classes introd .51myrajendra
 
Java platform
Java platformJava platform
Java platform
Visithan
 
Aloa - A Web Services Driven Framework for Automatic Learning Objcet Annotation
Aloa - A Web Services Driven Framework for Automatic Learning Objcet AnnotationAloa - A Web Services Driven Framework for Automatic Learning Objcet Annotation
Aloa - A Web Services Driven Framework for Automatic Learning Objcet Annotation
Mohamed Amine Chatti
 

What's hot (20)

Flex and PHP For the Flash Folks
Flex and PHP For the Flash FolksFlex and PHP For the Flash Folks
Flex and PHP For the Flash Folks
 
C# Unit 2 notes
C# Unit 2 notesC# Unit 2 notes
C# Unit 2 notes
 
Java Basics
Java BasicsJava Basics
Java Basics
 
WhiteList Checker: An Eclipse Plugin to Improve Application Security
WhiteList Checker: An Eclipse Plugin to Improve Application SecurityWhiteList Checker: An Eclipse Plugin to Improve Application Security
WhiteList Checker: An Eclipse Plugin to Improve Application Security
 
Namespaces in C#
Namespaces in C#Namespaces in C#
Namespaces in C#
 
PHP 5
PHP 5PHP 5
PHP 5
 
.NET Attributes and Reflection - What a Developer Needs to Know...
.NET Attributes and Reflection - What a Developer Needs to Know....NET Attributes and Reflection - What a Developer Needs to Know...
.NET Attributes and Reflection - What a Developer Needs to Know...
 
Add on packages
Add on packagesAdd on packages
Add on packages
 
Let's start with Java- Basic Concepts
Let's start with Java- Basic ConceptsLet's start with Java- Basic Concepts
Let's start with Java- Basic Concepts
 
Character stream classes .52
Character stream classes .52Character stream classes .52
Character stream classes .52
 
Java chapter 3 - OOPs concepts
Java chapter 3 - OOPs conceptsJava chapter 3 - OOPs concepts
Java chapter 3 - OOPs concepts
 
Entity Framework 4
Entity Framework 4Entity Framework 4
Entity Framework 4
 
RESTFul Web API Services @ DotNetToscana
RESTFul Web API Services @ DotNetToscanaRESTFul Web API Services @ DotNetToscana
RESTFul Web API Services @ DotNetToscana
 
Various io stream classes .47
Various io stream classes .47Various io stream classes .47
Various io stream classes .47
 
Live API Documentation
Live API Documentation Live API Documentation
Live API Documentation
 
C# Framework class library
C# Framework class libraryC# Framework class library
C# Framework class library
 
Character stream classes introd .51
Character stream classes introd  .51Character stream classes introd  .51
Character stream classes introd .51
 
Java chapter 3
Java   chapter 3Java   chapter 3
Java chapter 3
 
Java platform
Java platformJava platform
Java platform
 
Aloa - A Web Services Driven Framework for Automatic Learning Objcet Annotation
Aloa - A Web Services Driven Framework for Automatic Learning Objcet AnnotationAloa - A Web Services Driven Framework for Automatic Learning Objcet Annotation
Aloa - A Web Services Driven Framework for Automatic Learning Objcet Annotation
 

Similar to Mule soft meetup_4_mty_online_oct_2020

REST != WebAPI
REST != WebAPIREST != WebAPI
REST != WebAPI
Dan (Danut) Prisacaru
 
RAML
RAMLRAML
Api design part 1
Api design part 1Api design part 1
Api design part 1
Ibrahim Elsawaf
 
Dublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptxDublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptx
Kunal Gupta
 
MuleSoft Surat Virtual Meetup#9 - RAML Reusability and Simplified
MuleSoft Surat Virtual Meetup#9 - RAML Reusability and SimplifiedMuleSoft Surat Virtual Meetup#9 - RAML Reusability and Simplified
MuleSoft Surat Virtual Meetup#9 - RAML Reusability and Simplified
Jitendra Bafna
 
mulesoft birmingham meetup_api_designing_with_raml
mulesoft birmingham meetup_api_designing_with_ramlmulesoft birmingham meetup_api_designing_with_raml
mulesoft birmingham meetup_api_designing_with_raml
mohammadsakifuddin
 
Best practices and advantages of REST APIs
Best practices and advantages of REST APIsBest practices and advantages of REST APIs
Best practices and advantages of REST APIs
Aparna Sharma
 
Innovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC IntegrationsInnovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC Integrations
Steve Speicher
 
API Docs with OpenAPI 3.0
API Docs with OpenAPI 3.0API Docs with OpenAPI 3.0
API Docs with OpenAPI 3.0
Fabrizio Ferri-Benedetti
 
Content Strategy and Developer Engagement for DevPortals
Content Strategy and Developer Engagement for DevPortalsContent Strategy and Developer Engagement for DevPortals
Content Strategy and Developer Engagement for DevPortals
Axway
 
The DNA of a great API
The DNA of a great APIThe DNA of a great API
The DNA of a great API
Ciprian Sorlea CSM-CSPO
 
Microservices&amp;ap imanagement
Microservices&amp;ap imanagementMicroservices&amp;ap imanagement
Microservices&amp;ap imanagement
pramodkumards
 
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorialO'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorialTom Hofte
 
Practices and Tools for Building Better APIs
Practices and Tools for Building Better APIsPractices and Tools for Building Better APIs
Practices and Tools for Building Better APIs
Peter Hendriks
 
IRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce SiteIRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce Site
IRJET Journal
 
Raptor 2
Raptor 2Raptor 2
Practices and tools for building better APIs
Practices and tools for building better APIsPractices and tools for building better APIs
Practices and tools for building better APIsNLJUG
 
Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)
Peter Hendriks
 
Building scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftBuilding scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thrift
Talentica Software
 

Similar to Mule soft meetup_4_mty_online_oct_2020 (20)

REST != WebAPI
REST != WebAPIREST != WebAPI
REST != WebAPI
 
RAML
RAMLRAML
RAML
 
Api design part 1
Api design part 1Api design part 1
Api design part 1
 
Dublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptxDublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptx
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
MuleSoft Surat Virtual Meetup#9 - RAML Reusability and Simplified
MuleSoft Surat Virtual Meetup#9 - RAML Reusability and SimplifiedMuleSoft Surat Virtual Meetup#9 - RAML Reusability and Simplified
MuleSoft Surat Virtual Meetup#9 - RAML Reusability and Simplified
 
mulesoft birmingham meetup_api_designing_with_raml
mulesoft birmingham meetup_api_designing_with_ramlmulesoft birmingham meetup_api_designing_with_raml
mulesoft birmingham meetup_api_designing_with_raml
 
Best practices and advantages of REST APIs
Best practices and advantages of REST APIsBest practices and advantages of REST APIs
Best practices and advantages of REST APIs
 
Innovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC IntegrationsInnovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC Integrations
 
API Docs with OpenAPI 3.0
API Docs with OpenAPI 3.0API Docs with OpenAPI 3.0
API Docs with OpenAPI 3.0
 
Content Strategy and Developer Engagement for DevPortals
Content Strategy and Developer Engagement for DevPortalsContent Strategy and Developer Engagement for DevPortals
Content Strategy and Developer Engagement for DevPortals
 
The DNA of a great API
The DNA of a great APIThe DNA of a great API
The DNA of a great API
 
Microservices&amp;ap imanagement
Microservices&amp;ap imanagementMicroservices&amp;ap imanagement
Microservices&amp;ap imanagement
 
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorialO'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
 
Practices and Tools for Building Better APIs
Practices and Tools for Building Better APIsPractices and Tools for Building Better APIs
Practices and Tools for Building Better APIs
 
IRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce SiteIRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce Site
 
Raptor 2
Raptor 2Raptor 2
Raptor 2
 
Practices and tools for building better APIs
Practices and tools for building better APIsPractices and tools for building better APIs
Practices and tools for building better APIs
 
Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)
 
Building scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftBuilding scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thrift
 

Recently uploaded

Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 

Recently uploaded (20)

Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 

Mule soft meetup_4_mty_online_oct_2020

  • 1. Oct 23, 2020 Monterrey MuleSoft Meetup Group Use of DataType and Library Fragments with API Designer
  • 2. 2 ● Introductions ● Design your API with API Designer ● Create Fragments In RAML 1.0 ● Modularizing APIs and Reusing Patterns in API’s ● Q/A ● What’s next Agenda
  • 3. 3 ●About the organizer: Introductions A SHOW OF HANDS: Who is new to this Meetup? Veyra Gutiérrez Martínez in/veyra-celina-532bb88 • Studies in Computer Science. Started working with Mulesoft about a 3 years ago. My experience in Integrations development drove me to enter to this MuleSoft world, that I found awesome. • Experience in different industries as. • CMT • Manufacturing • Electric and gas • Mulesoft fundamentals trainer
  • 4. subtitle Design your API with API Designer
  • 5. 5 ● API & Integration Methodology. MuleSoft’s AnyPoint Platform API • Design an API: Designing an API first before actually building is often referred to as spec driven development, in this development process your application is built in two phases: the design phase and the development phase
  • 6. Design ● API Designer – it is web-based tool to design API’s REST interfaces or specifications as per the requirement. While creating the interface it will validate the interface for any syntax error and highlight the same. It also show the tab to validate the interface where it show the mock interface 6
  • 7. Mocking ● Mock Service – it is again one of the feature in Design Center through which we can quickly validate the API specification. This only provide the Mock API without any actual implementation and developer can validate request and response of the API 7
  • 8. APIs ● Let's talk about API First……….. ● What is API ? 8 An Application Programming Interface (API) provides the information for how to communicate with a software component and define functionalities independent of implementations. Operations (What to call?) Inputs (What to send with call?) Outputs (What you get from a call?) Data Types (What to expect receive and send?) API • The term API is often used to refer any part of a RESTful web service • The web service specification • The web service interface implementing the API • The web service implementation itself • A proxy • Some benefits are: • Provides Standard interface for communication • They are Reusable and Easy to use • Provides a layer of security - Hides the specifics of the systems talking to each other - Client is never fully exposed to the server - Server is never fully exposed to your Client. • APIs make it easy to efficiently share data and processes Web Service API Specification API Implementation
  • 9. REST APIs ● Let's talk about REST APIs……….. ● What is REST? 9 REpresentational State Transfer (REST) is a software architectural style that defines a set of constraints to be used for creating Web services. Those web services that follow this architecture are known as RESTful Web services Http Methods o Http Verbs Resource o Entity that can be identified, named, addressed, handled, or performed Response o Http code Content Type o Format Json, XML, HTML, etc API • REST APIs are distinguished by their strong reliance on the HTTP application protocol. That is, they use the HTTP response codes and methods for a specific and widely recognized function. And it allows us through the URI, the structuring of the available resources. • REST Development Advantages: • Separation between the client and the server • Visibility, reliability and scalability • The REST API is always independent of the type of platform or languages {REST} Json
  • 10. Libraries and DataTypes Fragments Create Fragments In RAML 1.0
  • 11. 11 One of the great things about RAML is modularization. This gives the ability to separate concerns within an API specification. One feature that illustrates this concept quite well is “Typed Fragments”. There are two types of typed fragments that get confused often, namely “Libraries” and “DataTypes”. Fragments Library Fragment DataType Fragment It can hold MULTIPLE types. Libraries are referred to using the uses: statement and a dot notation to refer to a type inside that library It can only hold a SINGLE type. DataTypes are referred to using the !include tag as value of a type #%RAML 1.0 <fragment-type>
  • 12. How to create the RAML fragments ● Login in to Anypoint platform -> Go to design Center ● Click on Create new-> Create fragment ● Provide the fragment name ● Provide the type of fragment
  • 13. DataType Fragment ● Taken from object-oriented programming languages like Java, data types allow the user to define objects and reuse them at any level in a RAML file. ○ You can define types that inherit from other types. ○ You can define multiple properties each of which is declared as a built-in type like string or number. ● Types are split into four families: external, object, array, and scalar. ● You can define a facets (You specialize types based on characteristics of facet values. Examples: minLength, maxLength) ● In a RAML file, we can define simple and complex data types. 13 #%RAML 1.0 DataType
  • 14. Library Fragment ● Libraries are usually defined in an external file, however, also can be defined inline. ● Can hold any number and combination of data types, security schemes, resource types, traits, and annotations. ● Libraries are imported via the top- level uses statement ● A library is referenced by concatenating the library name, a dot (.), and the name of the element (e.g. data type, resource type, trait, etc) e.g. type: library.typeInsideLibrary 14 #%RAML 1.0 Library In RAML, it's possible to organize APIs in a more readable way by using of libraries
  • 15. subtitle Modularizing APIs and Reusing Patterns in API’s
  • 16. Divide, reuse and conquer ● Avoid to design one huge API file with everything on it, divide instead. ● Create reusable file fragments which can be used later across your organization. ● Conquer the Spec Driven Development driven, using best practices to develop and maintain large software programs, by breaking them up into smaller parts. 16 APIs
  • 17. 17 How you can break your RAML API definition into modules by making use of typed fragments?. ○ Use of include key word to modularize a complex property value in a RAML definition by placing the property value in an external file ○ Rather than placing all the types, resource types or traits in their own respective include files, you can also use special types of includes known as typed fragments to break each of these constructs into multiple include files, specifying a different file for each type, resource type or trait. Break your RAML Fragment Identifier Description DataType A data type declaration where the type node may be used NamedExample A declaration of the examples facet, whose key is a name of an example and whose value describes the example ResourceType A single resource type declaration. ResourceType is basically a template that is used to define the descriptions, methods, and parameters that can be used by multiple resources without writing the duplicate code or repeating code Trait A single trait declaration. Traits is like function and is used to define common attributes for HTTP method (GET, PUT, POST, PATCH, DELETE). SecurityScheme A definition of a security scheme. A security scheme is used to secure data access, identify requests, and determine access level and data visibility Library A RAML library. A library is used to modularize any number and combination of data types, security schemes, resource types, traits, and annotations Overlay An overlay file. An overlay is used to extend non-behavioral aspects of an API, such as descriptions, usage directions, and user documentation items Extension An extension file. An extension is used to extend or override behavioral aspects of the API
  • 19. Example ● Given the entities types Foo and Bar, define basic CRUD operations and a couple of query operations. Here are the resources that we will define for our API: • GET /api/v1/foos • POST /api/v1/foos • GET /api/v1/foos/{fooId} • PUT /api/v1/foos/{fooId} • DELETE /api/v1/foos/{fooId} • GET /api/v1/foos/name/{name} • GET /api/v1/foos?name={name}&ownerName={ownerName} • GET /api/v1/bars • POST /api/v1/bars • GET /api/v1/bars/{barId} • PUT /api/v1/bars/{barId} • DELETE /api/v1/bars/{barId} • GET /api/v1/bars/fooId/{fooId}
  • 20. Example ● Let’s the modularization begin... ● Where do I begin? 20 • Security.- Safety first, Let’s define a what type of authentication mechanism will use our API. #%RAML 1.0 SecurityScheme 1. Login in to Anypoint platform -> Go to design Center 2. Click on Create new-> Create fragment 3. Provide the fragment name: basicAuth_sample 4. Provide the type of fragment: Security Scheme • Authentication mechanisms  Basic Authentication  Basic Auhtentication Client ID enforcement  OAuth 2.0  Custom token
  • 21. Example ● Security check!! ● What’s next? 21 • DataTypes.- Next, we'll define the data types that our API will use: Foo, Bar and Error. #%RAML 1.0 DataType 1. Login in to Anypoint platform -> Go to design Center 2. Click on Create new-> Create fragment 3. Provide the fragment name: Foo 4. Provide the type of fragment: Data Type 1. Click on the ‘+’ icon and select “New File” 2. Provide the type of fragment: Data Type 3. Provide the fragment name: Bar; Error; Foo
  • 22. Example ● Data Types Done!! ● What’s next? 22 • Library.- Next, we'll define the library or libraries that our API will use: For data types, security schemes, traits, resources types, etc. #%RAML 1.0 Library 1. Login in to Anypoint platform -> Go to design Center 2. Click on Create new-> Create fragment 3. Provide the fragment name: dataTypes 4. Provide the type of fragment: Library 1. Click on the ‘+’ icon and select “New File” 2. Provide the type of fragment: Library 3. Provide the fragment name: dataTypes
  • 23. Example ● That’s it? ● This is the end? 23 • Find the patterns and organize.- As we read through the list of resources in our API, we begin to see some patterns emerge. When we compare the RAML definitions of the /foos and /bars resources, including the HTTP methods used, we can see several redundancies among the various properties of each, and we again see patterns begin to emerge. Wherever there is a pattern in either a resource or method definition, there is an opportunity to use a RAML fragment like a resource type, trait, example, etc .
  • 24. Q&A
  • 25. Time to earn a pass to take free training course! 25 First Chance!! Which are the four families in which the DataType fragments split into? ¿Cuáles son las 4 familias en las que se dividen los fragmentos DataType? Second Chance!! Which is the key word used to import Libraries and where should be located? ¿Cuál es la palabra clave usada para importer librerías y dónde debe colocarse? Third and Last Chance!! Name other 3 typed fragments besides DataType and Library? ¿Nombre otros 3 tipos de fragmentos además de Tipo de datos y Biblioteca?
  • 26. 26 ● Share: ○ Next Meetup: TBD ○ Stay tune: https://meetups.mulesoft.com/monterrey/ ● Feedback: ○ Don’t forget to fill out the survey feedback ○ Nominate yourself for the next meetup speaker and suggest a topic as well What’s next?
  • 28. References ● https://mulesy.com/create-fragments-in-raml/ ● https://mulesy.com/include-fragments-in-raml/ ● https://mulesy.com/usage-of-library-fragment-in-raml/ ● https://mulesy.com/basic-authentication-simple/ ● https://www.baeldung.com/raml-restful-api-modeling-language-tutorial ● https://www.baeldung.com/simple-raml-with-resource-types-and-traits ● https://www.baeldung.com/modular-raml-includes-overlays-libraries-extensions ● https://medium.com/raml-api/raml-101-libraries-and-datatypes-fragments-1889b2e82c27 ● https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md#typed- fragments ● https://dzone.com/articles/overview-on-raml-10 ● https://dzone.com/articles/understanding-resourcetypes-and-traits-with- raml#:~:text=3.0%20What%20Is%20Traits%3F,filterable%2C%20searchable%2C%20or%20p ageable.