Friday, 29 March 2019

HTTP Clients

HTTP Requests
  • Initial Line
    • method (GET, POST, Delete..)
    • path
  • Headers
    • Language
    • client version
    • type(response type)
  • Body
    • input fields, user/pwd details

HTTP Response
  • Initial/status Line
    • Status code
    • message
    • version
  • Headers
    • type
    • length
    • Language
  • Body(optional)
    • formatted/plain response
Browsers support ONLY GET & POST requests.
GET
  • Doesn't have BODY
  • Pass parameters directly in URL(Query String)
POST
  • To Create
Put and Patch
  • To update existing resource
  • PUT to update whole resource
  • Patch to update some of the attribute of a resource
  • Doesn't receive/support form data. They receive/support only form-urlencoded.
Delete
  • form-urlencoded method for body
HTTP Status/Response
  • 404 - resource doesn't exist
  • https://en.wikipedia.org/wiki/List_of_HTTP_status_codes

Oauth
  • grant_type: client_credentials //In body
    • client_id
    • client_secret
  • grant_type:password
    • Client credentials
    • User credentials
Ways to send access token to the actual request
  • Body of the request
    • access_token:<value of the token>
  • Header of the request
    • Authorizatoin:Bearer <value of the token>
    •  

No comments:

Post a Comment