This presentation teach how to design a real-world and pragmatic web API. It draws from the experience Mario Cardinal have gained over the years being involved architecting many Web API. This presentation begins by differencing between a Web and a REST API, and then continue with the design process. We conclude with the core learnings of the session which is a review of the best practices when designing a web API. Armed with skills acquired, you can expect to see significant improvements in your ability to design a pragmatic web API.
Presented by Nikola Vasilev on SkopjeTechMeetup 7.
Representational state transfer (REST) can be thought of as the language of the Internet. Now with cloud usage on the rise, REST is a logical choice for building APIs that allow end users to connect and interact with cloud services. This talk will deliver more insight into the challenges on building and maintaining good and clean RESTful APIs.
This is an introduction to NodeJS which is an open-source, cross-platform run-time environment for developing server-side Web Applications. It also discusses the implications of NodeJS in Internet of Things (IoT).
Presented by Nikola Vasilev on SkopjeTechMeetup 7.
Representational state transfer (REST) can be thought of as the language of the Internet. Now with cloud usage on the rise, REST is a logical choice for building APIs that allow end users to connect and interact with cloud services. This talk will deliver more insight into the challenges on building and maintaining good and clean RESTful APIs.
This is an introduction to NodeJS which is an open-source, cross-platform run-time environment for developing server-side Web Applications. It also discusses the implications of NodeJS in Internet of Things (IoT).
This is a presentation which describe the big picture of the Rest API. In this presentation I simply describe the theories with practical examples. Hope this presentation will cover the overall Rest API domain.
Version 6 of Adobe Experience Manager (AEM 6) is a major release that introduces significant innovations. Sightly is a new template system to be used in place of (or together with) JSP. Along with Sling Models, SIghtly strongly improves the separation between the logic and presentation. The development effort is reduced because a Sightly template is an HTML 5 document, easily maintainable even by front-end developers.
The presentation provides an overview of the basic features of Sightly and introduces the fundamentals of the new development model with the support of tools released release together with AEM 6.
This talk introduces Spring's REST stack - Spring MVC, Spring HATEOAS, Spring Data REST, Spring Security OAuth and Spring Social - while refining an API to move higher up the Richardson maturity model
This presentation talks about the basic types of API, What REST actually is and What are the six principles/architectural constraint that needs to adhere upon. URL Design practices for a developer to create restful API.
Discussed the general OAuth2 features. Reviewer OAuth2 Roles and Grand Flows
Authorization code grant flow
Implicit grant flow
Resource owner password credentials grant flow
Client credentials grant flow
Reviewed access resource flow and token refresh.
see video: https://www.youtube.com/watch?v=UPsVD-A7gP0
The API acronym is everywhere on the Internet. It seems like every great company offers an API. But what is it exactly?
This deck will present you the very concept of API with a simple metaphor, and then will take four exemples of very popular APIs integrated by more popular websites (Airbnb, Uber, etc...).
A deck by Sébastien Saunier, CTO @ Le Wagon (https://www.lewagon.com)
Simple REST-API overview for developers. An newer version is here: https://www.slideshare.net/patricksavalle/super-simple-introduction-to-restapis-2nd-version-127968966
Dynamic Components using Single-Page-Application Concepts in AEM/CQNetcetera
Dynamic components display content dependable on context, hence they cannot be cached.
Out of the box, Adobe Experience Manager doesn't give us many options for granular caching on a component level.
When faced with this problem, we usually resort to developing components that are leveraging Server-Side Includes or AJAX to get the HTML with dynamic data.
As an alternative solution, we have also developed dynamic components that use Single Page Application concepts, by using templates and JSON-responses, to provide the same dynamic behavior.
In this presentation we will cover all of the dynamic components types, compare the benefits and drawbacks of each, and state the use-cases where each can be effectively applied.
We will take a deeper look at the dynamic components done with SPA concepts, as they are rarity in the AEM world, and also provide a walk-through of the technologies used, how some common problems were solved, as well as the benefits that have been gained by their usage.
AEM Best Practices for Component DevelopmentGabriel Walt
This presentation describes how to easily get started with an efficient development workflow with Adobe Experience Manager 6.1.
The tools and technologies presented are:
* Project Archetype – https://github.com/Adobe-Marketing-Cloud/aem-project-archetype
* AEM Eclipse Extension – https://docs.adobe.com/docs/en/dev-tools/aem-eclipse.html
* AEM Brackets Extension – https://docs.adobe.com/docs/en/dev-tools/aem-brackets.html
* Sightly Template Language – http://www.slideshare.net/GabrielWalt/component-development
* Sightly REPL Tool – https://github.com/Adobe-Marketing-Cloud/aem-sightly-repl
* Sightly TodoMVC Example – https://github.com/Adobe-Marketing-Cloud/aem-sightly-sample-todomvc
These slides focus on documentation for REST APIs. See http://idratherbewriting.com for more detail. For the video recording, see http://youtu.be/0yfNd7tzH2Q. This deep dive is the second slide deck I used in the presentation.
These were prepared to teach the module "Emerging Technologies" for the 3rd year Undergraduates of the Asia Pacific Institue of Information Technology, Colombo-2, Sri Lanka (Remotely)
This is a presentation which describe the big picture of the Rest API. In this presentation I simply describe the theories with practical examples. Hope this presentation will cover the overall Rest API domain.
Version 6 of Adobe Experience Manager (AEM 6) is a major release that introduces significant innovations. Sightly is a new template system to be used in place of (or together with) JSP. Along with Sling Models, SIghtly strongly improves the separation between the logic and presentation. The development effort is reduced because a Sightly template is an HTML 5 document, easily maintainable even by front-end developers.
The presentation provides an overview of the basic features of Sightly and introduces the fundamentals of the new development model with the support of tools released release together with AEM 6.
This talk introduces Spring's REST stack - Spring MVC, Spring HATEOAS, Spring Data REST, Spring Security OAuth and Spring Social - while refining an API to move higher up the Richardson maturity model
This presentation talks about the basic types of API, What REST actually is and What are the six principles/architectural constraint that needs to adhere upon. URL Design practices for a developer to create restful API.
Discussed the general OAuth2 features. Reviewer OAuth2 Roles and Grand Flows
Authorization code grant flow
Implicit grant flow
Resource owner password credentials grant flow
Client credentials grant flow
Reviewed access resource flow and token refresh.
see video: https://www.youtube.com/watch?v=UPsVD-A7gP0
The API acronym is everywhere on the Internet. It seems like every great company offers an API. But what is it exactly?
This deck will present you the very concept of API with a simple metaphor, and then will take four exemples of very popular APIs integrated by more popular websites (Airbnb, Uber, etc...).
A deck by Sébastien Saunier, CTO @ Le Wagon (https://www.lewagon.com)
Simple REST-API overview for developers. An newer version is here: https://www.slideshare.net/patricksavalle/super-simple-introduction-to-restapis-2nd-version-127968966
Dynamic Components using Single-Page-Application Concepts in AEM/CQNetcetera
Dynamic components display content dependable on context, hence they cannot be cached.
Out of the box, Adobe Experience Manager doesn't give us many options for granular caching on a component level.
When faced with this problem, we usually resort to developing components that are leveraging Server-Side Includes or AJAX to get the HTML with dynamic data.
As an alternative solution, we have also developed dynamic components that use Single Page Application concepts, by using templates and JSON-responses, to provide the same dynamic behavior.
In this presentation we will cover all of the dynamic components types, compare the benefits and drawbacks of each, and state the use-cases where each can be effectively applied.
We will take a deeper look at the dynamic components done with SPA concepts, as they are rarity in the AEM world, and also provide a walk-through of the technologies used, how some common problems were solved, as well as the benefits that have been gained by their usage.
AEM Best Practices for Component DevelopmentGabriel Walt
This presentation describes how to easily get started with an efficient development workflow with Adobe Experience Manager 6.1.
The tools and technologies presented are:
* Project Archetype – https://github.com/Adobe-Marketing-Cloud/aem-project-archetype
* AEM Eclipse Extension – https://docs.adobe.com/docs/en/dev-tools/aem-eclipse.html
* AEM Brackets Extension – https://docs.adobe.com/docs/en/dev-tools/aem-brackets.html
* Sightly Template Language – http://www.slideshare.net/GabrielWalt/component-development
* Sightly REPL Tool – https://github.com/Adobe-Marketing-Cloud/aem-sightly-repl
* Sightly TodoMVC Example – https://github.com/Adobe-Marketing-Cloud/aem-sightly-sample-todomvc
These slides focus on documentation for REST APIs. See http://idratherbewriting.com for more detail. For the video recording, see http://youtu.be/0yfNd7tzH2Q. This deep dive is the second slide deck I used in the presentation.
These were prepared to teach the module "Emerging Technologies" for the 3rd year Undergraduates of the Asia Pacific Institue of Information Technology, Colombo-2, Sri Lanka (Remotely)
ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework.
ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework.
Video :
https://youtu.be/qwLBeg1CPSo
Courtesy:
http://www.ifourtechnolab.com
Primary focus of this presentation is on the hypermedia as the engine of application state (HATEOAS) and how HTTP APIs may benefit from it. Provides sneak peek into HAL media type & gives an overview of hypermedia support in Java tools (JAX-RS / HalBuilder and Spring HATEOAS) along with practical suggestions for server-side design of hypermedia API. Also includes quick overview of Richardson Maturity Model based on a set of examples, current API trends.
So, you heard "the Web is Programmable, Internet of Things, Digitalization", but have NO to little programming skills. Nevertheless, this is 2016, and you want to get enough about Web Programming to be part of the some fun and exciting Web challenge, participate in an Hackathon may be …
Well, I am happy we meet. I suggest you take the tour “from ZERO to REST in a hour”: we’ll teach you to forge your own HTTP requests against the Github API. After this tour, you’ll know enough to interact with any RESTful Web APIs. Worth mentionning this presentation is entirely scripted: so give attention to each slide comments.
Did you enjoy the tour ? look forward to learn more ?
Post your comments below about enhancements, and for any subjects you’d like to see covered.
2. Join the Cisco developers community : https://developer.cisco.com/
3. Take a free online Coding Lab (REST, Python, Parsing JSON, RAML, Git…)
https://learninglabs.cisco.com/labs/tags/Coding
4. Meet DevNet teams at a physical event: conferences, hackathons
https://developer.cisco.com/site/devnet/events-contests/events/
APIs are one of the main elements of cloud services. All major cloud service providers expose REST APIs to allow you to programmatically access their services and capabilities. SOAP and REST are the two most common ways of exposing APIs, whether to external, partner, cloud, or internal developers.
The concept of API management is to publish these web APIs for consumption, and includes capabilities such as monitoring, security, and documentation.
This presentation introduces basic concepts of APIs, API management, cloud REST services, and a brief walkthrough of WSO2 API Manager and the Oracle API Gateway to see how you can centrally publish, expose, and secure APIs, essentially virtualizing your backend services.
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!Evan Mullins
See the Power of the WP API. Now that every WordPress website has (or will have) an API built-in, what can you do with it? It allows us to further separate the data from the code. Use WordPress to manage our data and then via the API easily access or update that data to power whatever we like. We’ll touch how to set it up and a handful of examples and then explore an iOS app pulling all it’s data and assets from a WordPress site via this API.
This will be geared for developers with some “how to” but also for everyone interested in the power of WordPress and where things are heading.
Learn how to spell WP-API
Learn about the power and flexibility it brings to WordPress
See it working in a live app
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
The field of Information retrieval (IR) is currently undergoing a transformative shift, at least partly due to the emerging applications of generative AI to information access. In this talk, we will deliberate on the sociotechnical implications of generative AI for information access. We will argue that there is both a critical necessity and an exciting opportunity for the IR community to re-center our research agendas on societal needs while dismantling the artificial separation between the work on fairness, accountability, transparency, and ethics in IR and the rest of IR research. Instead of adopting a reactionary strategy of trying to mitigate potential social harms from emerging technologies, the community should aim to proactively set the research agenda for the kinds of systems we should build inspired by diverse explicitly stated sociotechnical imaginaries. The sociotechnical imaginaries that underpin the design and development of information access technologies needs to be explicitly articulated, and we need to develop theories of change in context of these diverse perspectives. Our guiding future imaginaries must be informed by other academic fields, such as democratic theory and critical theory, and should be co-developed with social science scholars, legal scholars, civil rights and social justice activists, and artists, among others.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Best Practices for Architecting a Pragmatic Web API.
1. Best Practices for Architecting
a Pragmatic Web API
Mario Cardinal
Agile Coach & Software Architect
www.mariocardinal.com
@mario_cardinal
October 15
2. Who am I?
• Agile Coach & Software architect
• Co-Founder of Slingboards Lab
• http://mariocardinal.com
3. 3
Content
1. REST – What is it?
2. RESTful or Resource APIs?
3. Resource APIs or Web APIs?
4. Web APIs – Best practices
4. Application Programming Interface (API)
A Web API is a software intermediary that makes
it possible for application programs to interact
with each other and share data.
Often an implementation of REST that exposes a
specific software functionality.
Simple, intuitive and consistent.
Friendly to the developer.
Explorable via HTTP tool.
4
API
5. REST – What is it?
An architectural style (extends client-server)
introduced by Roy Fielding
Defines a set of constraints influenced from
the architecture of the Web
URLs represent resources
Clients interact with resources via a uniform
interface
Messages are self-descriptive (ContentType)
Services are stateless
Hypermedia (i.e. href tags) drive application state5
6. A more lightweight way to build
services (API)
Using URLs to build on Web experience
http://myservice.com/api/resources
http://myservice.com/api/resources/{id}
http://myservice.com/api/resources/{id}/relation
HTTP verbs
GET, POST, PUT, PATCH, DELETE
Manage errors at the transport level
6
7. Uniform Interfaces (HTTP Verbs)
GET
POST
PUT
PATCH Updates an existing resource (partially)
DELETE
Retrieves a resource
Guaranteed not to cause side-effects (SAFE)
Results are cacheable
Creates a new resource (process state)
Unsafe: effect of this verb isn’t defined by HTTP
Updates an existing resource
Used for resource creation when client knows URI
Can call N times, same thing will always happen (idempotent)
Can call N times, same thing will always happen (idempotent)
Removes a resource
Can call N times, same thing will always happen (idempotent)
9. Resources are nouns
http://myservice.com/api/stickyNotes
Verb: GET
Action: Retrieves a list of sticky notes
http://myservice.com/api/stickyNotes/12
Verb: GET
Action: Retrieves a specific sticky note
http://myservice.com/api/stickyNotes
Verb: POST
Action: Creates a new sticky note
9
12. Rather, most “RESTful APIs” are really
“Resource APIs”
http://ServiceDesignPatterns.com/WebServiceAPIStyles/ResourceAPI
again, not a bad thing at all.
Resource APIs totally rock !!!
14. Stateless and cacheable response
Resource APIs allow the use of cookies
Cookies create session state that are partly store
on the client (user identification) and on the server
(the state).
Any response with a Set-Cookie header force the client
to send the cookie in every subsequent HTTP request
Cookies interfere with cacheable response
Any response with a Set-Cookie header should not be
cached, at least not the headers, since this can
interfere with user identification and create security
problems 14
15. Hypermedia constraint
Hypermedia as the Engine of Application
State (HATEOAS)
Hypermedia constraint states that interaction with
an endpoint should be defined within metadata
returned with the output (URL)
Apply state transitions (at run time) by following
links
Resource APIs allow URL to be known when
code is written, and not discover at run time
15
16. Most so-called Web APIs
are Resource APIs
http://en.wikipedia.org/wiki/Web_API
again, not a bad thing at all.
Web APIs totally rock !!!
17. 17
Web APIs – Best practices
1. URL EndPoint
Resources
Version
2. Message Body
Content-Type
3. Error handling
HTTP Status Code
4. Security
5. Documentation
18. URL identifies a resource
Endpoint name should be plural
stickyNotes, collaborators
Do not forget relations (business domain)
GET /api/stickynotes/12/collaborators - Retrieves list of
collaborators for sticky note #12
GET /api/stickynotes/12/collaborators/5 - Retrieves
collaborator #5 for sticky note #12
POST /api/stickynotes/12/collaborators - Creates a new
collaborator in sticky note #12
PUT /api/stickynotes/12/collaborators/5 - Updates
collaborator #5 for sticky note #12 18
19. Verbs (actions) as resources
Actions that don't fit into the world of CRUD
operations can be endpoint
Change state with ToDo, InProgress or Done
action
Mark a sticky note in progress with PUT
/stikyNotes/:id/inProgress
GitHub's API
star a gist with PUT /gists/:id/star
unstar with DELETE /gists/:id/star
19
20. Use Query to simplify resources
Keep the base resource URLs lean by
implementing query parameters on top of the
base URL
Result filtering, sorting & searching
GET /api/stickyNotes?q=return&state=ToDo&sort=-
priority,created_at
Limiting which fields are returned by the API
GET
/api/stickyNotes?fields=id,subject,state,collaborator,up
dated_at&state=InProgress&sort=-updated_at
20
21. Paginate using link headers
Return a set of ready-made links so the API
consumer doesn't have to construct links
themselves
The right way to include pagination details
today is using the ‘Link header’ introduced by
RFC 5988
21
Link header:
<https://api.github.com/user/repos?page=3&per_page=100>; rel="next",
<https://api.github.com/user/repos?page=50&per_page=100>; rel="last"
22. Versioning
Version via the URL, not via headers
http://api.myservice.com/v1/stickynotes
http://myservice.com/v1/stickynotes
Benefits
Simple implementation
Ensure browser explorability
Issues
URL representing a resource is NOT stable across
versions 22
23. Message (Content-type)
JavaScript Object Notation (JSON) is the
preferred resource representation
It is lighter than XML but as easy for humans to
read and write
No parsing is needed with JavaScript clients
Requiring Content-Type JSON
POST, PUT & PATCH requests should also
require the Content-Type header be set to
application/json or throw a 415 Unsupported
Media Type HTTP status code 23
24. Message (Content-type)
A JSON object is an unordered set of
name/value pairs
Squiggly brackets act as 'containers'
Square brackets holds arrays
Names and values are separated by a colon.
Array elements are separated by commas
24
var myJSONObject =
{ "web":[ { "name": "html", "years": "5" },
{ "name": "css", "years": "3" }]
"db":[ { "name": "sql", "years": "7" }]
}
25. Message (Content-type)
camelCase for field names
Follow JavaScript naming conventions
Do not pretty print by default
Gzip by default
Gzipping provided over 60% in bandwidth savings
Always set the Accept-Encoding header
25
{“customerData" : {"id" : 123, "name" : "John" }}
Header:
Accept-Encoding: gzip
26. Message (Post, Put and Patch)
Updates & creation should return a resource
representation
To prevent an API consumer from having to hit the
API again for an updated representation, have the
API return the updated (or created) representation
as part of the response
In case of a POST that resulted in a creation, use
a HTTP 201 status code and include a Location
header that points to the URL of the new resource
26
27. HTTP caching header
Time-based (Last-Modified)
When generating a request, include a HTTP
header Last-Modified
if an inbound HTTP requests contains a If-
Modified-Since header, the API should return a
304 Not Modified status code instead of the output
representation of the resource
Content-based (ETag)
This tag is useful when the last modified date is
difficult to determine
27
28. HTTP Rate limiting header
Include the following headers (using Twitter's
naming conventions as headers typically don't
have mid-word capitalization):
X-Rate-Limit-Limit - The number of allowed
requests in the current period
X-Rate-Limit-Remaining - The number of
remaining requests in the current period
X-Rate-Limit-Reset - The number of seconds left
in the current period
28
29. HTTP status codes
200 OK - Response to a successful GET, PUT, PATCH or
DELETE. Can also be used for a POST that doesn't result
in a creation.
201 Created - Response to a POST that results in a
creation. Should be combined with a Location header
pointing to the location of the new resource
204 No Content - Response to a successful request that
won't be returning a body (like a DELETE request)
304 Not Modified - Used when HTTP caching headers
are in play
29
30. HTTP status codes
400 Bad Request - The server cannot or will not process
the request due to something that is perceived to be a
client error
401 Unauthorized - When no or invalid authentication
details are provided. Also useful to trigger an auth popup
if the API is used from a browser
403 Forbidden - When authentication succeeded but
authenticated user doesn't have access to the resource
404 Not Found - When a non-existent resource is
requested
405 Method Not Allowed - When an HTTP method isn't
allowed for the authenticated user 30
31. HTTP status codes
409 Conflict - The request could not be completed due to
a conflict with the current state of the resource
410 Gone - Indicates that the resource at this end point is
no longer available. Useful as a blanket response for old
API versions
415 Unsupported Media Type - If incorrect content type
was provided as part of the request
422 Unprocessable Entity - Used for validation errors
429 Too Many Requests - When a request is rejected due
to rate limiting
31
33. Security
Authentication
Never encode authentication on the URI
Always identify the caller in the HTTP header
Each request should come with authentication
credentials
Basic authentication over HTTPS
33
34. Basic authentication over HTTPS
Create a string with username and password
in the form ”username:password”
Convert that string to a base64 encoded string
Prepend the word “Basic” and a space to that
base64 encoded string
Set the HTTP request’s Authorization header
with the resulting string
34
Header:
Authorization: Basic anNtaXRoOlBvcGNvcm4=
35. Security
Autorization
Return HTTP 403 Status Code if not authorized
If necessity, use the body to provide more info
35
HTTP/1.1
403
Forbidden
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/7.0
Date: Sat, 14 Jan 2012 04:00:08 GMT
Content-Length: 251
{
“code" : 123,
“description" : "You are not allowed to read this resource"
}
36. Documentation
An API is only as good as its documentation
Docs should be easy to find
http://myservice.com/api/help
Docs should show examples of complete
request/response cycles
Docs should provide error code
HTTP 4xx and 5xx Status Code
Error Code for HTTP 409 Status Code
The holy grail for Web API is an auto-generated,
always up-to-date, stylish documentation 36
37. Documentation
37
URI https://mysite.com:3911/api/members/{id}
HTTP verb PUT
Parameters id : Card number of the member.
Body
name : Name of the member.
email : Email adress of the member.
langage : Langage used by member (Fr_CA ou En_US)
Sample body
{
"name":"Mario Cardinal",
"email":“mcardinal@mariocardinal.com",
"language":"fr_CA"
}
Success
Response
Status Code: 204 No Content
Error Response
Status Code: 400 Bad Request, Body: {"Error Code":"..."}
Status Code: 401 Unauthenticated, see WWW-Authenticate value in header
Status Code: 403 Forbidden
Status Code: 404 Not Found
Status Code: 429 Too Many Requests, see Retry-After value in header
Status Code: 500 Internal Server Error
Status Code: 503 Service Unavailable
Error Code
10: Inactive member
20: Denied access member
110: Database issues, Retry later
38. 38
Do not hesitate to contact me
mcardinal@mariocardinal.com
@mario_cardinal
Q & A
Editor's Notes
8 minutesKeeps people from ‘making up’ verbs Don’t need to decide on the ‘correct’ method names for the API making up names is hard – see the annotated .Net Framework bookBreaking these rules can cause problems GET is supposed to not cause side-effects But if this is no true on your pages, then spidering causes problemsIdempotent – has a side effect, but the side effect is well knownPOST is used to create a resource where the server needs to define the URICachability lends itself to etagging Conditional GET implies a full get ONLY if the etags have changedCan’t get the same scale using SOAP