ASP .NET
  • Introduction
  • Chapter1.MVC 5
    • 1.1.The Complete ASP.NET MVC 5 Course
      • 1.0. Deploy .NET project to IIS
      • 1.1.Getting started
        • 1.1.1.MVC Architectural
        • 1.1.2.Setting up the development environment
        • 1.1.3.Create MVC APP
        • 1.1.4.Add a new Model, Controller, View
      • 1.2.ASP.NET MVC Fundamentals
        • 1.2.1.Action
        • 1.2.2.Route
        • 1.2.3.Pass data to views
        • 1.2.4.ViewModel
        • 1.2.5.View
      • 1.3.Working with data
        • 1.3.1.Entity framework
        • 1.3.2.Database First v.s. Code First
        • 1.3.3.Code-first Migrations
        • 1.3.4.Seeding the database
        • 1.3.5.Overriding conventions
        • 1.3.6.Query objects
      • 1.4.Building Forms
        • 1.4.1.The Markup (labelFor, textbox, checkbox)
        • 1.4.2.Labels
        • 1.4.3.Drop down list
        • 1.4.4.Model binding and save data
        • 1.4.5.Edit form
      • 1.5.Implement validation
        • 1.5.1.Adding validation
        • 1.5.2.Data annotation
        • 1.5.3.Client side validation
        • 1.5.4.Anti-forgery Tokens
      • 1.6. Building RESTful API
        • 1.6.1. What is Web API?
        • 1.6.2. RESTful convetion
        • 1.6.3. Building a API and testing
        • 1.6.4. Data Transfer Object
        • 1.6.5. Use camel annotation
        • 1.6.6. Use IHttpActionResult
      • 1.7.Client-side Development
        • 1.7.1.Calling an API using jQuery
        • 1.7.2.Bootbox plug-in
        • 1.7.3.DataTable plug-in using AJAX source
        • 1.7.4.Returning Hierarchical Data
      • 1.8.Authentication and Authorization
        • 1.8.1.The problem
        • 1.8.2.Authentication options
        • 1.8.3.Restricting Access
        • 1.8.4.Seeding Users and Roles
        • 1.8.5.Working with Roles
        • 1.8.6.Adding Profile Data
        • 1.8.7.OAuth
        • 1.8.8.Social Logins
      • 1.9.Performance Optimization
        • 1.9.1.Overview
        • 1.9.2.Data Tier
        • 1.9.3.Glimpse
        • 1.9.4.Output Cache
        • 1.9.5.Data Cache
        • 1.9.6.Async
        • 1.9.7.Disabling Session
        • 1.9.8.Client Tier
      • 1.10.Building a Feature End-to-End Systematically
        • 1.10.1.Domain Modelling
        • 1.10.2.Adding Auto-completion
        • 1.10.3.Updating the DOM
        • 1.10.4.Implementing Client-side Validation
      • 1.11.Deployment
        • 1.11.1.Deploying the application
        • 1.11.2.Deploying the database
        • 1.11.3.Build configurations
        • 1.11.4.Application settings
        • 1.11.5.Custom Error Pages
        • 1.11.6.Logging Unhandled Exceptions
      • 1.12.Approved collection server
        • 1.12.1.Overview
        • 1.12.2.測試上傳審批資料
        • 1.12.3.取得Token的方式
        • 1.12.4.測試取得審批資料, Log資料
        • 1.12.5.將API接口綁定到雲之家審批
    • 1.2.Skilltree MVC 實戰營筆記
      • 1.2.1..NET MVC overview and razor view
      • 1.2.2.Controller, Model, Entity framework, service
      • 1.2.3.HTML helper, Extension method, Validation
      • 1.2.4.Security, ActionFilter, ActionResult
      • 1.2.5.DataType, Templates
  • Chapter2.SignalR
    • 2.1.Getting started
      • 2.1.1.Install signalR on VS2013
    • 2.2.Basic of SignalR
      • 2.2.1.Chat App Ovierview
      • 2.2.2.Creating a hub
      • 2.2.3.Connecting to the hub
      • 2.2.4.Create A server method and calling from client
      • 2.2.5.Passing parameters to server method from client
      • 2.2.6.Creating a client method and calling from server
    • 2.3. Exploring the class hub and group chat
      • 2.3.1.OnConnected, OnDisconnected
      • 2.3.2. ContextObject and JSON serialization
      • 2.3.3. Clients Object's Methods
      • 2.3.4. Add Or Remove Connection From Groups
      • 2.3.5. Sending Messages To Different Groups
  • Chapter3.REST API Design, Development & Management
    • 3.1.Evolution of RESTful services
      • 3.1.1.Evolution of REST/JSON API
      • 3.1.2.Introduction to RESTful API
      • 3.1.3.Private, Public and Partner API
    • 3.2.REST API Architectural Constraints
      • 3.2.1.Introduction to REST Architecture Constraints
      • 3.2.2.Client-Server
      • 3.2.3.Uniform Interface
      • 3.2.4.Statelessness
      • 3.2.5.Caching
      • 3.2.6.Layered system
      • 3.2.7.Code on demand
      • 3.2.8.Richardson Maturity Model for REST API
    • 3.3.Designing REST API
      • 3.3.1.API value chain
      • 3.3.2.Practices for Resource Names, Actions & Associations
      • 3.3.3.Implementing REST API CRUD operations
      • 3.3.4.Walkthrough: Creating a Vacations API in Node JS
      • 3.3.5.REST API Error Handling Practices
      • 3.3.6.Walkthrough: Implementation of error handling for POST API
      • 3.3.7.Versioning the API
      • 3.3.8.API Caching (1 of 2) Concepts & Design decisions
      • 3.3.9.API Caching (2 of 2) Concepts & Design decisions
      • 3.3.10. Demo - API Caching using Cache-Control Directives
      • 3.3.11.Building support for Partial Responses
    • 3.4.REST API Security
      • 3.4.1.REST API Security - Introduction
      • 3.4.2.Securing API with Basic Authentication
      • 3.4.3.Securing API with Tokens & JWT
      • 3.4.4.Securing API with API Key & Secret
      • 3.4.5.API Authorization using OAuth2.0
        • 3.4.5.1.Authorization scope grant (Refresh token grant)
        • 3.4.5.2.Client credentials grant
        • 3.4.5.3.Implicit Grant
        • 3.4.5.4.Resource owner credentials grant
      • 3.4.6.API Security - Functional Attack
    • 3.5.REST API Specifications using Swagger 2.0 / OAI
      • 3.5.1.Requirements Analysis Process & Intro to REST Specifications
      • 3.5.2.Swagger/OAI Specifications Walkthrough
      • 3.5.3.Swagger/OAI Specifications, Part 1 of 3
      • 3.5.4.Swagger/OAI Specifications, Part 2 of 3
      • 3.5.5.Swagger/OAI Specifications, Part 3 of 3
    • 3.6.API management
      • 3.6.1.Introduction to API Management
      • 3.6.2.API Lifecycle & Developer Productivity
      • 3.6.3.API Developer Portal
      • 3.6.4.API Security management
      • 3.6.5.API Traffic Management
      • 3.6.6.API Analytics
      • 3.6.7.API Product and API Monetization
    • 3.7.Summary
  • Chapter4.REST API/Web Services testing with SoapUI
    • 4.1.Web Service Basics
      • 4.1.1.Introduction of WSDL
      • 4.1.2.Introduction of SOAP
      • 4.1.3.Introduction to XML
    • 4.2.SoapUI Basics
      • 4.2.1.Create TestSuite and TestCase
      • 4.2.2.Exporting and Importing project into workspace
      • 4.2.3.Running mock service- might come handy when your actual service is down
    • 4.3.Assertion
      • 4.3.1.XPath Expression
      • 4.3.2.Writing first assertion
      • 4.3.3.Assertions - Compliance,Status & Standards
      • 4.3.4.XQuery assertion
      • 4.3.5.Handling CDATA - using XPath and Groovy
    • 4.4.Working with Properties
      • 4.4.1.Property expansion
