Code Monkey home page Code Monkey logo

csharp-api-requests-responses's Introduction

C# API Requests & Responses

Learning Objectives

  • Build an API to a defined specification
  • Build endpoints that can support GET, POST, PUT, DELETE requests
  • Use HTTP response codes to differentiate response types
  • Use JSON to send structured messages between a client and server

Instructions

  1. Fork this repository
  2. Clone your fork to your machine
  3. Open the project in Visual Studio

Requirements

Requirements for this exercise is presented in the form of API documentation using the OpenAPI spec.

API documentation is usually defined before building the actual API so that the client and server can both be developed at the same time, working to satisfy the same specification.

As an example, consider this simple API spec:

GET /meetings
200 OK response:
[
    {
        "id": integer,
        "client": "string",
        "isAccepted": boolean
    }
]

POST /meetings
Payload:
{
    "client": "string",
    "isAccepted": boolean
}
201 CREATED response:
{
    "id": integer,
    "client": "string",
    "isAccepted": boolean
}

It can be a little confusing at first glance but it contains everything a developer needs to begin building the API.

  • The spec defines one route: /meetings
  • The spec defines two HTTP methods for that route: GET and POST
  • The spec defines what the response status code and the response body for both routes should look like

As a developer, it's your job to build the API so that it satisfies the spec exactly. Attention to detail is important!

Here's the spec for this exercise. Spend some time getting familiar with it and pay close attention to the details.

The Students class is already partially built for you to help you get started. This is the last time you'll receive boilerplate code as a starter, so spend some time understanding it. Experiment & change it until you feel comfortable.

You are free to change the provided code in this project but you must implement a minimal api with a repository layer and data layer.

Extensions

The extensions is presented as a separate API spec.

This one will have you considering the concept of unique identifiers for records.

Here's the extension spec.

csharp-api-requests-responses's People

Contributors

logi13 avatar uerbzr avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.