100% found this document useful (2 votes)
14 views

Get Web API Development for the Absolute Beginner A Step by step Approach to Learning the Fundamentals of Web API Development with NET 7 1st Edition Irina Dominte PDF ebook with Full Chapters Now

Learning

Uploaded by

sanzokoboka
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
14 views

Get Web API Development for the Absolute Beginner A Step by step Approach to Learning the Fundamentals of Web API Development with NET 7 1st Edition Irina Dominte PDF ebook with Full Chapters Now

Learning

Uploaded by

sanzokoboka
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

Download Full ebookname - Read Now at ebookname.

com

Web API Development for the Absolute Beginner A


Step by step Approach to Learning the Fundamentals
of Web API Development with NET 7 1st Edition
Irina Dominte
https://ebookname.com/product/web-api-development-for-the-
absolute-beginner-a-step-by-step-approach-to-learning-the-
fundamentals-of-web-api-development-with-net-7-1st-edition-
irina-dominte/

OR CLICK BUTTON

DOWLOAD EBOOK

Discover More Ebook - Explore Now at ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

ASP NET Web API 2 2nd Edition Jamie Kurtz

https://ebookname.com/product/asp-net-web-api-2-2nd-edition-jamie-
kurtz/

ebookname.com

ASP NET Web API 2 Recipes A Problem Solution Approach 1st


Edition Filip Wojcieszyn (Auth.)

https://ebookname.com/product/asp-net-web-api-2-recipes-a-problem-
solution-approach-1st-edition-filip-wojcieszyn-auth/

ebookname.com

Practical ASP NET Web API 1st Edition Badrinarayanan


Lakshmiraghavan (Auth.)

https://ebookname.com/product/practical-asp-net-web-api-1st-edition-
badrinarayanan-lakshmiraghavan-auth/

ebookname.com

Restless Giant The United States from Watergate to Bush vs


Gore 1St Edition Edition James T. Patterson

https://ebookname.com/product/restless-giant-the-united-states-from-
watergate-to-bush-vs-gore-1st-edition-edition-james-t-patterson/

ebookname.com
An introduction to invariants and moduli 1st Edition
Shigeru Mukai

https://ebookname.com/product/an-introduction-to-invariants-and-
moduli-1st-edition-shigeru-mukai/

ebookname.com

Consciousness Theatre Literature and the Arts 2013 1st


Edition Daniel Meyer-Dinkgrafe

https://ebookname.com/product/consciousness-theatre-literature-and-
the-arts-2013-1st-edition-daniel-meyer-dinkgrafe/

ebookname.com

Science of Memory Concepts 1st Edition Henry L. Roediger


Iii

https://ebookname.com/product/science-of-memory-concepts-1st-edition-
henry-l-roediger-iii/

ebookname.com

Maternal Child Nursing 4th Edition Emily Slone Mckinney


Msn Rn C

https://ebookname.com/product/maternal-child-nursing-4th-edition-
emily-slone-mckinney-msn-rn-c/

ebookname.com

Applied EI The Importance of Attitudes in Developing


Emotional Intelligence 1st Edition Tim Sparrow

https://ebookname.com/product/applied-ei-the-importance-of-attitudes-
in-developing-emotional-intelligence-1st-edition-tim-sparrow/

ebookname.com
The First Modern Jew Spinoza and the History of an Image
Daniel B. Schwartz

https://ebookname.com/product/the-first-modern-jew-spinoza-and-the-
history-of-an-image-daniel-b-schwartz/

ebookname.com
Web API
Development for
the Absolute
Beginner
A Step-by-step Approach to
Learning the Fundamentals of
Web API Development with .NET 7

Irina Dominte
Web API Development for the Absolute Beginner: A Step-by-step Approach
to Learning the Fundamentals of Web API Development with .NET 7
Irina Dominte
Iasi, Romania

ISBN-13 (pbk): 978-1-4842-9347-8 ISBN-13 (electronic): 978-1-4842-9348-5


https://doi.org/10.1007/978-1-4842-9348-5

Copyright © 2023 by Irina Dominte


