SlideShare a Scribd company logo
Exception Mapping
using APIKit
Federico Amdan
What is the exception mapping?
- If you are creating an API using Mule, there will be times
when you have to throw an exception. If you want to
provide a better comment of what is going on inside of
your code, you should explain it in a REST way, using an
status code, a response comment and the content type of
it. This is when the exception mapping comes handy.
Structure
Each exception mapping is declared with the following
attributes:
Status code <apikit:mapping statusCode="400"> Used to indicate the status number.
Exception value: <apikit:exception value="org.mule.module.apikit.exception.BadRequestException" />
Used to indicate the exception that will call this mapping.
Content-Type: <set-property propertyName="Content-Type" value="application/json" doc:name="
Property" /> Used to indicate the content - type of the payload
Payload: <set-payload value="{ &quot;message&quot;: &quot;Bad request&quot; }" doc:name="Set
Payload" /> Used to indicate the message of the error.
Auto-generated mapping
Creating your own mapping
- Determine which exception will produce the error
- The exceptions can only be declared once in the
exception mapping
- Choose the status code and message of the error.
- Optionally, you can add the content-type of the error
message.
Questions?
Thanks!!

More Related Content

PPT
2010 08-26-smart-architecture
PDF
Sub ID Implementation
PDF
FiNCのWeb API開発事情
PDF
Lab - AWS Cross Account Access
PDF
The Fault in Our Stars - Attack Vectors for APIs Using Amazon API Gateway Lam...
PDF
Application Server-less Web Applications - Serverless Toronto Meetup
PDF
Design Web Api
PPTX
App Manifest
2010 08-26-smart-architecture
Sub ID Implementation
FiNCのWeb API開発事情
Lab - AWS Cross Account Access
The Fault in Our Stars - Attack Vectors for APIs Using Amazon API Gateway Lam...
Application Server-less Web Applications - Serverless Toronto Meetup
Design Web Api
App Manifest

What's hot (15)

PPTX
ASP.NET MVC One Step Deeper
PPTX
API Design choices
PDF
Akka Presentation Schule@synyx
PDF
Serverless - Developers.IO 2019
PDF
PDF
Building APIs That Last for Decades - Irakli Nadareishvili, Director of API S...
PDF
Mobile phone future angular js
PPTX
SPA using Rails & Backbone
PDF
Angular components
PPTX
Tips and Tricks for new async web client capabilities on model driven apps
PDF
Angular routing
PPTX
Indonesia data-lake
PDF
iOS_Presentation
KEY
Enter the app era with ruby on rails (rubyday)
PPTX
Controllers in AngularJs
ASP.NET MVC One Step Deeper
API Design choices
Akka Presentation Schule@synyx
Serverless - Developers.IO 2019
Building APIs That Last for Decades - Irakli Nadareishvili, Director of API S...
Mobile phone future angular js
SPA using Rails & Backbone
Angular components
Tips and Tricks for new async web client capabilities on model driven apps
Angular routing
Indonesia data-lake
iOS_Presentation
Enter the app era with ruby on rails (rubyday)
Controllers in AngularJs
Ad

Similar to Exception mapping using api kit (20)

PPTX
API gateway setup
PDF
Retrofit Library In Android
PDF
Retrofit library for android
PPTX
AWS CloudFormation Intrinsic Functions and Mappings
KEY
RESTful Api practices Rails 3
PPT
Aws Lambda Cart Microservice Server Less
PPTX
Creating asynchronous flows on AWS
PDF
AWS Step Function with API Gateway Integration - Metin Kale, Chicago
ODP
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
PDF
Ams adapters
PDF
Scalable and Fault-Tolerant Apps with AWS
ODP
Top 10 Web Security Vulnerabilities
PPTX
Play Your API with MuleSoft API Notebook
PDF
api-platform: the ultimate API platform
PDF
java and javascript api dev guide
PDF
Was jede*r über skalierbare Infrastruktur mit CQRS, Eventstore und Kubernetes...
PDF
How to build integrated, professional enterprise-grade cross-platform mobile ...
PDF
Security enforcement of Microservices with API Management
PPTX
Top 10 Techniques For React Performance Optimization in 2022.pptx
PPTX
Designing REST API automation tests in Kotlin
API gateway setup
Retrofit Library In Android
Retrofit library for android
AWS CloudFormation Intrinsic Functions and Mappings
RESTful Api practices Rails 3
Aws Lambda Cart Microservice Server Less
Creating asynchronous flows on AWS
AWS Step Function with API Gateway Integration - Metin Kale, Chicago
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Ams adapters
Scalable and Fault-Tolerant Apps with AWS
Top 10 Web Security Vulnerabilities
Play Your API with MuleSoft API Notebook
api-platform: the ultimate API platform
java and javascript api dev guide
Was jede*r über skalierbare Infrastruktur mit CQRS, Eventstore und Kubernetes...
How to build integrated, professional enterprise-grade cross-platform mobile ...
Security enforcement of Microservices with API Management
Top 10 Techniques For React Performance Optimization in 2022.pptx
Designing REST API automation tests in Kotlin
Ad

More from fedefortin (6)

PDF
Deploying a proxy to cloudhub using api platform
PDF
Api gateway basic auth policy
PDF
Api gateway policies ip blacklist/whitelist
PDF
Apikit in studio
PDF
Domains in apikit
PDF
Apikit from command line
Deploying a proxy to cloudhub using api platform
Api gateway basic auth policy
Api gateway policies ip blacklist/whitelist
Apikit in studio
Domains in apikit
Apikit from command line

Recently uploaded (20)

PDF
Well-logging-methods_new................
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
OOP with Java - Java Introduction (Basics)
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
Digital Logic Computer Design lecture notes
PPTX
Geodesy 1.pptx...............................................
PPT
introduction to datamining and warehousing
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Artificial Intelligence
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPT
Project quality management in manufacturing
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
Sustainable Sites - Green Building Construction
Well-logging-methods_new................
Foundation to blockchain - A guide to Blockchain Tech
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
OOP with Java - Java Introduction (Basics)
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Digital Logic Computer Design lecture notes
Geodesy 1.pptx...............................................
introduction to datamining and warehousing
Operating System & Kernel Study Guide-1 - converted.pdf
CYBER-CRIMES AND SECURITY A guide to understanding
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Artificial Intelligence
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Project quality management in manufacturing
Automation-in-Manufacturing-Chapter-Introduction.pdf
Sustainable Sites - Green Building Construction

Exception mapping using api kit

  • 2. What is the exception mapping? - If you are creating an API using Mule, there will be times when you have to throw an exception. If you want to provide a better comment of what is going on inside of your code, you should explain it in a REST way, using an status code, a response comment and the content type of it. This is when the exception mapping comes handy.
  • 3. Structure Each exception mapping is declared with the following attributes: Status code <apikit:mapping statusCode="400"> Used to indicate the status number. Exception value: <apikit:exception value="org.mule.module.apikit.exception.BadRequestException" /> Used to indicate the exception that will call this mapping. Content-Type: <set-property propertyName="Content-Type" value="application/json" doc:name=" Property" /> Used to indicate the content - type of the payload Payload: <set-payload value="{ &quot;message&quot;: &quot;Bad request&quot; }" doc:name="Set Payload" /> Used to indicate the message of the error.
  • 5. Creating your own mapping - Determine which exception will produce the error - The exceptions can only be declared once in the exception mapping - Choose the status code and message of the error. - Optionally, you can add the content-type of the error message.