Skip to content

AmerSurkovic/ASP.NET-RESTful-CRUD-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASP.NET REST API

Project implements RESTful CRUD web API in C# using ASP.NET for managing a banner model. Data is backed by MongoDB. Method providing the HTML stored in the banner is also implemented.

Packages

API Calls

  • GET api/banners

    Returns all banners from the database.

  • GET api/banners/{id}

    Returns the banner from the database for a specified ID.

  • POST api/banners

    Creates a banner record in the database.

  • PUT api/banners/{id}

    Updates the banner record in the database for a specified ID with sent update data.

  • DELETE api/banners/{id}

    Removes the banner record from the database for a specified ID.

  • GET api/banners/{id}/html

    Provides the HTML stored in the banner. Renders correctly in a modern browser - HTML load available in the developed client.

Testing the API

Testing was done using both:

  • Postman

    Used for testing all of the API calls. Provides a better insight to illegal calls and for observing error handling.

  • Developed client

    Also used for testing of the API calls but with focus on proper loading of HTML into the modern web browser.

Postman API Test Results

  • GET ALL /api/banners with an empty database alt text

  • GET ALL /api/banners with a populated database alt text

  • POST BANNER /api/banners : Status code 200 alt text

  • POST BANNER /api/banners : Status code 500 alt text

  • POST BANNER NOT VALID HTML /api/banners : Status code 500 alt text

  • GET BANNER /api/banners/1 : Status code 200 alt text

  • GET BANNER /api/banners : Status code 404 alt text

  • PUT BANNER /api/banners/1 : Status code 200 alt text

  • PUT BANNER /api/banners/1 : Status code 500 alt text

  • DELETE BANNER /api/banners/2 : Status code 200 alt text

  • DELETE BANNER /api/banners/1000 : Status code 500 alt text

  • GET BANNER HTML /api/banners/1/html : Status code 200 alt text

  • GET BANNER HTML /api/banners/1000/html : Status code 404 alt text

Testing with the client

Developed client uses all of the CRUD API calls including HTML loading for a given banner. Since the CRUD API calls are tested and presented using Postman they will be not be shown again on the client side. More important aspect is tested through client - and that is correct rendering of HTML when called through the API for the specified bannner.

  • Client side overview

    alt text

  • Load HTML 1

    alt text

  • Load HTML 2

    alt text

  • Load HTML 3

    alt text

  • Load HTML 4

    alt text

Releases

No releases published

Packages

No packages published