This work is subject to copyright. All rights are reserved by the publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Joan Murray
Development Editor: Laura Berendson
Editorial Assistant: Gryffin Winkler
Copy Editor: April Rondeau
Cover image designed by Stefan Schweihofer from Pixabay
Distributed to the book trade worldwide by Springer Science+Business Media New York,
1 New York Plaza, 1 FDR Dr, New York, NY 10004. Phone 1-800-SPRINGER, fax (201) 348-4505,
email [email protected], or visit www.springeronline.com. Apress Media, LLC is a
California LLC and the sole member (owner) is Springer Science+Business Media Finance Inc
(SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail [email protected]; for
reprint, paperback, or audio rights, please e-mail [email protected].
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is
available to readers on GitHub.
Paper in this product is recyclable
Table of Contents
About the Author��������������������������������������������������������������������������������xv

About the Technical Reviewer����������������������������������������������������������xvii

Acknowledgments�����������������������������������������������������������������������������xix

Introduction���������������������������������������������������������������������������������������xxi

Part I: The Basics�������������������������������������������������������������������������1


Chapter 1: Introducing Web API�����������������������������������������������������������3
What Is an API?�����������������������������������������������������������������������������������������������������3
Categorizing APIs��������������������������������������������������������������������������������������������������4
Types of APIs���������������������������������������������������������������������������������������������������������4
Push/Stream APIs��������������������������������������������������������������������������������������������4
Native APIs�������������������������������������������������������������������������������������������������������5
SDKs����������������������������������������������������������������������������������������������������������������5
REST����������������������������������������������������������������������������������������������������������������5
RPC APIs����������������������������������������������������������������������������������������������������������6
The Look and Feel of Web Apps����������������������������������������������������������������������������7
What Is a WEB API?���������������������������������������������������������������������������������������������13
When to Use WEB API������������������������������������������������������������������������������������������16
The World of Web Applications����������������������������������������������������������������������������17
Summary������������������������������������������������������������������������������������������������������������18

v
Table of Contents

Chapter 2: Introduction to the Web�����������������������������������������������������19


How the Internet Works��������������������������������������������������������������������������������������19
Protocols��������������������������������������������������������������������������������������������������������19
Client–Server Architecture����������������������������������������������������������������������������22
What Is a URL: The Building Blocks���������������������������������������������������������������������23
Schema���������������������������������������������������������������������������������������������������������23
Domain����������������������������������������������������������������������������������������������������������24
Path���������������������������������������������������������������������������������������������������������������25
Query String��������������������������������������������������������������������������������������������������25
Fragment�������������������������������������������������������������������������������������������������������27
Request and Response���������������������������������������������������������������������������������������27
Request���������������������������������������������������������������������������������������������������������27
Response�������������������������������������������������������������������������������������������������������29
Request versus Response�����������������������������������������������������������������������������31
Headers���������������������������������������������������������������������������������������������������������������33
Accept�����������������������������������������������������������������������������������������������������������34
Content-Type�������������������������������������������������������������������������������������������������35
Cache-Control������������������������������������������������������������������������������������������������37
HTTP Methods�����������������������������������������������������������������������������������������������������37
GET����������������������������������������������������������������������������������������������������������������38
POST��������������������������������������������������������������������������������������������������������������38
PUT����������������������������������������������������������������������������������������������������������������40
DELETE����������������������������������������������������������������������������������������������������������40
HEAD��������������������������������������������������������������������������������������������������������������40
OPTIONS��������������������������������������������������������������������������������������������������������41
Idempotent versus Safe Methods������������������������������������������������������������������42

vi
Table of Contents

Status Codes�������������������������������������������������������������������������������������������������������43
1xx – Informational����������������������������������������������������������������������������������������43
2xx – Success�����������������������������������������������������������������������������������������������43
3xx – Redirects����������������������������������������������������������������������������������������������44
4xx – Client Errors�����������������������������������������������������������������������������������������44
5xx – Server Errors����������������������������������������������������������������������������������������46
Cookies���������������������������������������������������������������������������������������������������������������47
Summary������������������������������������������������������������������������������������������������������������49

Chapter 3: Setting Up the Environment����������������������������������������������51


Installing Visual Studio����������������������������������������������������������������������������������������51
Postman��������������������������������������������������������������������������������������������������������������53
What Is Postman?������������������������������������������������������������������������������������������53
Exploring the Postman Interface�������������������������������������������������������������������55
Your First Web API Project�����������������������������������������������������������������������������������59
Creating a Project������������������������������������������������������������������������������������������59
Exploring the Project Structure���������������������������������������������������������������������63
Running the Project���������������������������������������������������������������������������������������68
Issuing Your First Request�����������������������������������������������������������������������������71
Summary������������������������������������������������������������������������������������������������������������73

Chapter 4: Web API: Building Blocks��������������������������������������������������75


Convention Over Configuration���������������������������������������������������������������������������75
MVC���������������������������������������������������������������������������������������������������������������������76
Model�������������������������������������������������������������������������������������������������������������77
View���������������������������������������������������������������������������������������������������������������77
Controller�������������������������������������������������������������������������������������������������������77
The API Request Pipeline������������������������������������������������������������������������������������79

vii
Table of Contents

Controllers & Actions������������������������������������������������������������������������������������������80


Controllers�����������������������������������������������������������������������������������������������������80
Actions�����������������������������������������������������������������������������������������������������������82
Action Return Types���������������������������������������������������������������������������������������83
Model������������������������������������������������������������������������������������������������������������������87
DTO����������������������������������������������������������������������������������������������������������������89
Validating Models������������������������������������������������������������������������������������������89
Using Models�������������������������������������������������������������������������������������������������90
Model Binding�����������������������������������������������������������������������������������������������������91
Middleware���������������������������������������������������������������������������������������������������������92
Using Map������������������������������������������������������������������������������������������������������98
Using MapWhen������������������������������������������������������������������������������������������100
Using UseWhen�������������������������������������������������������������������������������������������101
Routing��������������������������������������������������������������������������������������������������������������102
What Is the Routing Mechanism?����������������������������������������������������������������102
Convention-based Routing��������������������������������������������������������������������������104
Attribute Routing�����������������������������������������������������������������������������������������107
Dependency Injection����������������������������������������������������������������������������������������112
What Is a Dependency?�������������������������������������������������������������������������������113
Types of Dependencies��������������������������������������������������������������������������������114
Dependency Injection Container������������������������������������������������������������������117
Dependency Injection in ASP.NET Web API��������������������������������������������������118
Service Lifetimes�����������������������������������������������������������������������������������������119
Cleaning Up DI Registrations�����������������������������������������������������������������������127
Summary����������������������������������������������������������������������������������������������������������130

viii
Table of Contents

Part II: Implementing an API���������������������������������������������������131


Chapter 5: Getting Started with Web API������������������������������������������133
A Short Introduction to REST�����������������������������������������������������������������������������133
Client–Server�����������������������������������������������������������������������������������������������134
Stateless������������������������������������������������������������������������������������������������������134
Caching��������������������������������������������������������������������������������������������������������135
Uniform Interface�����������������������������������������������������������������������������������������136
Layered System�������������������������������������������������������������������������������������������138
Code on Demand�����������������������������������������������������������������������������������������139
Your First RESTful API���������������������������������������������������������������������������������������139
Introducing CRUD����������������������������������������������������������������������������������������������139
Getting to Know the Project������������������������������������������������������������������������������141
Implementing a GET Request����������������������������������������������������������������������������141
Implementing GET and Using an ID�������������������������������������������������������������������144
Implementing a POST Request�������������������������������������������������������������������������148
Implementing a HEAD Request�������������������������������������������������������������������������153
Implementing a PUT Request����������������������������������������������������������������������������154
Implementing a DELETE Request����������������������������������������������������������������������155
Best Practices for API Design����������������������������������������������������������������������������156
Summary����������������������������������������������������������������������������������������������������������159

Chapter 6: Introducing an ORM��������������������������������������������������������161


What Is an ORM?�����������������������������������������������������������������������������������������������161
Introducing Entity Framework���������������������������������������������������������������������������163
Entity Framework Core Building Blocks������������������������������������������������������164
Configuring Relations Between Entities������������������������������������������������������169

ix
Table of Contents

Ways of Working with a Database���������������������������������������������������������������������174


Database First���������������������������������������������������������������������������������������������175
Model First���������������������������������������������������������������������������������������������������177
What Are Migrations?����������������������������������������������������������������������������������������178
How Do Migrations Work?���������������������������������������������������������������������������179
Installing SQL Management Studio�������������������������������������������������������������������180
Linking Our Project to a Database��������������������������������������������������������������������180
Generate Tables from Our Project����������������������������������������������������������������180
Scaffold Entities from an Existing Database�����������������������������������������������187
Querying Data���������������������������������������������������������������������������������������������������192
Interfaces Used for Query Results���������������������������������������������������������������192
Loading Related Data����������������������������������������������������������������������������������194
Executing Raw SQL�������������������������������������������������������������������������������������195
Summary����������������������������������������������������������������������������������������������������������195

Chapter 7: Getting Organized������������������������������������������������������������197


Splitting Code into Layers���������������������������������������������������������������������������������198
Domain Layer����������������������������������������������������������������������������������������������������201
Data Layer, Implementing a Repository������������������������������������������������������������208
Service Layer����������������������������������������������������������������������������������������������������212
Introducing AutoMapper�����������������������������������������������������������������������������������216
Installing AutoMapper����������������������������������������������������������������������������������218
Wire Everything�������������������������������������������������������������������������������������������������220
Implement SpeakersRepository������������������������������������������������������������������221
Implement SpeakersService�����������������������������������������������������������������������224
Make SpeakersController Changes�������������������������������������������������������������225
Try It Out������������������������������������������������������������������������������������������������������������232
Summary����������������������������������������������������������������������������������������������������������234

x
Table of Contents

Chapter 8: Routing����������������������������������������������������������������������������235
What Is a Route?�����������������������������������������������������������������������������������������������235
Route Templates������������������������������������������������������������������������������������������236
Route Segments������������������������������������������������������������������������������������������237
Route Parameters����������������������������������������������������������������������������������������239
Route Tokens�����������������������������������������������������������������������������������������������240
Route Values������������������������������������������������������������������������������������������������241
Convention-based Routing��������������������������������������������������������������������������������241
Attribute Routing�����������������������������������������������������������������������������������������������242
Route Template Precedence�����������������������������������������������������������������������������246
How to Customize Routing��������������������������������������������������������������������������������247
Route Constraints����������������������������������������������������������������������������������������������248
Creating a Custom Route Constraint�����������������������������������������������������������249
Available Constraints�����������������������������������������������������������������������������������252
Creating Hierarchical Routes����������������������������������������������������������������������������253
Summary����������������������������������������������������������������������������������������������������������260

Chapter 9: Middleware���������������������������������������������������������������������261
Middleware Usage Scenarios���������������������������������������������������������������������������264
Introducing Custom Middleware�����������������������������������������������������������������������265
Create Your Own Middleware to Add Headers��������������������������������������������������267
Making an Extension Method for Our Middleware��������������������������������������������268
Understanding the Security Headers We Added�����������������������������������������������271
X-Content-Type-Options������������������������������������������������������������������������������271
X-Frame-Options�����������������������������������������������������������������������������������������271
X-Permitted-Cross-Domain-Policies�����������������������������������������������������������272
X-XSS-Protection�����������������������������������������������������������������������������������������273
Summary����������������������������������������������������������������������������������������������������������274

xi
Table of Contents

Part III: Beyond Basics������������������������������������������������������������275


Chapter 10: Model Binding���������������������������������������������������������������277
What Is Model Binding?������������������������������������������������������������������������������������277
Model-binding Sources�������������������������������������������������������������������������������279
Attribute Scope��������������������������������������������������������������������������������������������282
Binding-related Attributes���������������������������������������������������������������������������283
Selectively Bind Properties��������������������������������������������������������������������������283
Create a Custom Model Binder�������������������������������������������������������������������������285
Using the Custom ModelBinder�������������������������������������������������������������������������291
Value Providers�������������������������������������������������������������������������������������������������293
When to Use a Value Provider����������������������������������������������������������������������295
Implement a Custom Value Provider������������������������������������������������������������296
Value Provider Factory��������������������������������������������������������������������������������������299
Apply the Value Provider Globally����������������������������������������������������������������301
Apply the Value Provider Selectively Using an Attribute������������������������������301
Summary����������������������������������������������������������������������������������������������������������303

Chapter 11: Versioning the API���������������������������������������������������������305


Versioning-related Libraries������������������������������������������������������������������������������307
Getting Started��������������������������������������������������������������������������������������������308
Preparing the Project�����������������������������������������������������������������������������������308
API Version Options�������������������������������������������������������������������������������������317
Ways of Versioning��������������������������������������������������������������������������������������������319
Versioning in QueryString����������������������������������������������������������������������������320
Versioning in Headers����������������������������������������������������������������������������������322
Versioning with Media Types�����������������������������������������������������������������������324
Versioning in the URL Path��������������������������������������������������������������������������325
Combining Versioning Strategies�����������������������������������������������������������������328

xii
Table of Contents

General Rules about Versioning������������������������������������������������������������������������329


Deprecating Versions����������������������������������������������������������������������������������������330
Summary����������������������������������������������������������������������������������������������������������331

Chapter 12: Documenting the API����������������������������������������������������333


Introducing OpenAPI�����������������������������������������������������������������������������������������333
Introducing Swashbuckle���������������������������������������������������������������������������������335
Working with Swashbuckle�������������������������������������������������������������������������������336
Documentation Steps����������������������������������������������������������������������������������������337
Define Supported Request Content Types���������������������������������������������������337
Define the Possible Status Codes����������������������������������������������������������������338
Define the Content Type of the Response����������������������������������������������������340
Describing Endpoints�����������������������������������������������������������������������������������342
API Conventions������������������������������������������������������������������������������������������������347
Creating an API Convention�������������������������������������������������������������������������351
Summary����������������������������������������������������������������������������������������������������������355

Chapter 13: Testing the API��������������������������������������������������������������357


Why Is Testing an API Important?����������������������������������������������������������������������357
Terminology������������������������������������������������������������������������������������������������������358
Test Doubles������������������������������������������������������������������������������������������������359
SUT��������������������������������������������������������������������������������������������������������������359
Mock������������������������������������������������������������������������������������������������������������359
Stub�������������������������������������������������������������������������������������������������������������360
Test Types���������������������������������������������������������������������������������������������������������360
Unit Tests����������������������������������������������������������������������������������������������������������363
Anatomy of a Unit Test���������������������������������������������������������������������������������363
Library Types You Might Encounter�������������������������������������������������������������367

xiii
Table of Contents

Creating Our First Unit Tests�����������������������������������������������������������������������������370


Testing the Controller����������������������������������������������������������������������������������371
Testing a Service�����������������������������������������������������������������������������������������379
Other Useful Attributes��������������������������������������������������������������������������������382
Integration Tests������������������������������������������������������������������������������������������������384
What Is a Fixture?����������������������������������������������������������������������������������������388
Creating a Custom WebApplicationFactory�������������������������������������������������388
Writing an Integration Test��������������������������������������������������������������������������393
Unit versus Integration Tests�����������������������������������������������������������������������������400
Summary����������������������������������������������������������������������������������������������������������400

Index�������������������������������������������������������������������������������������������������403

xiv
About the Author
Irina Dominte(Scurtu) is an independent
consultant and trainer, international
speaker, software architect, Microsoft MVP
for developer technologies, and Microsoft
certified trainer (MCT) with a wealth of
experience. Having taught classes, workshops,
and presentations for over 2,000 hours, Irina is
passionate about coding and keeping abreast
of the latest trends and best practices in
software architecture and .NET.
Twice a year, for five months each time, Irina teaches .NET and
C# to aspiring software developers or people interested in software
development or seeking to expand their knowledge. She is an active
member of the community and has founded the DotNet Iasi User Group
and the dotnetdays.ro conference, where she connects with like-minded
developers who are eager to share their expertise and insights.
Irina is also a prolific blogger, and her website, https://irina.codes,
features a wealth of articles on various coding topics. She decided to write
this book after learning firsthand how much people struggle to grasp new
concepts without proper guidance.

xv
About the Technical Reviewer
Layla Porter is an experienced software
engineer and developer advocate specializing
in .NET technologies. She’s a Microsoft MVP,
GitHub Star, and Progress Ninja, and in 2021
she founded the #WomenOfDotNet Initiative.
Layla has spoken at developer conferences
all over Europe and North America and is a
YouTube content creator and streamer. She
spends her time hiking, reading urban fantasy,
playing video games with her husband, and
doting on her two miniature pinschers, Cookie
and Lily.

xvii
Acknowledgments
The completion of this book wouldn’t have been possible without the help
and support of many people.
First, I want to thank my husband, who supported me every step and
encouraged me. Second, my daughter, Ilinca, who luckily enjoyed going
to daycare so I could write this book, and my in-laws, who were there to
babysit when I needed them.
Furthermore, I would like to express my appreciation to all those who
took the time to review my manuscript and provide constructive feedback
that helped refine the content. Special recognition goes to my tech
reviewer, Layla Porter, and my friends, Maria Rusu, Andrei Diaconu, and
Alexandra Nechita.
Last, but not least, thanks to my former students Tatiana Ciurescu and
Cosmin Dumitru, who were brave enough to shift their careers into tech
and never stopped learning.

xix
Introduction
This book aims to provide you, the reader, with a step-by-step approach
to learning Web API development. We start by introducing basic concepts
related to the Web in general and end with more advanced topics like
testing an API.
Across the chapters, you will notice a lot of things that might be subject
to debate—like splitting the code into different libraries, using different
coding standards, or even writing code that requires more lines than I
would use in real life.
Everything I choose to use in this book in terms of coding conventions,
API architecture, libraries, and topics covered was tested and proved
successful over the last eight years. In my spare time, twice a month,
I teach .NET to people that come from totally different domains than
programming. The vast majority now work in IT, and I dare to think that I
made a small contribution to that by using this approach.

xxi
PART I

The Basics
CHAPTER 1

Introducing Web API


This chapter introduces you to the world of APIs, including what kinds of
APIs are out there, what their purposes are, and how you can categorize
them. By the end of the chapter, you will have the correct vocabulary to use
when dealing with different types of APIs.

What Is an API?
The term API is very widely used in the information technology (IT)
industry, and sometimes its usage can be confusing. The term is an
acronym for “application programmable interface.”
This is in fact the interface that gives a person or a system the ability to
interact with a piece of hardware or software through the operations that
are exposed.
Think about an API as a remote control, controlling your TV. You
press buttons to change the channels back and forth. Something similar
happens with APIs. You call methods and endpoints, or set values to
properties that are exposed to control aspects of that system.
While regular web applications are intended for humans to interact
with, APIs are like web applications but don’t have buttons or cute layouts
to interact with. Their intent is to be consumed by different “users.” In this
case, the “user” of an API might be a system or a developer.
There are many types of APIs with different scopes and addressability,
and they can be found in different parts of the web, or offline on devices.

© Irina Dominte 2023 3


I. Dominte, Web API Development for the Absolute Beginner,
https://doi.org/10.1007/978-1-4842-9348-5_1
Chapter 1 Introducing Web API

APIs are everywhere. A mobile app, a weather app, your laptop’s


operating system, a fridge, your smart doorbell, and even your car all
expose or use APIs.
In this book, we will focus more on APIs that run on the web over the
HTTP protocol, serving data for web applications in JSON format. However,
you do need to know about the many types of APIs available. Your browser
has an API, your operating system has an API, and you can interact with all
of these. We will talk briefly about some of them in the next section.

Categorizing APIs
Now, if we ask ourselves, “What other kinds of APIs exist?” we may not
have a simple answer. Categorizing an API is a difficult job because we
need to add context to it. Imagine we have a set of LEGO blocks we need
to categorize. We might split them by color, or maybe by size. The same
happens with APIs—we can find more than one way to categorize them. In
the next section, we will talk about a few types of APIs that I have found to
be the most common and important.

Types of APIs
Push/Stream APIs
Push/stream APIs are event driven and send real-time notifications to
clients. In most cases, a web server will “push” messages or notifications
to a web browser. The business domain where you find APIs of this
category involves messaging, chats, video, streaming, or payments. There
is a significant chance of finding such APIs where time and real-time
processing are paramount.
Underneath, these APIs sometimes use protocols like WebSockets or
technologies like SignalR.

4
Chapter 1 Introducing Web API

Native APIs
APIs that are native usually are the interface of a device or a tool, allowing
us to interact with the device or tool. For example, web browsers have
a JavaScript API embedded that allows them to interpret and execute
the JavaScript code used in web applications. The same JavaScript API
will allow us to write and execute code directly in the Console tab of
developer tools.
In a similar manner, we can access our smartphone’s camera or
accelerometer through the exposed native API.

SDKs
An SDK, or software development kit, is a package of tools written in
different languages that helps developers build applications on top of that
package. For example, the .NET SDK provides a set of libraries and tools
that can be used by developers to build their own APIs or web applications.
SDKs get delivered as installers or as part of an Integrated Development
Environment workload and sometimes give you scaffolding capabilities
through those IDEs.

Scaffolding is the code generation capability given by some tools or


frameworks. It aids the development process by autogenerating code
based on predefined options or by taking in some input.

REST
REST, or representational state transfer, is an architectural style in the API
world that comes with a set of principles and guidelines about how to
design your API and leverage the underlying protocol in the correct way.

5
Chapter 1 Introducing Web API

REST was first mentioned by Roy Fielding in his dissertation thesis in 20001.
Since then, it has gained a lot of traction in the IT industry, but some
concepts were misunderstood.
Most of the APIs you will encounter in the web world are written in this
way. Not all respect the REST guidelines as they should, and are in fact JSON
over HTTP, but this is another subject that we will tackle at the right moment.
We will talk more about REST in a dedicated chapter.

RPC APIs
RPC is a term that means “remote procedure call,” and it has been
around for a while now in various forms. This model will look like you
are calling methods from the same application and using classes from
within the same scope or solution, but in fact the methods are hosted on a
different machine over the network. One of its main purposes is to make a
distributed system look and behave like a monolith.
If we look at Listing 1-1, the method calls seem to be part of the same
system, due to how an RPC API looks like. The calls to CreateOrder() and
ProcessPaymentFor() are actually calls over the network boundaries, even
if the look and feel for developers are local.

Listing 1-1. Code snippet to exemplify RPC

var order = salesBoundedContext.CreateOrder(orderRequest);


var paymentStatus = billingBoundedContext.
ProcessPaymentFor(order);
if (paymentStatus.IsSuccessful)
{
   shippingBoundedContext.ArrangeShippingFor(order);
}

1
https://resources.sei.cmu.edu/asset_files/WhitePaper/2017_019_001_
505040.pdf

6
Chapter 1 Introducing Web API

With an RPC (and when I say RPC, I am referring to the general


concept not necessarily gRPC or other implementation types), the
developer will call methods with arguments and get results, but that call
will involve a network call over HTTP protocol (in most of the cases). There
are plenty of benefits and drawbacks to using such an API, but all deserve a
separate section, which is not in the scope of this book.

The Look and Feel of Web Apps


Looking at any web application from the outside—if we are talking about
websites or web apps, as those have a layout, buttons, colors, and images
that we browse on—we see they have two parts:

• Frontend – This runs on the browser and is usually


written in HTML, CSS, and JavaScript (or a JavaScript
framework like Angular, React, Vue.js). In some cases,
people refer to this part of the application as the
presentation layer. As the name states, the scope of it is
to display information to the user, and it should be as
dumb as it can be.

• Backend – This is written in a server-side language like


C#, Python, or Java, and it runs on a web server.

From the developer’s perspective, depending on the framework we pick,


the separation is not that clear. Most of them have frontend and backend
code intertwined or have structures or components that generate HTML
code from the server. Such an example can be seen with the ASP.NET
MVC framework, where structures like Tag Helpers and HTML Helpers do
exactly this: generate HTML from the server.

7
Chapter 1 Introducing Web API

In the example that follows, you can see an HTML Tag Helper that
when executed generates an HTML input tag:

@Html.TextBoxFor(x=>x.AddedDate)

We can say that these application models are like self-contained boxes,
as shown in Figure 1-1.

Figure 1-1. Frontend and backend overview in ASP Razor Pages

The ASP Razor Pages application model comes with a nice structure, as
shown in Figure 1-2, and is very easy to understand and work with.

Figure 1-2. ASP Razor Pages project structure

8
Chapter 1 Introducing Web API

Listing 1-2 and Listing 1-3 explore how a page would look in this
application model. We should have such source code file pairs for each
page we add to our application.

Listing 1-2. Index.cshtml Razor Page client page

@page
@model IndexModel
@{
    ViewData["Title"] = "Home page";
}

<div class="text-center">
    <h1 class="display-4">Welcome</h1>
    <p>Learn about
<a href="https://docs.microsoft.com/aspnet/core">building Web
apps with ASP.NET Core</a>.</p>
</div>

Listing 1-3. Index.cs—How the code looks likew

using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace WebApplication1.Pages
{
    public class IndexModel : PageModel
    {
        private readonly ILogger<IndexModel> _logger;

        public IndexModel(ILogger<IndexModel> logger)


        {
            _logger = logger;
        }

9
Chapter 1 Introducing Web API

        public void OnGet()


        {

        }

From an architectural point of view, this programming model can


be included in the “Onion Architecture” category. As you can see in
Figure 1-3, everything is contained in the same app, and all the layers are
built around the business domain.

Figure 1-3. Onion architecture

Starting from the outermost layer, into to the middle, everything is


contained in the same application. It doesn’t matter if internally you
split the code into multiple libraries for better maintainability and code
separation—those libraries will still be strongly coupled. When it comes to
deployment and packaging, the code is delivered and treated as a whole.

10
Discovering Diverse Content Through
Random Scribd Documents
Fig. 261.—Valves of a Chiton
separated to show the
various parts (anterior valve
uppermost): a, a,
articulamentum; b, beak; j,
jugum; pl, pl, pleura; t, t,
tegmentum.
Fig. 262.—Valves of Chitonellus
separated out (anterior valve
uppermost): a, a,
articulamentum; t, t,
tegmentum. × 2.
The Polyplacophora are characterised, externally, by their usually
articulated shell of eight plates or valves, which is surrounded and
partly kept in position by a muscular girdle. These plates overlap like
tiles on a roof in such a way that the posterior edge of the first,
cephalic, or anterior valve projects over the anterior edge of the
succeeding valve, which in its turn overlaps the next, and so on
throughout. Seven-valved monstrosities very rarely occur.
A certain portion of each valve is covered either by the girdle or by
the valve next anterior to it. This portion, which is whitish in colour
and non-porous in structure, forms part of an inner layer which
underlies the rest of the substance of the valve, and is called the
articulamentum. The external portion of the valves, or tegmentum, is
generally more or less sculptured, and is largely composed of chitin,
impregnated with salts of lime, thus answering more to a cuticle than
to a shell proper. It is very porous, being pierced by a quantity of
minute holes of two sizes, known as megalopores and micropores,
which are connected together by minute canals containing what is
probably fibrous or nerve tissue, the mouths of the pores being
occupied by sense organs connected with these nerves. The
tegmentum of the six intermediate valves is generally divided into
three triangular areas by two more or less prominent ribs, which
diverge from the neighbourhood of the median beak or umbo. The
space enclosed between these ribs is known as the median area or
jugum, the other two spaces as the lateral areas or pleura. The ribs
terminate with the edge of the tegmentum, and are not found on the
articulamentum. In certain genera these areas are either non-
existent, or are not distinctly marked. The sculpture of the lateral
areas (which is, as a rule, much stronger than that of the median
area) will generally be found to resemble that of the anterior valve,
which has no proper median area. In the posterior valve the median
area is very small, while the sculpture of the rest of the valve
corresponds to that of the lateral areas generally (see Fig. 261).
Fig. 263.—First, fourth, and eighth
valves of a Chiton, showing l.i,
laminae of insertion; n, n,
notches; s.l, s.l, sutural
laminae. × 2.
The articulamentum of the intermediate valves is divided into two
equal parts in the middle of the anterior edge, opposite to the beak,
by a sinus. Each of the portions thus formed is again divided by a
notch or suture into two unequal parts, the anterior of which is known
as the sutural lamina, and is more or less concealed by the valve in
front of it, while the lateral part, or lamina of insertion, is entirely
concealed by the girdle. The articulamenta of the anterior and
posterior valves are either simple or pierced by a series of notches
(Fig. 263).
The girdle of the Chitonidae varies considerably in character.
Sometimes its upper surface is simply corneous or cartilaginoid, with
no other sculpture than fine striae, at others it is densely beset with
spines or bristles, or tufted at intervals with bunches of deciduous
hairs; again it is marbled like shagreen or mossy down, or covered
with serpent-like scales. The width of the girdle varies greatly, being
sometimes very narrow, sometimes entirely covering all the valves
(Cryptochiton). As a rule, its outer edge is continuous, but in
Schizochiton it is sharply notched over the anus.
A description has already been given of the dorsal eyes in Chiton
(p. 187), the nervous system (p. 202), the branchiae (p. 154), the
radula (p. 228), and the generative system (p. 126).

Fig. 264.—Girdles of various Chitonidae. A, Radsia sulcata


Wood, × 2; B, Maugeria granulata Gmel., × 3; C,
Enoplochiton niger Barnes, × 3; D, Acanthochiton fascicularis
L., × 4; E, Tonicia fastigiata Sowb., × 4.
The recent Chitons are thus classified by Dr. W. H. Dall:—
Section I. Chitones Regulares.—Anterior and posterior valves
of similar character.
A. Leptoidea.—Insertion plates obsolete, or, if present, unslit;
Leptochiton, Hanleyia, Hemiarthrum, Microplax.
B. Ischnoidea.—Insertion plates sharp, smooth, fissured; with
eaves; Trachydermon, Callochiton, Tonicella, Schizoplax, Leptoplax,
Chaetopleura, Spongiochiton, Ischnochiton, Callistochiton.
C. Lophyroidea.—Insertion plates broad, pectinated, projecting
backward; Chiton, Tonicia, Eudoxochiton, Craspedochiton.
D. Acanthoidea.—Insertion plates thrown forward; Sclerochiton,
Acanthopleura, Dinoplax, Middendorffia, Nuttallina, Arthuria,
Phacellopleura.
Section II. Chitones Irregulares.—Posterior valve abnormal, or
with a sinus behind.
E. Schizoidea.—Posterior valve fissured; Lorica, Schizochiton.
F. Placiphoroidea.—Posterior valve unslit, internally ridged, umbo
nearly terminal; Enoplochiton, Ornithochiton, Plaxiphora.
G. Mopaloidea.—Posterior valve with posterior sinus and one slit
on each side; Mopalia, Katherina, Acanthochiton, Notoplax.
H. Cryptoidea.—With double sutural laminae; Cryptoconchus,
Amicula, Cryptochiton.
I. Chitonelloidea.—Posterior valve funnel shaped; laminae thrown
forward; Chitonellus, Choneplax.

Fig. 265.—Chitonellus fasciatus Quoy; ant, anterior


end.
Sub-order 2. Aplacophora.—Animal vermiform, foot absent, or a
mere groove, cuticle more or less covered with spicules.
According to Marion, one of the principal authorities on the group,
the Aplacophora are perhaps Amphineura whose development has
been arrested at an early stage, their worm-like exterior being due to
adaptation to surroundings. They have hitherto been found chiefly in
the N. Atlantic and Mediterranean, generally at considerable depths,
and often associated with certain polyps in a way which suggests a
kind of commensalism.
Fam. 1. Neomeniidae.—Foot a narrow groove, intestinal tube
without differentiated liver, kidneys with common exterior orifice,
sexes united, ctenidia present or absent. Genera: Neomenia (Fig.
266), Paramenia, Proneomenia, Ismenia, Lepidomenia, Dondersia.
Fig. 266.—Neomenia carinata
Tullb.: a, anus; gr, ventral
groove; m, mouth.

Fig. 267.—Chaetoderma
nitidulum Lov.: a, anus; m,
mouth. × 3.
Fam. 2. Chaetodermatidae.—Body cylindrical, no ventral groove,
liver a single sac, kidneys with separate orifices into the branchial
cloaca, two bipectinate ctenidia. Single genus, Chaetoderma (Fig.
267).

Order II. Prosobranchiata


Visceral loop twisted into a figure of 8 (streptoneurous), right half
supra-intestinal, left half infra-intestinal; heart usually in front of the
branchia (ctenidium), which is generally single; head with a single
pair of tentacles; animal dioecious, usually marine, more or less
contained within a shell, operculum generally present. Cambrian to
present time.
Sub-order 1. Diotocardia.—Heart with two auricles (except in the
Docoglossa and Helicinidae), branchiae bipectinate, front end free;
two kidneys, the genital gland opening into the right (except in
Neritidae); nervous system not concentrated; no proboscis or siphon,
penis usually absent.
(a) Docoglossa (p. 227).—Heart with a single auricle, ventricle
not traversed by the rectum, visceral sac not spiral, shell widely
conical, non-spiral, no operculum; radula very long, with few hooked
teeth in each row.
Fam. 1. Acmaeidae.—Left ctenidium alone occurring, free on a
long stalk. Cretaceous——. Principal genera: Pectinodonta, front
part of head much produced, radula 0 (1. 0. 1.) 0; Acmaea (=
Tectura), with sub-genera Collisella and Collisellina, no accessory
branchial ring, shell closely resembling that of Patella, but generally
with a distinct internal border; Scurria, accessory branchial ring on
the mantle.
Fam. 2. Lepetidae.—No ctenidia or accessory branchiae, animal
generally blind. Pliocene——. Principal genera: Lepeta; Propilidium,
apex with internal septum; Lepetella.
Fam. 3. Patellidae.—No ctenidia, the osphradial patch at the base
of each alone surviving, a circlet of secondary branchiae between
the mantle and sides of the foot. Ordovician——. (i.) Patellinae.—
Three lateral teeth on each side, two of them anterior. Principal
genera: Patella, branchial circlet complete; chief sections Patella
proper, Scutellastra, Ancistromesus (A. mexicana Brod., measures
8–14 in. long); Helcion, branchial circlet interrupted in front;
Tryblidium (Ordovician).—(ii.) Nacellinae.—Two developed laterals
on each side, one anterior. Genera: Nacella, branchial circlet
complete; Helcioniscus, branchial circlet interrupted in front.
(b) Rhipidoglossa (p. 225).—Ventricle of the heart traversed by
the rectum (except in Helicinidae), one or two ctenidia; jaw in two
pieces, radula long, marginals multiplied, rows curved.
Of all the Gasteropoda, this section of the Diotocardia approach
nearest to the Pelecypoda, particularly in the least specialised forms.
The auricle, the branchiae, and the kidneys are in many cases
paired, and more or less symmetrical. The ventricle is generally
traversed by the rectum, there is a long labial commissure between
the cerebral ganglia, special copulative organs are usually absent,
while the shell is often nacreous, like those of Pelecypoda of a
primitive type.
Section I. Zygobranchiata.—Two ctenidia, shell with apical or
marginal slit or holes, corresponding to an anal tube in the mantle (p.
265).
Fam. 1. Fissurellidae.—Two symmetrical ctenidia and kidneys,
visceral mass conical, shell conical, elevated or depressed, with a
single anterior or apical slit or impression; no operculum. Jurassic
——. (i.) Fissurellinae. Shell wholly external, apex entirely removed
by perforation, apical callus not truncated posteriorly; central tooth
narrow. Genera: Fissurella (Figs. 171, p. 261; 178, p. 265),
Fissuridea, Clypidella. (ii.) Fissurellidinae. Shell partly internal,
otherwise as in (i.); central tooth broad, mantle more or less reflected
over the shell, apical hole very wide. Genera: Fissurellidaea,
Pupillaea, Lucapina, Megatebennus, Macroschisma, Lucapinella.
(iii.) Emarginulinae. Shell usually wholly external, apex usually not
removed by perforation, sometimes with internal septum, anal tube
in a narrow slit or sinus. Genera: Glyphis, externals of Fissurella, but
holecallus truncated behind; Puncturella (sub-genera Cranopsis and
Fissurisepta), slit just anterior to the apex, a small internal septum;
Zeidora, large internal septum as in Crepidula: Emarginula, shell
elevated, slit very narrow, on the anterior margin (in subg. Rimula, it
is between the apex and the margin), radula bilaterally asymmetrical;
Subemarginula, margin indented by a shallow groove; Scutus (=
Parmophorus) shell oblong, depressed, nicked in front, largely
covered by the mantle.
Fig. 268.—Scutus australis Lam.,
Australia: m, m, mantle; sh,
shell, × ⅔.
Fam. 2. Haliotidae.—Right ctenidium the smaller, epipodial line
broad, profusely lobed; shell rather flattened, spire short, last whorl
very large, with a row of perforations on the left side, which become
successively obliterated; through these holes, the posterior of which
is anal, pass tentacular appendages of the mantle; no operculum.
Cretaceous——. Single genus, Haliotis; principal sub-genera
Padollus, Teinotis.
Fam. 3. Pleurotomariidae.—Central tooth single, narrow, about 26
laterals, 60 to 70 uncini. Shell generally variously trochiform,
nacreous, operculate, with a rather broad marginal sinus in the last
whorl; as this sinus closes up it forms an “anal fasciole” or “sinus
band.” Cambrian——. Principal genera: Scissurella, epipodial line
with several long ciliated appendages at each side, shell very small,
slit open, sinus band extending nearly to apex; Schismope, anal slit
closed in the adult into an oblong perforation; Murchisonia
(Palaeozoic only), shell long, turreted, whorls angulate or keeled with
a sinus band; Odontomaria (Palaeozoic only), shell tubular, curved;
Polytremaria (Carboniferous), shell turbinate, slit a series of small
holes connected by a passage; Trochotoma, shell trochiform,
perforation consisting of two narrow holes united by a slit;
Pleurotomaria, branchiae almost symmetrical, radula as above, shell
variously spiral.
In Pleurotomaria we have the case of a genus long supposed to
be extinct. More than 1100 fossil species have been described, and
within the last 38 years about 20 specimens, belonging to 5 species,
have been discovered in a living state.

Fig. 269.—Pleurotomaria
adansoniana Cr. and F., Tobago.
× ½.
Fam. 4. Bellerophontidae.—Shell nautiloid, spire generally
concealed, aperture large, sinus or perforations central (Fig. 179, p.
266). Ordovician—Trias. Genera: Bellerophon, Trematonotus,
Cyrtolites.
Section II. Azygobranchiata.—One ctenidium (the left) present.
Fam. 1. Cocculinidae.—A single cervical ctenidium, foot broad, no
eyes, shell patelliform, with caducous spire. Single genus, Cocculina.
Deep water.
Fam. 2. Stomatellidae.—A single (left) ctenidium, front third free,
shell nacreous, spiral or patelliform, depressed, last whorl large.
Jurassic——. Genera: Stomatella (subg. Synaptocochlea, Niphonia),
shell depressed, spirally ribbed, spire short, operculum present;
Phaneta, fluviatile only, shell trochiform, imperforate, last whorl
keeled, sinuate in front; Stomatia, spire short, surface tubercled or
keeled, no operculum; Gena, shell haliotis-shaped, surface smooth,
aperture very large; Broderipia, shell patelliform, spiral apex often
lost.
Fam. 3. Cyclostrematidae.—Tentacles ciliated, thread-like, snout
bilobed, foot truncated in front, angles produced into a filament, shell
depressed, umbilicated, not nacreous. Eocene——. Principal
genera: Cyclostrema, Teinostoma, Vitrinella.
Fam. 4. Liotiidae.—Epipodial line with a lobe behind each eye-
peduncle, shell solid, trochiform, longitudinally ribbed or trellised,
aperture round, operculum multispiral, hispid, corneous, with a
calcareous layer. Silurian——. Principal genera: Liotia,
Craspedostoma (Silurian), Crossostoma (Jurassic).

Fig. 270.—Monodonta canalifera


Lam., New Ireland. (After
Quoy and Gaimard.)
Fam. 5. Trochidae.—Snout short, broad, frontal lobes often
present, epipodial line furnished with cirrhi; shell nacreous, variously
spiral, operculum corneous, multispiral, nucleus central (Fig. 182, p.
268). Silurian——. (i.) Trochinae.—Frontal lobes present, lateral
teeth (= side centrals) 5 only, no jaws, peristome incomplete.
Principal genera: Trochus (subg. Cardinalia, Tectus, Infundibulum,
Clanculus), Monodonta (subg. Diloma), Cantharidus (subg. Bankivia,
Thalotia), Gaza (subg. Microgaza), Callogaza, Bembix, Chlorostoma.
(ii.) Gibbulinae.—Frontal lobes and jaws present, laterals often more
than 5, peristome incomplete. Principal genera: Gibbula (subg.
Monilia, Aphanotrochus, Enida), Minolia, Circulus, Trochiscus,
Livona, Photinula, Margarita, Solariella, Calliostoma, Turcica,
Basilissa, Euchelus (subg. Olivia, Perrinia). (iii.) Delphinulinae.—No
frontal lobes, jaws present; shell solid, surface spirally lirate, scaly,
spinose, umbilicate, peristome continuous. Single genus, Delphinula.
(iv.) Umboniinae.—Eyes pedunculate, left tentacle attached to a
frontal appendage, mantle reflected over edge of aperture, lateral
teeth 6 on each side; shell polished, peristome incomplete, umbilicus
generally closed by a callosity. Principal genera: Umbonium, Ethalia,
Isanda, Camitia, Umbonella, Chrysostoma.

Fig. 271.—Phasianella australis


Gmel., Australia.
Fam. 6. Turbinidae.—Epipodial line with slender cirrhi, snout
broad, short, eyes pedunculate at outer base of tentacles, a frontal
veil between tentacles; shell turbinate, solid, aperture continuous,
operculum solid, calcareous, usually paucispiral, convex exteriorly
(Fig. 182, p. 268). Silurian——. (i.) Phasianellinae.—Shell bulimoid,
polished, not nacreous, coloured in patterns, aperture oval. Single
genus, Phasianella (Fig. 271). (ii.) Turbininae.—Shell very solid,
nacreous within, aperture circular or long oval. Principal genera,
Turbo, whorls rounded above and below, spines, if present,
becoming more prominent with age, operculum smooth or granulose,
nucleus sub-central; subg. Callopoma, Ninella, Marmorostoma,
Sarmaticus, Prisogaster; Astralium, whorls flattened above and
below, spines, if present, becoming less prominent with age,
operculum oblong, often excavated at centre, last whorl large,
nucleus marginal or sub-marginal; subg. Lithopoma, Imperator,
Guildfordia, Bolma, Cyclocantha, Uvanilla, Cookia, Pomaulax,
Pachypoma. (iii.) Cyclonematinae.—Shell nacreous, umbilicate,
operculum conical outside, whorls scalariform. Principal genera:
Cyclonema, Horiostoma (?), Amberleya (Silurian to Lias). (iv.)
Leptothyrinae.—Shell small, solid, depressed, operculum nearly flat,
nucleus sub-central. Genera: Leptothyra, Collonia (?).
Fam. 7. Neritopsidae.—Tentacles wide apart, long, eyes on short
peduncles at the outer base; shell solid, neritiform or naticoid,
aperture semi-lunar or oval; operculum (Fig. 183, p. 269) thick,
calcareous, non-spiral, exterior face smooth, interior face divided into
two unequal parts, with a broad median appendage. Devonian——.
Principal genera: Neritopsis (one recent species), Naticopsis
(Devonian to Miocene).
Fam. 8. Macluritidae.—Shell discoidal, whorls few, longitudinally
grooved behind, right side convex, deeply umbilicated, left side flat;
operculum very thick, nucleus excentrical, internal face with two
apophyses, one very large. The general appearance is more that of
an inequivalve bivalve, such as Requienia, than of a spiral
gasteropod. Palaeozoic——. Single genus, Maclurea.
Fam. 9. Neritidae.—Snout short, tentacles long, eyes pedunculate
at their outer base, branchia triangular, free at the front end,
epipodium without cirrhi, penis near the right tentacle; shell solid,
imperforate, turbinate to almost patelliform, spire short, internal
partitions absorbed (p. 168), columellar region broad, edge simple or
dentate, operculum calcareous, spiral or non-spiral, with prominent
apophyses on the interior face, one of which locks behind the
columellar lip. Jurassic——. Principal genera: Nerita (Fig. 13, p. 17);
Neritina (chiefly brackish water and fluviatile), sub-genus Clithon,
usually coronated with spines; Velates (Tertiary), Neritoma
(Jurassic), Deianira (Cretaceous), Septaria (= Navicella), shell more
or less narrowly patelliform, with terminal apex, aperture very large,
with a broad columellar septum, operculum too small for the
aperture, more or less covered by the integument of the foot;
fluviatile only; Pileolus (Jurassic to Cretaceous).
Fam. 10. Hydrocenidae.—Branchia replaced by a pulmonary
chamber, eyes at the outer base of the tentacles, marginals of the
radula very oblique, centrals often wanting; shell small, conical,
whorls convex, operculum calcareous, with a prominent apophysis.
Recent. Principal genera: Hydrocena, Georissa.
Fam. 11. Helicinidae.—Branchia replaced by a pulmonary
chamber, heart with one auricle; shell globular, with a short spire,
internal partitions absorbed; operculum without apophysis.
Carboniferous——. Principal genera: Helicina (Fig. 18b, p. 21; subg.
Alcadia, Schasicheila, Heudeia, Calybium), Eutrochatella (subg.
Lucidella), Stoastoma, Bourcieria, Dawsonella (Carboniferous).
Fam. 12. Proserpinidae.—Branchia replaced by a pulmonary
chamber, mantle partly reflected over the shell, eyes sessile; shell
depressed, discoidal, columella folded or truncated at the base,
whorls with one or more internal plicae, internal partitions absorbed,
no operculum. Eocene——. Single genus; Proserpina, subg.
Proserpinella, Cyane, Dimorphoptychia (Eocene), and Ceres (Fig.
18c, p. 21).
Sub-order II. Monotocardia.—Heart with one auricle, one
ctenidium (the left), monopectinate, fused with the mantle (except in
Valvata), one kidney, not receiving the genital products, nervous
system somewhat concentrated, proboscis and penis usually
present.
(a) Ptenoglossa.—Radula with formula ∞. ᴑ. ∞, teeth similar
throughout, outermost largest (p. 224).
Fam. 1. Ianthinidae.—Snout prominent, blunt, no eyes, shell
helicoid, fragile, bluish, no operculum; eggs carried on a raft of
vesicles attached to the foot (Fig. 42, p. 126). Pelagic only. Pliocene
——. Genera: Ianthina, Recluzia.
Fam. 2. Scalariidae.—Shell long, turriculate, whorls often partly
uncoiled, with longitudinal ribs and prominent lamellae, aperture
circular, operculum spiral, corneous, animal carnivorous. Ordovician
——. Principal genera: Scalaria, Eglisia, Elasmoneura (Silurian),
Holopella (Silurian to Trias), Aclis.
(b) Taenioglossa.—Radula with normal formula 2.1.1.1.2,
marginals sometimes multiplied (p. 223).
Section I. Platypoda.—Foot more or less flattened ventrally.
Fam. 1. Naticidae.—Foot very large, produced before and behind,
propodium reflected upon the head, eyes absent or buried in the
integument, central and lateral tooth of the radula tricuspid, middle
cusp strong; shell globular or auriform, outer lip simple, operculum
corneous or calcareous, nucleus excentrical. Carboniferous ——.
Principal genera: Natica, with many sub-genera; Ampullina (Tertiary);
Amaura; Deshayesia (Tertiary); Sigaretus (Fig. 91, p. 186), shell
auriform, last whorl very large, operculum much too small for the
aperture.
Fam. 2. Lamellariidae.—Mantle reflected over more or less of the
shell, shell delicate, no operculum. Eocene——. Principal genera:
Lamellaria, shell completely internal, transparent, auriform; some
species deposit their eggs on compound Ascidians (p. 74); Velutina,
shell almost entirely external, paucispiral, with a thick periostracum;
Marsenina, shell auriform, partly internal; Onchidiopsis, shell a
membranous plate, internal.
Fam. 3. Trichotropidae.—Branchial siphon short, eyes on the outer
side of the tentacles; radula closely allied to that of Velutina; shell
conical, last whorl rather large, periostracum thick and hairy,
operculum blunt claw-shaped, nucleus terminal. Cretaceous——.
Genera: Trichotropis, Torellia.
Fam. 4. Naricidae.—Tentacles broad in the middle, with sessile
eyes at the exterior base, propodium narrow, quadrangular, a large
epipodial veil on each side of the foot; shell naticoid, cancellated,
with velvety periostracum. Jurassic——. Single genus: Narica.
Fam. 5. Xenophoridae.—Foot divided by a groove, anterior portion
the larger; central tooth heart-shaped, with blunt cusps, lateral large,
roughly triangular, marginals long, falciform; shell trochiform,
somewhat flattened, attaching various fragments externally.
Devonian——. Single genus, Xenophora (Figs. 25, 26, p. 64).
Fam. 6. Capulidae.—Ctenidium deeply and finely pectinate,
visceral sac scarcely spiral, penis long, behind the right tentacle;
shell roughly patelliform, with scarcely any spire, interior polished,
usually with a septum or internal plate of variable form, no
operculum. Devonian——. Principal genera (Fig. 155, p. 248);
Capulus, shell cap-shaped, no internal plate; Platyceras (Palaeozoic,
see p. 76), Diaphorostoma (Palaeozoic), Addisonia (?); Crucibulum,
internal appendage funnel-shaped; Crepidula (including Crepipatella
and Ergaea), shell slipper-shaped, with a large septum; Calyptraea
(including Galerus and Trochita), internal lamina semi-spiral.
Fam. 7. Hipponycidae.—Foot aborted, animal sedentary,
adductor-muscle shaped like a horse’s hoof, fastened on the ventral
side to the region of attachment, or to a thin calcareous plate which
closes the aperture like a valve; ventral side of the body surrounded
by a mantle with papillose border, which corresponds
morphologically to the epipodia, head emerging between the dorsal
and ventral mantles. Shell thick, bluntly conical, surface rugose.
Eocene ——. Genera: Hipponyx; Mitrularia, a narrow half funnel-
shaped appendage within the shell.

Fig. 272.—Two specimens of


Crepidula (marked a and b)
on an old shell of Murex
radix Gmel.
Fam. 8. Solariidae.—Foot large, eyes sessile, near the outer base
of the tentacles, radula abnormal (p. 224); shell more or less
depressed, lip simple, umbilicus wide, margins often crenulated,
operculum variable. The proper position of the family is quite
uncertain. Ordovician——. (i.) Solariinae. Genera: Solarium, shell
depressed, highly finished, angular at periphery, operculum
corneous, central tooth absent, laterals and marginals numerous,
long, and narrow; Platyschisma (Silurian). (ii.) Toriniinae. Genera:
Torinia, whorls usually rounded, operculum (Fig. 183) conically
elevated, spiral externally, central tooth present, marginals few, edge
pectinated; Omalaxis. (iii.) Euomphalinae, shell planorbiform, whorls
rounded. Genera: Euomphalus, Ophileta, Schizostoma,
Eccyliomphalus (all Palaeozoic).
Fam. 9. Homalogyridae.—Tentacles absent, eyes sessile, central
tooth unicuspid on a quadrangular base, laterals and marginals
replaced by an oblong plate; shell very small, planorbiform. Recent.
Single genus: Homalogyra, whose true position is uncertain.

Fig. 273.—Solarium
perspectivum Lam., Eastern
Seas.
Fam. 10. Littorinidae.—Proboscis short, broad, tentacles long,
eyes at their outer bases, penis behind the right tentacle;
reproduction oviparous or ovoviviparous, radula very long; shell
turbinate, solid, columella thickened, lip simple, operculum corneous,
nucleus excentrical. Jurassic——. Principal genera: Littorina (radula,
Fig. 16, p. 20), Cremnoconchus (p. 16), Fossarina; Tectarius, shell
tubercled or spinose; Risella, base slightly concave; Lacuna, shell
thin, grooved behind the columellar lip.
Fam. 11. Fossaridae.—Shell turbinate, solid, small, white, spirally
ribbed, outer lip simple. Miocene——. Principal genus, Fossarus.
Fam. 12. Cyclophoridae.—Ctenidium replaced by a pulmonary
sac, tentacles long, thread-like (radula, Fig. 17, p. 21); shell variously
spiral, peristome round, often reflected, operculum circular.
Terrestrial only. Cretaceous——. (i.) Pomatiasinae, shell high,
conical, longitudinally striated, operculum consisting of two laminae
united together. Single genus, Pomatias. (ii.) Diplommatininae, shell
more or less pupiform, peristome thickened or reflected, often
double. Genera: Diplommatina (subg., Nicida, Palaina, Paxillus,
Arinia), shell dextral or sinistral, small, columella often denticulated;
Opisthostoma (Fig. 208, p. 309), last whorl disconnected, often
reflected back upon the spire. (iii.) Pupininae, shell more or less
lustrous, bluntly conical, lip with a channel above or below. Genera:
Pupina (subg., Registoma, Callia, Streptaulus, Pupinella, Anaulus),
Hybocystis (Fig. 205, p. 305), Cataulus, Coptochilus,
Megalomastoma. (iv.) Cyclophorinae, shell turbinate or depressed,
operculum corneous or calcareous. Genera: Alycaeus,
Craspedopoma, Leptopoma, Lagochilus, Cyclophorus (Fig. 206, p.
306); including Diadema, Aulopoma, Ditropis, and others),
Aperostoma (including Cyrtotoma and others), Cyathopoma,
Pterocyclus (subg., Myxostoma, Spiraculum, Opisthoporus, and
Rhiostoma (Fig. 180, p. 266), Cyclotus, Cyclosurus, and
Strophostoma.
Fam. 13. Cyclostomatidae.—Ctenidium replaced by a pulmonary
sac, tentacles obtuse, foot with a deep longitudinal median groove;
central tooth, lateral, and first marginal more or less bluntly cusped,
second marginal large, edge pectinate; shell variously spiral, spire
usually elevated, aperture not quite circular; operculum generally
with an external calcareous and an internal cartilaginoid lamina,
rarely corneous. Terrestrial only. Cretaceous——. Genera:
Cyclostoma (subg., Leonia, Tropidophora, Rochebrunia, Georgia,
Otopoma, Lithidion, Revoilia), Cyclotopsis, Choanopoma (subg.,
Licina, Jamaicia, Ctenopoma, Diplopoma, Adamsiella), Cistula
(subg., Chondropoma, Tudora), Omphalotropis (subg., Realia,
Cyclomorpha), Hainesia, Acroptychia.
Fig. 274.—Cyclostoma
campanulatum Pfr., Madagascar.
Fam. 14. Aciculidae.—Ctenidium replaced by a pulmonary sac,
tentacles cylindrical, pointed at the end, eyes behind their base, foot
long and narrow; central tooth and lateral very similar, pinched in at
the sides, external marginal broad, edge finely pectinate; shell small,
acuminate, with a blunt spire, operculum corneous. Terrestrial only.
Tertiary——. Genus, Acicula (= Acme).
Fam. 15. Truncatellidae.—Ctenidium replaced by a pulmonary
sac, proboscis very long, eyes sessile, behind the base of the
tentacles, shell small, evenly cylindrical, apex truncated in the adult.
Eocene——. Genera: Truncatella (subg., Taheitia, Blanfordia, and
Tomichia), Geomelania (subg., Chittya and Blandiella), Cecina (?).
Fam. 16. Rissoidae.—Eyes at the external base of the tentacles,
epipodium with filaments, operculigerous lobe with appendages;
central tooth pleated at the basal angles, lateral large, bluntly
multicuspid, marginals long, narrow, denticulate at the edge; shell
small, acuminate, often elaborately sculptured, mouth entire or with a
shallow canal, operculum corneous. Marine or brackish water.
Jurassic——. Principal genera: Rissoa (subg., Folinia, Onoba,
Alvania, Cingula, Nodulus, Anabathron, Fenella, Iravadia, and
others), Scaliola (shell agglutinating fragments of sand, etc.),
Rissoina (lip thickened, operculum with an apophysis as in Nerita),
Barleeia, Paryphostoma (Eocene).
Fam. 17. Hydrobiidae.—Eyes at the outer base of the tentacles,
penis behind the right tentacle, prominent, operculigerous lobe
without filaments; radula rissoidan, central tooth often with basal
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like