Powered by GitBook
On this page

Was this helpful?

  1. Chapter3.REST API Design, Development & Management
  2. 3.3.Designing REST API

3.3.3.Implementing REST API CRUD operations

Previous3.3.2.Practices for Resource Names, Actions & AssociationsNext3.3.4.Walkthrough: Creating a Vacations API in Node JS

Last updated 5 years ago

Was this helpful?

  • has 3 parts:

    • 1.HTTP method, HTTP協議語句 (Protocol statement)

    • 2.HTTP status code

    • 3.Representation formats

  • HTTP method

    • HTTP Verbs/ Methods = CRUD

  • HTTP status code

    • All HTTP responses have a 3 digit status code

      • 1xx: Informal e.g., 100: Continue

      • 2xx: Success e.g., 200: OK

      • 3xx: Redirection e.g., 307: Temporary redirect

      • 4xx: Client error e.g., 404: Not found

      • 5xx: Server error e.g., 500: Internal server error

  • [POST]

    • 基於給定的訊息, 在當前資源的下一層創建新的資源

      • e.g., /vacations, /vacations/{id}/reviews

    • 不符合冪等性

    • 類型1: POST-to-append

      • 在當前資源的下一層創建新的資源

    • 類型2: overloaded POST

      • "向數據處理流程提供例如表單提交結果的數據塊"

      • 不僅被用作創建新的資源, 也被用於傳輸任何形式的變化, 他將PUT, DELETE, PATCH, LINK, UNLINK所有的方法混合成一個方法

    • Response

      • 狀態碼

        • Sucesss: e.g., code = 201

          • May return a link (id) to new resource in Location header e.g., Location:

          • May return a new object

        • Failure:

          • 4xx Bad request e.g., 400 missing required field

          • 5xx Issue in processing e.g., 503 database unreachable

      • 響應表頭 (response header)

        • content type

          • Content-Type

            • application/vnd.collection+json

  • [GET]

    • 從資源處獲取一個, 並且沒有主觀去改變資源的意圖, 但在現實生活中不能保重GET請求是安全的, 在設計時賦予GET請求重大的副作用是不合理的

      • e.g., /vacations, /vacations/{id}

    • Response

      • 實體消息體 (entity body)

      • 狀態碼

        • Sucesss: e.g., code = 200 OK

          • Send back the response requested format e.g., GET

        • Failure:

          • 4xx Bad request e.g., 404 Resource not found

          • 5xx Issue in processing e.g., 500 Internal server error

      • 響應表頭 (response header)

        • content type

  • [PUT/PATCH]

    • 用於修改資源狀態的請求

      • PUT

        • Update all attributes of existing resource - effectively replace

        • Can also CREATE if client provide ID (not suggested)

      • PATCH

        • Modified parts of an existing resource.

          • e.g., PATCH

    • 符合冪等性 (Idempotence)

    • Return

      • Sucesss: e.g., code = 200 OK, 204 Content, 201 Created

        • Resource in body of response(optional)

        • No need to send the link (optional)

  • [DELETE]

    • 銷毀一個資源

      • e.g., /vacations, /vacations/{id}

    • 符合冪等性 (Idempotence)

      • 發送兩次請求和發送一次請求的響應是一樣的

    • Response

      • 實體消息體 (entity body)

      • 狀態碼

        • Sucesss:

          • code = 200 OK

            • May return deleted resource in the response body

          • code = 204

            • No returned content = 204

        • Failure:

          • 4xx Bad request e.g., 404 Resource not found

          • 5xx Issue in processing e.g., 503 database unreachable

  • [OPTIONS]

    • 獲取這個資源所能響應的HTTP方法列表

  • [LINK]

  • [UNLINK]

  • Resource representation

    • Request

      • Query parameters

        • e.g., /search?q=iphone&format=xml

      • HTTP Header accepts

        • e.g., Accepts: application/json

      • Resource Format Suffix

        • e.g., /programmes/schedules/fm/today.json

      • Use of HTTP Accept header is not so common

      • Most providers set default format = json

    • Response

      • 1.Content-Type

      • 2.HTTP status code = 415, Requested format not supported

      • 3.Document

        • (a) supported formats

        • (b) how requester specifies

Uniform Interface Constraint
RFC2616
http://api/acme.com/vacations/121/reviews/2
表述(representation)
http://api/acme.com/vacations/121
http://api/acme.com/vacations/121?valifTill=3/1/2017