Facebook
Twitter
LinkedIn
YouTube
GitHub
Hasan's Blog
  • General
  • CI/CD
  • DevOps
  • Test Mgmt & Automation
  • Blog
    • About me

CURD functions and REST api

2017/06/06Hasan YousufUncategorized

CURD functions and REST api

Curd functions are synonymous of modifying the information in the database world. If you have heard the CRUD before. It means create, Read, Update & delete. Level 2 of Richardson maturity level is about matching services with their HTTP Verbs. CRUD functions are mapped to their HTTP equivalents. So, we use

  • Create = POST
  • Read = GET
  • Update = PUT
  • Delete = DELETE

Often times, people will use POST for Create and Update because of return types PUT allows.

JSON

  1. JSON stands for JavaScript Object Notation
  2. By the way, it is pronounced as "Jason"
  3. It is preferred when working with JavaScript clients
  4. It is looser way to represent data
  5. It is Flexible and easy to work with
  6. The most common reason, people use JSON. JSON is not XML. There are lot of good things that XML brings to the table. If you donot need it, JSON just works fine and if your clients are only going to be consumed or your clients are using only JavaScript. It makes sense to use JSON. There is no need to package something in XML. Send that down to a JavaScript client. Have it start with the parser and go through that.
  7. It is difficult to validate JSON. There is no way to through and say 'It is valid JSON'.

To use JSON all we have to do to annotate our method Produces like

@Produces(MediaType.APPLICATION_JSON)

It tells us that application is producing JSON

XML

  1. XML offen associated with SOAP
  2. It is still great solution for REST
  3. REST does't mean unstructured
  4. It is easy to validate, confirm well formed. We can put schema and structure around it so we know what we are navigating.
  5. To use XML, all we have to do annotate our method Produces like
@Produces(MediaType.APPLICATION_XML)

Binary

Binary is not necessarily an alternative to JSON or XML
It is used to serve objects. e.g.,

Files
Images
PDFs

Here I does mean JAVA objects, binary things we normally serves statically or that are stored in your database. To use binary we annotate our method Produces like

@Produces(MediaType.APPLICATION_OCTET_STREAM)

Related Posts:

  • How to import data in couchdb using JSON file
  • java.lang.IllegalArgumentException: Object:…
  • Delete docker images & containers in one command
  • How To Install Java with Apt-Get on Ubuntu 16.10
  • fatal error unable to find local grunt. jenkins
  • Error message when I run sudo: unable to resolve host

Share this:

  • Twitter
  • Facebook

Related

Previous post Delete docker images & containers in one command Next post VirtualBox fails with “Implementation of the USB 2.0 controller not found”

Hasan Naqvi

Categories

  • Casperjs (1)
  • CI/CD (4)
  • DevOps (6)
  • Gruntjs (2)
  • Jira (1)
  • Linux (1)
  • Programming (1)
  • Uncategorized (14)
  • VMware (1)

Archives

  • May 2020 (1)
  • April 2020 (1)
  • March 2020 (2)
  • September 2019 (2)
  • May 2018 (1)
  • September 2017 (3)
  • July 2017 (1)
  • June 2017 (4)
  • May 2017 (1)
  • July 2015 (2)
  • January 2015 (1)
  • October 2014 (1)
  • September 2014 (5)
  • August 2014 (1)

Tags

Arduino Arduino sketch Arduino sketch upload bash shell casperjs Couchdb Curl docker container docker images github Gitlab gnu Parallel gruntjs JAVA JAVA jenkins Jira JPA Json Linux linux mint Maven mint MYSQL Tomcat Ubuntu Version Control xpath

Top Posts & Pages

  • CURD functions and REST api
  • How to completely uninstall Android Studio on MAC?
  • Before you can run vmware several modules must be compiled and loaded into the running kernel
  • Trying to upload Blink example (Arduino sketch) on my Arduino uno
  • fill form using xpath in casperjs
  • Delete docker images & containers in one command
  • How to import data in couchdb using JSON file

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

  • General
  • CI/CD
  • DevOps
  • Test Mgmt & Automation
  • Blog
    • About me
@2017