JSON:API - Creating new resources

So far in my JSON:API series I’ve covered the home resource, adding your own resource, adding an exception handling middleware and how to expose relationship between resources. For the today’s post, I would like to cover creating resources. I will update the chinook project by allowing POST request on the customers collections to add new customers. To get started, the customer controller needs to have a method that will accept the incoming POST request....

August 8, 2021 · Yunier

JSON:API - Exposing relationships

My previous post on JSON:API exposed customers as an API resource, since then, I have updated the project to expose all remaining resources, that includes Albums, Artists, Employees, Genres, Invoices, InvoiceItems, MediaTypes, Playlists, and Tracks. The time has come to expose the relationship that exist between these resource. For this post, I will expose the one-to-many relationship that exist between artists and albums. To accomplish this task I will have to update the class ArtistServiceModelConfiguration by using the ToManyRelationship method exposed by JsonApiFramework in order to link one artist to many albums....

December 6, 2020 · Yunier

JSON:API - Exposing the customer resource

This will be my third blog post on JSON:API in .NET Core. I plant to add Customer as an API resource, but before we get too deep on the code, I would like to review the Chinook database project. To do that I’m going to import Chinook.db into DB Browser for SQLite to see all available entities. As you can see we have quite a few entities, for this blog post I will concentrate on the customers entity....

October 30, 2020 · Yunier

JSON:API - Exception handling middleware

On my second post on JSON:API in .NET Core I wanted to create an exception handling middleware. This middleware would be responsible for catching all exceptions and for generating a JSON:API Errors Documents. I’ll start by adding a middleware folder on the Chinook.Web project, for now it will only have the exception handling middleware, but, eventually it will have additional middleware. Folder has been added, now I will add the middleware class to the project in here....

October 19, 2020 · Yunier

JSON:API - Creating the home resource

This post will be my first entry into a multi-part series of post showing how I’ve built RESTful APIs using the JSON:API specification on .NET Core. I will start by creating a new .NET Core Web Api project, I am going to call this project Chinook, after the sqlite database that I will use for this project. Whenever I create a .NET Core project I like to follow the project structure outlined by Steve Smith in his Clean Architecture repository....

September 14, 2020 · Yunier